How to load and read the .params in big endian system?

So glad for contributing TVM better and better.

After updating the code and compiling, some error occurred.

my/path/to/tvm/dmlc-core/include/dmlc/./serializer.h:63:5: error: ‘Write’ is not a member of 'dmlc::serializer::UndefinedSerializerFor’

my/path/to/tvm/dmlc-core/include/dmlc/./serializer.h:66:33: error: ‘Read’ is not a member of 'dmlc::serializer::UndefinedSerializerFor’

I’m not sure the reason why Write and Read were not members.

try git submodule update —recursive

Then rebuild your tvm from scratch

My fault. Forgot to update it. Sorry about that.

Good news is it worked very well ; ). Thanks very much for the byte-order conversion patch.

1 Like

Appreciate @tqchen and @srkreddy1238 for this conversion job again!!!

It looks like compiling on big endian system has been pulled out by a later commit 72fa4c1d93df2e85f89052c72905c3fe67f62a34 so now tvm fails to compile on big endian system. Any reason why? Is there any plan to support big endian again? Thanks.

Can you elaborate, I think this is something we would like to fix

Hi tqchen, we are trying to compile TVM on Linux s390x (IBM mainframe). It’s big endian so the latest master branch fails to compile. We are in the process of attaching AMD GPUs to the mainframe so we are looking at software stack such as TVM+ROCm to allow us to run ML workloads on the GPUs. Thanks.

Would be nice if you post the error message, and we can see if we can attempt a fix

Hi tqchen, the error messages are basically a bunch of these:

In file included from /root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/io.h:445,
                 from /root/Downloads/tvm/include/tvm/runtime/module.h:11,
                 from /root/Downloads/tvm/include/tvm/runtime/packed_func.h:21,
                 from /root/Downloads/tvm/include/tvm/runtime/registry.h:30,
                 from /root/Downloads/tvm/include/tvm/base.h:15,
                 from /root/Downloads/tvm/include/tvm/api_registry.h:11,
                 from /root/Downloads/tvm/src/codegen/verilog/vpi_session.cc:6:
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h: In instantiation of ‘static void dmlc::serializer::IfThenElse<false, Then, Else, T>::Write(dmlc::Stream*, const T&) [with Then = dmlc::serializer::SaveLoadClassHandler<tvm::vpi::VPICallCode>; Else = dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPICallCode>; T = tvm::vpi::VPICallCode]’:
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:63:16:   recursively required from ‘static void dmlc::serializer::IfThenElse<false, Then, Else, T>::Write(dmlc::Stream*, const T&) [with Then = dmlc::serializer::NativePODHandler<tvm::vpi::VPICallCode>; Else = dmlc::serializer::IfThenElse<false, dmlc::serializer::SaveLoadClassHandler<tvm::vpi::VPICallCode>, dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPICallCode>, tvm::vpi::VPICallCode>; T = tvm::vpi::VPICallCode]’
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:63:16:   required from ‘static void dmlc::serializer::IfThenElse<false, Then, Else, T>::Write(dmlc::Stream*, const T&) [with Then = dmlc::serializer::ArithmeticHandler<tvm::vpi::VPICallCode>; Else = dmlc::serializer::IfThenElse<false, dmlc::serializer::NativePODHandler<tvm::vpi::VPICallCode>, dmlc::serializer::IfThenElse<false, dmlc::serializer::SaveLoadClassHandler<tvm::vpi::VPICallCode>, dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPICallCode>, tvm::vpi::VPICallCode>, tvm::vpi::VPICallCode>; T = tvm::vpi::VPICallCode]’
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:275:16:   required from ‘static void dmlc::serializer::Handler<T>::Write(dmlc::Stream*, const T&) [with T = tvm::vpi::VPICallCode]’
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/io.h:451:32:   required from ‘void dmlc::Stream::Write(const T&) [with T = tvm::vpi::VPICallCode]’
/root/Downloads/tvm/src/codegen/verilog/vpi_session.cc:29:29:   required from here
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:63:16: error: ‘Write’ is not a member of ‘dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPICallCode>’
     Else::Write(strm, data);
     ~~~~~~~~~~~^~~~~~~~~~~~
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h: In instantiation of ‘static bool dmlc::serializer::IfThenElse<false, Then, Else, T>::Read(dmlc::Stream*, T*) [with Then = dmlc::serializer::SaveLoadClassHandler<tvm::vpi::VPIReturnCode>; Else = dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPIReturnCode>; T = tvm::vpi::VPIReturnCode]’:
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:66:22:   recursively required from ‘static bool dmlc::serializer::IfThenElse<false, Then, Else, T>::Read(dmlc::Stream*, T*) [with Then = dmlc::serializer::NativePODHandler<tvm::vpi::VPIReturnCode>; Else = dmlc::serializer::IfThenElse<false, dmlc::serializer::SaveLoadClassHandler<tvm::vpi::VPIReturnCode>, dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPIReturnCode>, tvm::vpi::VPIReturnCode>; T = tvm::vpi::VPIReturnCode]’
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:66:22:   required from ‘static bool dmlc::serializer::IfThenElse<false, Then, Else, T>::Read(dmlc::Stream*, T*) [with Then = dmlc::serializer::ArithmeticHandler<tvm::vpi::VPIReturnCode>; Else = dmlc::serializer::IfThenElse<false, dmlc::serializer::NativePODHandler<tvm::vpi::VPIReturnCode>, dmlc::serializer::IfThenElse<false, dmlc::serializer::SaveLoadClassHandler<tvm::vpi::VPIReturnCode>, dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPIReturnCode>, tvm::vpi::VPIReturnCode>, tvm::vpi::VPIReturnCode>; T = tvm::vpi::VPIReturnCode]’
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:294:11:   required from ‘static bool dmlc::serializer::Handler<T>::Read(dmlc::Stream*, T*) [with T = tvm::vpi::VPIReturnCode]’
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/io.h:455:38:   required from ‘bool dmlc::Stream::Read(T*) [with T = tvm::vpi::VPIReturnCode]’
/root/Downloads/tvm/src/codegen/verilog/vpi_session.cc:30:22:   required from here
/root/Downloads/tvm/3rdparty/dmlc-core/include/dmlc/./serializer.h:66:22: error: ‘Read’ is not a member of ‘dmlc::serializer::UndefinedSerializerFor<tvm::vpi::VPIReturnCode>’
     return Else::Read(strm, data);
            ~~~~~~~~~~^~~~~~~~~~~~

OK, so far we only focused on making runtime compatible to big-endian.

We did not yet spend effort to make the compiler compatible as well. Which means you can do make runtime on the mainframe, and use another machine to cross compile to the target.

So my understanding of what you said is that because the runtime is endian aware, I can save a compiled module on little endian and load it on big endian, and the module should run fine on big endian? Any plan to make the compiler also work on big endian? Thanks.