CUDA backend configuration#
Set the nested mapping on Target.backend_config and pass that Target to
tvm.compile. Individual kernels can override it with
T.device_entry(..., backend_config=...). Each backend owns its configuration;
CUDA currently provides these fixed keys:
Key |
Type |
Meaning |
|---|---|---|
|
|
One real architecture, such as |
|
|
CUDA frontend; defaults to NVRTC. |
|
|
NVRTC supports PTX and cubin; NVCC also supports fatbin. |
|
|
Native NVCC arguments; defaults to |
|
|
Native NVRTC arguments; defaults to |
|
|
Native assembler arguments forwarded through the selected frontend.
Defaults to |
BackendConfig is a TypedDict for completion and static typing. Its
constructor returns an ordinary dictionary; all keys are optional. Compilation
and entry construction validate and snapshot the supplied mapping. Native
compiler arguments are not modeled as separate Python fields.
from tvm_tirx.backend.cuda import BackendConfig
cuda_config = BackendConfig(
compiler="nvrtc",
nvrtc=["--use_fast_math", "--ftz=false"],
)
target = tvm_tirx.target.Target({
"kind": "cuda", "arch": "sm_100a",
"backend_config": {"cuda": cuda_config},
})
executable = tvm.compile(func, target=target)
- class tvm_tirx.backend.cuda.BackendConfig#
Optional CUDA overrides. Toolchain arguments are passed as individual argv items.
- class tvm_tirx.backend.cuda.compiler.CompilationResult(binary: bytes, target_format: str, config: dict)#
Device artifact and the effective settings used to produce it.
- tvm_tirx.backend.cuda.compiler.compile_source(source: str, backend_config=None, *, target=None) CompilationResult#
Compile source with per-backend overrides and optional Target/tag defaults.
When target is omitted, use the current CUDA Target or detect the device. Compiler logs are reported on failure and are not part of the artifact.
See Compiling and inspecting for target-tag defaults, inheritance, per-entry compilation, and artifact behavior. See Native CUDA compiler arguments for native NVCC/NVRTC/ptxas argument usage and official compiler references.