Autotvm AttributeError module tvm has no attribute 'analysis'

While trying to autotune a predefined model using code in tutorial, simply it cannot tune it and return an attribute error every step of tuning, which is something like:

DEBUG:autotvm:No: 360	GFLOPS: 0.00/0.00	result: MeasureResult(costs=(AttributeError('Traceback (most recent call last):
  [bt] (5) /home/can/Dev/tvm/build/libtvm.so(TVMFuncCall+0x65) [0x7f5f9b12e315]
    [bt] (4) /home/can/Dev/tvm/build/libtvm.so(+0x4ecc0d) [0x7f5f9a96fc0d]
      [bt] (3) /home/can/Dev/tvm/build/libtvm.so(tvm::transform::Pass::operator()(tvm::IRModule) const+0x70) [0x7f5f9a921cf0]
        [bt] (2) /home/can/Dev/tvm/build/libtvm.so(tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const+0x30d) [0x7f5f9a96e8fd]
          [bt] (1) /home/can/Dev/tvm/build/libtvm.so(tvm::tir::transform::PrimFuncPassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const+0x609) [0x7f5f9ab337a9]
            [bt] (0) /home/can/Dev/tvm/build/libtvm.so(+0xca71db) [0x7f5f9b12a1db]
              File "tvm/_ffi/_cython/./packed_func.pxi", line 55, in tvm._ffi._cy3.core.tvm_callback
                File "/home/can/Dev/tvm/python/tvm/autotvm/measure/measure_methods.py", line 618, in verify_pass
                    valid = tvm.analysis.verify_gpu_code(f, kwargs)
                    AttributeError: module \'tvm\' has no attribute \'analysis\'',),), error_no=2, all_cost=0.015072822570800781, timestamp=1588124691.6949089)	[('tile_f', [-1, 1, 32, 16]), ('tile_y', [-1, 1, 1, 1]), ('tile_x', [-1, 1, 1, 1]), ('tile_rc', [-1, 2]), ('tile_ry', [-1, 1]), ('tile_rx', [-1, 1]), ('auto_unroll_max_step', 512), ('unroll_explicit', 1)],None,130424
WARNING:autotvm:Too many errors happen in the tuning. Now is in debug mode

Have you ever encountered this problem before?

Did you upstream and re-build? Line 618 in upstream is

valid = tvm.tir.analysis.verify_gpu_code(f, kwargs)

Hi @comaniac, thanks for answer, I don’t know what ‘upstream’ means exactly, but I changed cmake config and remake TVM, if you mean that. Also, I used ninja for building.

upstream means the up-to-date version you got from GitHub. You can compare the TVM in your local with the one on GitHub:

You need to git pull to get the up-to-date commit and rebuild TVM.

Thank you so much for really quick reply, it looks working :slight_smile:

Hello again @comaniac. It’s already 5 hours but it printed only the following:

Extract tasks...
ANTLR runtime and generated code versions disagree: 4.8!=4.7.2
ANTLR runtime and generated code versions disagree: 4.8!=4.7.2
Tuning...

I checked htop and all the 8 cores of CPU are working almost with 100% capacity. But still didn’t show any [Task 1/12] Current/Best: kind of steps. Is that normal? I have changed only the RPCRunner to LocalRunner in the tutorial. I have GTX 1070 GPU and i7-7700 CPU.

This is not normal. It seems the tuning task hasn’t even been started.

It’s doing something continuously and writing in the log.tmp file something like:

{“input”: [“cuda -model=unknown”, “conv2d_nchw.cuda”, [[“TENSOR”, [1, 512, 7, 7], “float32”], [“TENSOR”, [512, 512, 3, 3], “float32”], [1, 1], [1, 1, 1, 1], [1, 1], “float32”], {}], “config”: {“index”: 678112, “code_hash”: null, “entity”: [[“tile_f”, “sp”, [-1, 1, 4, 2]], [“tile_y”, “sp”, [-1, 1, 7, 1]], [“tile_x”, “sp”, [-1, 1, 7, 1]], [“tile_rc”, “sp”, [-1, 4]], [“tile_ry”, “sp”, [-1, 3]], [“tile_rx”, “sp”, [-1, 3]], [“auto_unroll_max_step”, “ot”, 512], [“unroll_explicit”, “ot”, 1]]}, “result”: [[0.0003143764178794179], 0, 1.337676763534546, 1588179052.3210754], “version”: 0.2, “tvm_version”: “0.7.dev1”}

I stopped it and have started another example and this one looks working now. It prints some numbers for progress and the current best.

If the log was printed out to a file then it should be working. It seems like there were problems in console printing.