tilelang.cpu.toolchain¶
OpenMP compile-flag helpers for CPU kernels (tl.cpu_parallel).
The kernel shared library must link the same libomp copy the host process
already loaded, otherwise macOS dyld raises OMP: Error #15 (multiple
OpenMP runtimes). Detection order (mirrors torch inductor’s cpp_builder):
OMP_PREFIXenvironment variable (a prefix withinclude/andlib/);an already-imported (or importable) torch’s bundled
libomp.dylib;the conda prefix of the current interpreter;
Homebrew’s
libomp.
On Linux the compiler runtime -fopenmp is used directly. When no runtime
can be found the OpenMP flags are dropped with a warning: unknown pragmas
are ignored by the compiler, so the kernel stays correct, just serial.
Functions¶
|
CPU flags for the selected target, pass configuration, and adapter. |
Compile flags for OpenMP CPU kernels: |
Module Contents¶
- tilelang.cpu.toolchain.get_compile_flags(target, pass_configs, *, execution_backend)¶
CPU flags for the selected target, pass configuration, and adapter.
LLVM uses TVM’s thread pool, so OpenMP flags only apply to the C target. Disabled parallelization leaves the serial compile command unchanged.
- Parameters:
target (tvm.target.Target)
pass_configs (dict[str, Any] | None)
execution_backend (str)
- Return type:
list[str]
- tilelang.cpu.toolchain.get_openmp_compile_flags()¶
Compile flags for OpenMP CPU kernels:
-O2plus OpenMP flags.- Return type:
list[str]