Using TVM_DSO_OP with tensorflow 2.1.0 breaks compilation

I’ve been experimenting with the TVM_DSO_OP feature in TVM with tensorflow but ran into the following issues.

I’m using tensorflow 2.1.0 basically in a docker environment that uses the upstream ci_cpu docker file. The first issue I hit is that we need cmake >= 3.12 rather than cmake >=3.5 as the support for FindPython3 appears to have come only in cmake 3.12.

I’ve put in set(USE_TF_TVMDSOOP ON) in my config.cmake as per the discuss rfc post - I’m just interested in seeing how this works together and it’s a very simple CPU flow that I’m interested in trying out.

Once that was fixed I ran into the following compile time issue when compiling tvm_dso_op_kernels.cc

[ 85%] Building CXX object CMakeFiles/tvm_dso_op.dir/src/contrib/tf_op/tvm_dso_op_kernels.cc.o In file included from /usr/local/lib/python3.6/dist-packages/tensorflow_core/include/tensorflow/core/platform/logging.h:27:0, from /usr/local/lib/python3.6/dist-packages/tensorflow_core/include/tensorflow/core/framework/allocator.h:28, from /usr/local/lib/python3.6/dist-packages/tensorflow_core/include/tensorflow/core/framework/op_kernel.h:25, from /workspace/src/contrib/tf_op/tvm_dso_op_kernels.cc:29: /usr/local/lib/python3.6/dist-packages/tensorflow_core/include/tensorflow/core/platform/default/logging.h:110:0: error: “LOG” redefined [-Werror] #define LOG(severity) TF_LOG##severity

In file included from /workspace/include/tvm/runtime/packed_func.h:27:0, from /workspace/include/tvm/runtime/device_api.h:28, from /workspace/src/contrib/tf_op/tvm_dso_op_kernels.cc:24: /workspace/3rdparty/dmlc-core/include/dmlc/logging.h:274:0: note: this is the location of the previous definition #define LOG(severity) LOG_##severity.stream()

Has anyone else hit this ?

If so what versions of tensorflow is this format looking like it works right now ? Thanks in advance.

regards Ramana

@tobegit3hub

Any thoughts here @tobegit3hub ?

i built tvmdsoop successfully. Guess what? the test code he gave us failed. Actually, 10 people in our group built this tvmdsoop and tried to pass the test he gave. We all failed. i do believe this thing, tvmdsoop is not right for some reason. I also asked him like 10 times from last month, guess what, no answers until now. All i can say now is: good luck man

I have not tested this TVM op on TensorFlow >= 2.0 versions yet. It seems to be a macro duplication error between TF and TVM’s “LOG” symbols, which require some more properly #def and #undef here and there.

In this issue the guy seems finally compile it successfully: Undefined symbol error occured when I use TVMDSOOp

Yes it’s a name clash and appears that all successful builds have happened with tf <2