Open cconvey opened 2 years ago
Update: I noticed that TVM also assumes that:
DLDeviceType
does not define enumerators for -1 and 0, butProbably 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: