How to add a new device in tvm-0.22

Hi, TVM Team:

In the latest version of tvm, due to the upgrade of the tvm_ffi project, is it now only possible to add new devices to the tvm_ffi project? when call:

tvm.runtime.device("new_device", 0)

it will call: tvm-ffi/python/tvm_ffi/_tensor.py", line 93, in device

  return core._CLASS_DEVICE(device_type, index)
  File "python/tvm_ffi/cython/device.pxi", line 127, in core.Device.__init__

The above calls the code from the tvm_ffi project.

i try add new device type in include/tvm/runtime/device_api.h file:

#ifdef __cplusplus
typedef enum : int32_t {
#else
typedef enum {
#endif
  // To help avoid accidental conflicts between `DLDeviceType`
  // and this enumeration, start numbering the new enumerators
  // a little higher than (currently) seems necessary.
  TVMDeviceExtType_End = 36,  // sentinel value
  kDLMYDEVICE,
} TVMDeviceExtType;

and add in DLDeviceType2Str function:

inline const char* DLDeviceType2Str(int type) {
  switch (type) {
    case kDLCPU:
      return "cpu";
    case kDLMYDEVICE:
      return "mydevice";
   ...

If the above operations do not work, is there a mechanism in TVM that allows direct registration of a new device?

Thanks.

do you any progress?