tilelang.cpu.toolchain ====================== .. py:module:: tilelang.cpu.toolchain .. autoapi-nested-parse:: 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): 1. ``OMP_PREFIX`` environment variable (a prefix with ``include/`` and ``lib/``); 2. an already-imported (or importable) torch's bundled ``libomp.dylib``; 3. the conda prefix of the current interpreter; 4. 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 --------- .. autoapisummary:: tilelang.cpu.toolchain.get_compile_flags tilelang.cpu.toolchain.get_openmp_compile_flags Module Contents --------------- .. py:function:: 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. .. py:function:: get_openmp_compile_flags() Compile flags for OpenMP CPU kernels: ``-O2`` plus OpenMP flags.