Nvcc fatal : Value 'sm_75' is not defined for option 'gpu-architecture'


#1

I compiled a LeNet(NCHW format) with target=cuda, target_host=llvm.
The environment is:

GPU = GTX 1660 Ti
cuda = 9.0
tensorflow-gpu = 1.12.0

The piece of compiling code is:

mod, params = relay.frontend.from_tensorflow(graph_def, layout='NCHW', shape=[1, 1, 28, 28])
with tvm.build_config(opt_level=3, dump_pass_ir=True):
     graph, lib, params = relay.build(mod, target='cuda', target_host='llvm', params=params)

The model architecture is:

with slim.arg_scope([slim.conv2d], 
        activation_fn=tf.nn.relu, 
        data_format=data_format,
        padding='same',
        weights_initializer=tf.truncated_normal_initializer(0.0, 0.01),
        biases_initializer=tf.zeros_initializer(),
        weights_regularizer=slim.l2_regularizer(0.0001)):
        net = slim.conv2d(inputs, 32, [5, 5], scope='conv1')
        net = slim.max_pool2d(net, [2, 2], 2, scope='pool1', data_format=data_format)
        net = slim.conv2d(net, 64, [5, 5], scope='conv2')
        net = slim.max_pool2d(net, [2, 2], 2, scope='pool2', data_format=data_format)
        net = slim.flatten(net, scope='flatten')
        net = slim.fully_connected(net, 1024, activation_fn=tf.nn.relu, \
            biases_initializer=tf.zeros_initializer(), scope='fc3')
        net = slim.fully_connected(net, 10, scope='fc4')
        return net

The complete error message is:

  File "compile/compile_lenet_mnist.py", line 161, in <module>
    compile_module('lenet_mnist_pb_gpu/model.pb', 'modules_gpu/lenet_mnist', layout='NCHW')

  File "compile/compile_lenet_mnist.py", line 109, in compile_module
    graph, lib, params = relay.build(mod, target='cuda', target_host='llvm', params=params)

  File "/home/max/workspaces/python/tvm/python/tvm/relay/build_module.py", line 207, in build
    graph_json, mod, params = bld_mod.build(func, target, target_host, params)

  File "/home/max/workspaces/python/tvm/python/tvm/relay/build_module.py", line 108, in build
    self._build(func, target, target_host)

  File "/home/max/workspaces/python/tvm/python/tvm/_ffi/_ctypes/function.py", line 210, in __call__
    raise get_last_ffi_error()

tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (8) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::relay::backend::RelayBuildModule::GetFunction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<tvm::runtime::ModuleNode> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#3}::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const+0x982) [0x7fdcc97d7782]
  [bt] (7) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::relay::Function, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tvm::runtime::NDArray, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, tvm::runtime::NDArray> > > const&)+0xd5f) [0x7fdcc97d69ff]
  [bt] (6) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::build(tvm::Map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tvm::Array<tvm::LoweredFunc, void>, void, void> const&, tvm::Target const&, tvm::BuildConfig const&)+0x3a9) [0x7fdcc92f75e9]
  [bt] (5) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::build(tvm::Map<tvm::Target, tvm::Array<tvm::LoweredFunc, void>, void, void> const&, tvm::Target const&, tvm::BuildConfig const&)+0x396) [0x7fdcc92f6996]
  [bt] (4) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::DeviceBuild(tvm::Array<tvm::LoweredFunc, void> const&, tvm::Target const&)+0x88) [0x7fdcc92f0b38]
  [bt] (3) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::codegen::Build(tvm::Array<tvm::LoweredFunc, void> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x257) [0x7fdcc92fdd47]
  [bt] (2) /home/max/workspaces/python/tvm/build/libtvm.so(std::_Function_handler<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), tvm::runtime::TypedPackedFunc<tvm::runtime::Module (tvm::Array<tvm::LoweredFunc, void>)>::AssignTypedLambda<tvm::runtime::Module (*)(tvm::Array<tvm::LoweredFunc, void>)>(tvm::runtime::Module (*)(tvm::Array<tvm::LoweredFunc, void>))::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)+0x54) [0x7fdcc932f104]
  [bt] (1) /home/max/workspaces/python/tvm/build/libtvm.so(tvm::codegen::BuildCUDA(tvm::Array<tvm::LoweredFunc, void>)+0x314) [0x7fdcc99249f4]
  [bt] (0) /home/max/workspaces/python/tvm/build/libtvm.so(+0x1c1eb6b) [0x7fdcc997fb6b]
  File "/home/max/workspaces/python/tvm/python/tvm/_ffi/_ctypes/function.py", line 72, in cfun
    rv = local_pyfunc(*pyargs)
  File "/home/max/workspaces/python/tvm/python/tvm/autotvm/measure/measure_methods.py", line 585, in tvm_callback_cuda_compile
    ptx = nvcc.compile_cuda(code, target="ptx", arch=AutotvmGlobalScope.current.cuda_target_arch)
  File "/home/max/workspaces/python/tvm/python/tvm/contrib/nvcc.py", line 98, in compile_cuda
    raise RuntimeError(msg)
RuntimeError: Compilation error:
nvcc fatal   : Value 'sm_75' is not defined for option 'gpu-architecture'