Skip to content

Commit

Permalink
Add proposed major/minor version change
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Jan 4, 2023
1 parent 0bbb70c commit 80669fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
10 changes: 9 additions & 1 deletion docs/source/c_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Macros

.. doxygendefine:: DLPACK_EXTERN_C

.. doxygendefine:: DLPACK_VERSION
.. doxygendefine:: DLPACK_MAJOR_VERSION

.. doxygendefine:: DLPACK_MINOR_VERSION

.. doxygendefine:: DLPACK_DLL

Expand All @@ -22,6 +24,9 @@ Enumerations
Structs
~~~~~~~

.. doxygenstruct:: DLPackVersion
:members:

.. doxygenstruct:: DLDevice
:members:

Expand All @@ -33,3 +38,6 @@ Structs

.. doxygenstruct:: DLManagedTensor
:members:

.. doxygenstruct:: DLManagedTensorVersioned
:members:
26 changes: 13 additions & 13 deletions include/dlpack/dlpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#define DLPACK_EXTERN_C
#endif

/*! \brief The current version of dlpack */
#define DLPACK_VERSION 80
/*! \brief The current major version of dlpack */
#define DLPACK_MAJOR_VERSION 1

/*! \brief The current ABI version of dlpack */
#define DLPACK_ABI_VERSION 2
/*! \brief The current minor version of dlpack */
#define DLPACK_MINOR_VERSION 0

/*! \brief DLPACK_DLL prefix for windows */
#ifdef _WIN32
Expand All @@ -40,19 +40,19 @@ extern "C" {
#endif

/*!
* \brief The DLPack and DLPack ABI versions of the tensor.
* \brief The DLPack version.
*
* The DLPack version changes when we introduce new device type,
* data type that is compatible with existing ones.
* A change in major version indicates that we have changed the
* data layout of the ABI - DLManagedTensorVersioned.
*
* The DLPack ABI version changes when we change the data layout
* of the DLManagedTensorVersioned.
* A change in minor version indicates that we have added new
* code, such as a new device type, but the ABI is kept the same.
*/
typedef struct {
/*! \brief DLPack version. */
uint32_t dlpack;
/*! \brief DLPack ABI version. */
uint32_t abi;
/*! \brief DLPack major version version. */
uint32_t major;
/*! \brief DLPack minor version. */
uint32_t minor;
} DLPackVersion;

/*!
Expand Down

0 comments on commit 80669fa

Please sign in to comment.