You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TVM project defines another enumeration, TVMDeviceExtType, that provides a supplemental set of devices / enumerators. It's important that there's no overlap of the integers provided by DLDeviceType and TVMDeviceExtType.
Unfortunately there's currently no good mechanism to notice when changes to either project lead to both using the same integer value in those enumerations.
We could address this by adding a sentinel value to DLDeviceType, e.g.:
typedefenum {
kDLDeviceType_Begin = 1,
kDLCPU = kDLDeviceType_Begin,
...
kDLWebGPU = 15,
/*! \brief Qualcomm Hexagon DSP */kDLHexagon = 16,
kDLDeviceType_End, // all DLDeviceType enumerators are guaranteed to be numerically lower than this integer
} DLDeviceType;
With this in place, TVM could safely avoid problems using something like this:
typedefenum {
kDLAOCL = kDLDeviceType_End,
kDLSDAccel,
kOpenGL,
kDLMicroDev,
kDLWebGPU,
// AddExtraTVMType which is not in DLPack here
} TVMDeviceExtType;
or this:
typedefenum {
kDLAOCL = ...,
...
} TVMDeviceExtType;
// Relies on kDLAOCL having the lowest integer value in TVMDeviceExtType.static_assert(KDLAOCL > kDLEnumEnd);
``
The text was updated successfully, but these errors were encountered:
DLDeviceType does not define enumerators for -1 and 0, but
the compiler does pick an underlying data type that's capable of expressing -1 and 0.
Probably the right solution is for TVM to stop making such strong assumptions about this enumeration, especially in code that needs to compile as C rather than C++.
But if DLPack wants to help TVM avoid problems, then this enumeration should provide both kDLDeviceType_Begin and kDLDeviceType_End.
The
DLDeviceType
enum enumerates the list of device types.The TVM project defines another enumeration,
TVMDeviceExtType
, that provides a supplemental set of devices / enumerators. It's important that there's no overlap of the integers provided byDLDeviceType
andTVMDeviceExtType
.Unfortunately there's currently no good mechanism to notice when changes to either project lead to both using the same integer value in those enumerations.
We could address this by adding a sentinel value to
DLDeviceType
, e.g.:With this in place, TVM could safely avoid problems using something like this:
or this:
The text was updated successfully, but these errors were encountered: