tilelang.tools.compile_onlyΒΆ
Compile-only tool: emit inspectable lower() kernel source without a GPU.
Usage:
python3 -I -m tilelang.tools.compile_only --output_file out.s example.py
The default target is c (CPU C). CUDA is optional:
python3 -I -m tilelang.tools.compile_only --target cuda --output_file out.s example.py
Programmatic API:
from tilelang.tools.compile_only import compile_kernel_source
source = compile_kernel_source(func) # default target c
AttributesΒΆ
FunctionsΒΆ
Return whether this wheel can lower CUDA ( |
|
|
Map a CLI/library target string to an explicit lower() target. |
|
Load |
|
Return the first |
|
Lower |
|
CE-shaped CLI (D2): |
Module ContentsΒΆ
- tilelang.tools.compile_only.DEFAULT_TARGET = 'c'ΒΆ
- tilelang.tools.compile_only.cuda_codegen_available()ΒΆ
Return whether this wheel can lower CUDA (
AnnotateDeviceBoundTmaCopies).- Return type:
- tilelang.tools.compile_only.resolve_target(target)ΒΆ
Map a CLI/library target string to an explicit lower() target.
- Parameters:
target (str) β User-facing target.
autois rejected.cudais pinned to sm_80. Option-bearing CUDA strings (cuda -arch=sm_90or JSON) keep their arch.- Returns:
A TVM target string, or a CUDA target dict.
- Return type:
str or dict
- tilelang.tools.compile_only.load_example(path)ΒΆ
Load
example.pyas a module (D2). Do not treat it as a launch script.- Parameters:
path (str)
- Return type:
types.ModuleType
- tilelang.tools.compile_only.discover_prim_func(module)ΒΆ
Return the first
@tilelang.jit/ PrimFunc in module order (D2, ε€ζ³: one piece).- Parameters:
module (types.ModuleType)
- tilelang.tools.compile_only.compile_kernel_source(func, target=DEFAULT_TARGET)ΒΆ
Lower
funcwithenable_device_compile=Falseand returnkernel_source(D1).- Parameters:
func (PrimFunc or IRModule) β Kernel from
JITImpl.get_tir()or a PrimFunc. No tensor args.target (str or dict, optional) β Explicit target. Strings go through
resolve_target(). Defaultc.
- Returns:
Non-empty
CompiledArtifact.kernel_sourcefrom existinglower().- Return type:
str
- tilelang.tools.compile_only.cli_main(argv=None)ΒΆ
CE-shaped CLI (D2):
--output_file+ example.py. Default targetc(D3).- Parameters:
argv (list[str] | None)
- Return type:
int