Hi,  I latter found the error is not related with cuda extension. It seemed to be the data type convert error when accessing the tensor.
#include <ATen/ATen.h>
int cuda_dispatch(at::Tensor input, at::Tensor codec) {
  //void *ptr0 = codec.data<char>();  //this would casue the undefined error
  void *ptr1 = codec.data<unsigned char>();  // this is OK
  void *ptr2 = codec.data<short>();  // this is OK
  void *ptr3 = codec.data<int>();  // this is OK
  return 0;
}

Seems only type of char is not support~
Never mind when the official guide says:
at::Tensor::C10_DEPRECATED_MESSAGE("Tensor.data<T>() is deprecated. Please use Tensor.data_ptr <T>() instead.") const  in tensor-ops 13