[IR builder] cudaErrorCudartUnloading


I used IR builder to write get_valid_counts, and in topi unit test, there’s no problem running individual test. But when I put multiple individual tests, it would give me this error:
CUDA: Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading: an illegal memory access was encountered

I think there’s something to do with codegen caching for IR builder.
Error message attached here:

Generated IR looks like this:



please check if it is related to wrong rewrite of the code https://github.com/dmlc/tvm/blob/master/python/tvm/build_module.py#L390