tvm
Loading...
Searching...
No Matches
Variables
tvm::attr Namespace Reference

Generic attribute names that can be attached to any function. More...

Variables

constexpr ffi::reflection::AttrKey< bool > kDeclaration {"declaration"}
 Whether this function is a declaration.
 
constexpr ffi::reflection::AttrKey< CallingConv > kCallingConv {"calling_conv"}
 Indicates the special calling convention.
 
constexpr ffi::reflection::AttrKey< Target > kTarget {"target"}
 Compilation target of the function.
 
constexpr ffi::reflection::AttrKey< ffi::String > kGlobalSymbol {"global_symbol"}
 Global linker symbol of the function in generated code.
 
constexpr ffi::reflection::AttrKey< ffi::String > kScriptNamespace {"script.namespace"}
 Script namespace used to select construction, printing, and dialect lowering. Absent metadata selects the function kind's default namespace.
 
constexpr ffi::reflection::AttrKey< ffi::Array< ffi::Module > > kExternalMods {"external_mods"}
 All the runtime::Modules accumulated during compilation by external codegen. These modules must be either directly linked or captured in the final compilation artifact.
 
constexpr ffi::reflection::AttrKey< ffi::String > kSystemLibPrefix {"system_lib_prefix"}
 A prefix for generating C symbols system lib creation.
 

Detailed Description

Generic attribute names that can be attached to any function.

See also
tvm::tirx::attr

Variable Documentation

◆ kCallingConv

constexpr ffi::reflection::AttrKey<CallingConv> tvm::attr::kCallingConv {"calling_conv"}
inlineconstexpr

Indicates the special calling convention.

Type: IntImm

See also
tvm::CallingConv

◆ kDeclaration

constexpr ffi::reflection::AttrKey<bool> tvm::attr::kDeclaration {"declaration"}
inlineconstexpr

Whether this function is a declaration.

Type: bool

◆ kExternalMods

constexpr ffi::reflection::AttrKey<ffi::Array<ffi::Module> > tvm::attr::kExternalMods {"external_mods"}
inlineconstexpr

All the runtime::Modules accumulated during compilation by external codegen. These modules must be either directly linked or captured in the final compilation artifact.

Type: ffi::Array<runtime::Module>

◆ kGlobalSymbol

constexpr ffi::reflection::AttrKey<ffi::String> tvm::attr::kGlobalSymbol {"global_symbol"}
inlineconstexpr

Global linker symbol of the function in generated code.

This option forces the code generator to name the function with the given.

For example, we could set a global_symbol of a function early to make sure that we can always refer to it by the symbol name in the generated DLL.

We should not set the attribute for local functions, so that the compiler can freely rename them.

A unique global symbol will be automatically assigned to each function in the module before the target code generation phase.

Type: String

◆ kScriptNamespace

constexpr ffi::reflection::AttrKey<ffi::String> tvm::attr::kScriptNamespace {"script.namespace"}
inlineconstexpr

Script namespace used to select construction, printing, and dialect lowering. Absent metadata selects the function kind's default namespace.

Type: String

◆ kSystemLibPrefix

constexpr ffi::reflection::AttrKey<ffi::String> tvm::attr::kSystemLibPrefix {"system_lib_prefix"}
inlineconstexpr

A prefix for generating C symbols system lib creation.

This prefix guides passes that creates global_symbol for internal functions that may have c linkage (e.g. TIR functions and some BYOC functions). It also affects the symbol of the fat bin blob during module export.

This attribute is used to avoid symbol conflict when we generate and combine multiple system libs that get linked into one.

Rationale: mechanisms like BYOC rely on the common global symbol and each external compiler also has its own mechanism of mangling. As a result, we cannot rely on other mechanisms on setting a global_symbol and then renaming, because the external compiler already agreed on the name.

system_lib_prefix provides a way to hint at the passes to allow names to avoid name conflict at the beginning.

Note that users can still directly specify global symbols that may conflict. It is up to the downstream toolchain to manage those external-facing functions.

This does not affect non-C linkage functions it is less of an issue because they will be embedded into fatbin that in different symbols, The system lib loader can pick the right prefix for a given prefix.

Having this attribute implies system lib generation linkage.

◆ kTarget

constexpr ffi::reflection::AttrKey<Target> tvm::attr::kTarget {"target"}
inlineconstexpr

Compilation target of the function.

Type: Target

See also
tvm::Target