tvm.support

Support infra of TVM.

Functions:

get_global_func()

Get a global function by name.

detect_active_modules()

Detect device-runtime modules linked into the current libtvm by querying the FFI global function registry for ffi.Module.create.<kind> registrations.

describe()

Print out information about TVM and the current Python environment

tvm.support.get_global_func(name: str, allow_missing: bool = False) Function | None

Get a global function by name.

Parameters:
  • name – The name of the global function

  • allow_missing – Whether allow missing function or raise an error.

Returns:

The function to be returned, None if function is missing.

Return type:

func

Examples

import tvm_ffi

@tvm_ffi.register_global_func("demo.echo")
def echo(x):
    return x


f = tvm_ffi.get_global_func("demo.echo")
assert f(123) == 123

See also

tvm_ffi.register_global_func()

tvm.support.detect_active_modules() dict

Detect device-runtime modules linked into the current libtvm by querying the FFI global function registry for ffi.Module.create.<kind> registrations.

Probes a minimal set of key device runtimes (cuda, vulkan, opencl); expand the list when a new caller needs it.

Returns:

active – Mapping from runtime kind to whether it is registered in this build.

Return type:

dict[str, bool]

tvm.support.describe()

Print out information about TVM and the current Python environment