Class TargetTagRegistry#

Class Documentation#

class TargetTagRegistry#

Registry of target configurations keyed by tag name.

Register a tag during static initialization, then resolve it through Target:

TVM_FFI_STATIC_INIT_BLOCK() {
TargetTagRegistry::Global()->AddTag(
"my_cpu", {{"kind", ffi::String("llvm")}}, false);
}

Public Types

using Config = ffi::Map<ffi::String, ffi::Any>#

Public Functions

ffi::Optional<Target> Get(const ffi::String &name) const#

Construct the target registered under a name.

Parameters:

name – The tag name to look up.

Returns:

The constructed target, or nullopt if the name is unknown.

ffi::Optional<Config> GetConfig(const ffi::String &name) const#

Return a tag’s stored configuration without constructing a target.

Parameters:

name – The tag name to look up.

Returns:

The configuration, or nullopt if the name is unknown.

ffi::Map<ffi::String, Target> ListTags() const#

List all registered names and their constructed targets.

Returns:

A map from tag names to targets; empty if no tags are registered.

Target AddTag(ffi::String name, Config config, bool override)#

Register a target configuration under a tag name.

Parameters:
  • name – The tag name to register.

  • config – The target configuration, including its kind.

  • override – Whether to replace an existing registration; otherwise a duplicate is rejected.

Returns:

The target constructed from config.

Public Static Functions

static TargetTagRegistry *Global()#

Return the process-wide registry.