Error: HIP should dso exportable or binary serializable

I wrote a relay function containing just one operation (subratract).

    input1 = relay.var("i1" , shape = (N,) , dtype = "float16")
    input2 = relay.var("i2" , shape = (N,) , dtype = "float16")
    sub_out = relay.subtract(input1 , input2)
    func = relay.Function([input1 , input2] , sub_out)
    mod = tvm.IRModule.from_expr(func)
    mod = relay.transform.InferType()(mod)

and used

with tvm.transform.PassContext(opt_level=2):
        graph, lib, params =, target="rocm", params=None)

to build with “ROCM” as target. Till here i was able to run the code.
But when i export the library using

lib.export_library("", fcompile=False)

i get following error:

Traceback (most recent call last):
  File "", line 33, in <module>
    lib.export_library("", fcompile=False)
  File "/home/user/pim-workspace/rib_tvm/tvm/python/tvm/runtime/", line 503, in export_library
    modules = self._collect_dso_modules()
  File "/home/user/pim-workspace/rib_tvm/tvm/python/tvm/runtime/", line 440, in _collect_dso_modules
    return self._collect_from_import_tree(lambda m: m.is_dso_exportable)
  File "/home/user/pim-workspace/rib_tvm/tvm/python/tvm/runtime/", line 429, in _collect_from_import_tree
    ), f"Module {module.type_key} should be either dso exportable or binary serializable."
AssertionError: Module hip should be either dso exportable or binary serializable.

Could anyone please point me right direction for this issue?

CC @sunggg if you wanted to take a look :slight_smile:

Hi, @yogeesh. That seems odd to me since ROCMModuleNode is set as binary serializable correctly.

Would you check if you are failing at ROCMModuleNode and how their module property is set?

I don’t have AMD machine so I couldn’t reach where you are at unfortunately. Build failed because of missing rocm-related dependency.

  File "/home/ubuntu/tvm/python/tvm/contrib/", line 171, in callback_rocm_bitcode_path
    raise RuntimeError("could not find bitcode " + n)
RuntimeError: could not find bitcode oclc_daz_opt_on

I think it was patched as of last week, so maybe a matter of updating the source to latets

hi @junrushao , @sunggg i was able to rectify the issue by returning the property mask for rocm asdso_exportable. I was wondering if it was actually missing in tvm , but as @tqchen mentioned it has been fixed, i will pull the latest. thanks

Thank you @yogeesh . glad it is resolved

1 Like