Imported source
- Upstream repo:
https://github.com/triton-lang/Triton-to-Tile-IR - Upstream commit:
a3befd959b02410cfbdac08d91d817b0ec0b3e33 - Synced path:
third_party/tileir
Pinned dependencies
- cuda-tile submodule path:
third_party/tileir/third_party/cuda-tile - cuda-tile commit:
2e5ccba66fb3afdba34b26cf358418283027c248 - cuda-tile reference:
v13.3.0 - tileiras version used for validation: CUDA 13.3,
V13.3.36
When FLAGTREE_BACKEND is not set, FlagTree builds the default in-tree backend
set, including nvidia, amd, and tileir.
Setting FLAGTREE_BACKEND=tileir selects TileIR explicitly while retaining the
NVIDIA and AMD backends required for per-kernel fallback.
TileIR requires CUDA TileIR tooling from CTK 13.3. The validated toolchain is:
tileirasfrom CUDA 13.3, versionV13.3.36- GCC or Clang 13 or newer
- the cuda-tile submodule at the pinned commit above
The TileIR path uses tileiras. Native NVIDIA fallback and comparison runs use
FlagTree's normal NVIDIA assemblers, managed by setup.py at:
third_party/nvidia/backend/bin/ptxasthird_party/nvidia/backend/bin/ptxas-blackwell
pip install and pip install -e initialize the pinned cuda-tile submodule
automatically through setup.py; no manual submodule command is needed.
At runtime, TileIR looks for tileiras in this order:
$TRITON_TILEIRAS_PATH/tileirastriton/backends/nvidia/bin/tileirasin the installationtileirasonPATH
Default FlagTree source install:
MAX_JOBS=32 python3 -m pip install . --no-build-isolationFor local editable development, the usual editable install also works when the build dependencies are already present:
MAX_JOBS=32 python3 -m pip install -e . --no-build-isolationBackend discovery
A normal installation registers the selected backends through the
triton.backends entry-point group. No discovery environment variable is
required.
The existing FlagTree option below bypasses entry points and scans the installed
triton/backends/ directory instead:
TRITON_BACKENDS_IN_TREE=1This option only changes where Triton discovers already-present backends. It does not build, install, enable, or route TileIR and is normally unnecessary.
Runtime routing
Routing is disabled by default. FLAGTREE_USE_TILEIR=1 enables per-kernel
selection; it does not force every NVIDIA-targeted Triton kernel onto TileIR:
FLAGTREE_USE_TILEIR=1On NVIDIA hardware, the initial Triton target is labeled cuda. The routing
result is:
non-`cuda` Triton target -> unchanged
`cuda` target, Triton kernel uses no TLE -> TileIR
`cuda` target, supported top-level `tle` subset only -> TileIR
`cuda` target, other or unknown TLE usage -> native NVIDIA
For routing diagnostics:
FLAGTREE_TILEIR_VERBOSE=1See the TileIR tutorials for functional checks and benchmark commands.
The two paths use these names:
| Path | Backend name | Target label | Compiler | Kernel driver |
|---|---|---|---|---|
| Native NVIDIA | nvidia |
cuda |
CUDABackend |
CudaDriver |
| TileIR | tileir |
tileir |
TileIRBackend |
TileIRDriver |
CudaDriver provides the initial cuda target. Routing either keeps it or
changes it to tileir; the final target selects the compiler and kernel driver
shown above.
FlagTree compatibility
- Target FlagTree/Triton base:
main/ Triton 3.6.0 - FlagTree's pinned LLVM is older than the LLVM expected by cuda-tile v13.3.0.
scripts/patch_bytecode_utils.shis a FlagTree-local compatibility patch for that LLVM skew. It rewrites cuda-tile source before build, including:DenseTypedElementsAttrtoDenseIntOrFPElementsAttrllvm::scope_exittollvm::make_scope_exitDenseElementsAttr::isValidRawBuffer2-argument calls to the 3-argument API
FlagTree-local changes
Compared with the imported upstream commit, FlagTree modifies 9 files and adds 4 entries:
- Build and provenance: Modified
README.md,CMakeLists.txt, andscripts/patch_bytecode_utils.shto record the vendor base, build the pinned cuda-tile source, and support FlagTree's LLVM. Added thethird_party/cuda-tilesubmodule. - Routing and compiler integration: Modified
backend/compiler.pyfor backend hooks and lazytileiraslookup. Addedbackend/router.pyto choose TileIR or native NVIDIA per kernel. - TLE frontend: Added
backend/extend_core.pyandbackend/extend_semantic.py;CudaTileSemanticextendsTritonSemanticwith the view/token operations exposed astle.<name>throughtl.ext. Modifiedbackend/code_generator.pyto use it for TileIR kernels andtriton_tileir.ccto expose the corresponding C++ builder methods. - Lowering: Modified
lib/TritonToTileIR/TritonToTileIRPass.cppto addmath.erflowering and align flattened TensorDescriptor arguments with FlagTree's ABI. - Release builds: Modified
lib/TritonToTileIR/Utils.cppso its unsupported reduction-type path remains unreachable whenNDEBUGremoves assertions. - Runtime: Upstream activates
TileIRDriverglobally withENABLE_TILE=1and creates it during import. Modifiedbackend/driver.pyso it is not a global active driver and is created only for a kernel routed to TileIR. The file also adapts binary loading and TensorDescriptor arguments to FlagTree's runtime ABI.
TileIR-specific routing and frontend behavior must remain in this vendor
directory. Changes under python/triton are limited to backend-neutral hooks so
that non-TileIR backends do not import or depend on TileIR implementation code.
Update checklist
- Sync
third_party/tileirfrom the chosen Triton-to-Tile-IR commit. - Keep
third_party/tileir/third_party/cuda-tileas an explicit submodule pin. - Reapply or verify the FlagTree-local changes above.
- Recheck the LLVM compatibility patch in
scripts/patch_bytecode_utils.sh. - Run TileIR routing, TLE/TKO, and tutorial validation before updating this file.