[VTA]AutoTVM tutorial error with pynq - export_library

Hi, I’m following AutoTVM w/ vta tutorial with pynq-z1 board and I got the error message like this:

Why did this error occured? I found this discussion, and wondering whether it suits for pynq(vta) because this discussion is for cpu device and mine is pynq FPGA(vta) board.

It seems that the compile command is failing at this function.

The failed command is at the end of your screen capture.

It could be some of your binary is built for different target? I would double check vta config file. Make sure your TARGET is correct, some cases I’ve seen was actual target was 64 bit, but config file was 32 bit target, which caused an issue.


def _linux_compile(output, objects, options, compile_cmd="g++", compile_shared=False):
    cmd = [compile_cmd]
    if compile_shared or output.endswith(".so") or output.endswith(".dylib"):
        cmd += ["-shared", "-fPIC"]
        if sys.platform == "darwin":
            cmd += ["-undefined", "dynamic_lookup"]
    elif output.endswith(".obj"):
        cmd += ["-c"]
    cmd += ["-o", output]
    if isinstance(objects, str):
        cmd += [objects]
    else:
        cmd += objects
    if options:
        cmd += options
    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    (out, _) = proc.communicate()
    if proc.returncode != 0:
        msg = "Compilation error:\n"
        msg += py_str(out)
        msg += "\nCommand line: " + " ".join(cmd)
        raise RuntimeError(msg)

Hi, isong! Thank you for response!

My current vta config file at host side(tvm/3rdparty/vta-hw/config/vta_config.json) is

and I’m using pynq-z1 board now.

The vta_config.json file at pynq side is like below: (Do I have to check this file too??)

Also, I’m also confused whether vta contains CPU+FPGA combination or just FPGA.

I solved, but I don’t know why it works. I checked your git commit, https://github.com/apache/tvm/pull/7100/files#diff-eebeea4138edef860d9fbecfca6d83ebdfa750527b53b15f76d989668d81e065L343-L354

I changed lib.export_library(temp.relpath("graphlib.o")) this code to lib.export_library(temp.relpath("graphlib.tar"))

Why does this work? The only thing I did is changing graphlib.o file to graphlib.tar file.


Also, when executing code, it found some warning message like this:

[Task 8/10] Current/Best: 0.00/ 1.58 GFLOPS | Progress: (10/10) | 5.36 s Done.
[Task 9/10] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (10/10) | 1.31 sWARNING:root:Could not find any valid schedule for task Task(func_name=conv2d_packed.vta, args=((‘TENSOR’, (1, 8, 28, 28, 1, 16), ‘int8’), (‘TENSOR’, (16, 8, 1, 1, 16, 16), ‘int8’), (2, 2), (0, 0, 0, 0), (1, 1), ‘NCHW1n16c’, ‘int32’), kwargs={}, workload=(‘conv2d_packed.vta’, (‘TENSOR’, (1, 8, 28, 28, 1, 16), ‘int8’), (‘TENSOR’, (16, 8, 1, 1, 16, 16), ‘int8’), (2, 2), (0, 0, 0, 0), (1, 1), ‘NCHW1n16c’, ‘int32’)). A file containing the errors has been written to /tmp/tvm_tuning_errors_rjrt44ra.log.
Done.
[Task 10/10] Current/Best: 0.00/ 11.05 GFLOPS | Progress: (10/10) | 21.55 s Done.
Compile…
Upload…
Evaluate inference time cost…
Mean inference time (std dev): 755.27 ms (11.72 ms).

Is this negligible error?

@woojinnn

They need to be the same for the same hw. The below warning could be due to the limited operator definition. The warning just saying that with certain operator for Tensor size cannot be fit to your currently defined vta.

Doesn’t AutoTVM automatically fit it? Like massaging tensor size to fit vta spec. Is there any workaround to solve that warning message? Actually, I think I didn’t got the concept of AutoTVM… :thinking:


My ultimate goal is to solve cart-pole problem with reinforcement learning(DQN), and I made a fully-connected layer model whose layer’s shape is 4(input) * 64 * 2(output). When I run the code, it showed the similar error like that. Again, is there any workaround?

AutoTVM is template based searching method that searches to find a better inference by using different implementations for certain operators. I think the warning indicates that the vta you have cannot run certain type sof kernel natively because of it is built with different vta config or loaded limited vta config either on host or run time, as you loaded different files.

To use vta for dens operator, your inputs needs to be quantized and packed. As in this example, vta dense expects the input to be packed

I think you need to have a way to modify your network to add input pack layer before your dense operator, something like in this file.

There could be few other ways, but I think adding a way to modify your network would seems to be more favorable way.

HIH