Hi there,
I ran into a build-error in autoTVM, when using call_packed and a custom python function for tensorization.
This is the used python function:
@tvm.register_func("tvm.contrib.gemv_update")
def gemv_update(c, a, b, m, l, stride):
C = c.asnumpy()
B = b.asnumpy()
A = a.asnumpy()
C = A.dot(B.T)
c.copyfrom(C)
return 0
and changed the call from tensorize.py to :
ib.emit(tvm.call_packed("tvm.contrib.gemv_update",cc,aa,bb,m,l,bb.strides[0])
Without AutoTVM, this approach builds and runs successfully.
However, If I use this code in AutoTVM (I added the code to tune_simple_template.py ) , the following error appears when running the tuner:
(RuntimeError('Except caught from RPC call: TVMCall CFunc Error:
Traceback (most recent call last): File "/home/rid2rng/tvm/tvm/python/tvm/_ffi/_ctypes/function.py", line 55, in cfun
rv = local_pyfunc(*pyargs)
File "/home/rid2rng/tvm/tvm/python/tvm/rpc/server.py", line 50, in load_module
m = _load_module(path)
File "/home/rid2rng/tvm/tvm/python/tvm/module.py", line 241, in load
_cc.create_shared(path + ".so", files)
File "/home/rid2rng/tvm/tvm/python/tvm/contrib/cc.py", line 33, in create_shared
_linux_shared(output, objects, options, cc)
File "/home/rid2rng/tvm/tvm/python/tvm/contrib/cc.py", line 58, in _linux_shared
raise RuntimeError(msg)\nRuntimeError: Compilation error:
/usr/bin/ld: /tmp/tmpt5frypyt/lib.o: relocation R_X86_64_32S against `.rodata.cst16\' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output\ncollect2: error: ld returned 1 exit status\n\n',),), error_no=4,
The error Message appears in the AutoTVM tuning log print, in MeasureResults(costs=,…)
It looks like the object file used by LocalBuild in AutoTVM isn’t built with the -fPIC flag.
Is this fixable by adding the -fPIC flag to build of the object? If so, where would I have to do this?