Conversation
Triton 3.6 implements tensor.__index__ as int(handle.data), which reaches SymbolicExprDataWrapper.__int__. That method evaluated the expression to Z3, where a loop index or program id is a free variable, so indexing a pointer tuple with a static_range loop variable raised "cannot coerce ArithRef to int". Newer Triton calls handle.data.squeeze() instead, which already concretizes to the current value. Make __int__ concretize the same way so both Triton versions behave alike, and add a version-independent unit test for int() on a loop index.
Performance Benchmark
Threshold: >5% regression flagged with |
Collaborator
Author
|
Closed due to deprecation of triton 3.6. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Triton 3.6, the sanitizer crashes when a kernel indexes a pointer tuple with a
tl.static_rangeloop variable (peer_ptrs[i]). The crash message is:This makes
tests/end_to_end/test_sanitizer.py::test_tuple_pointer_item_selection_uses_registered_tuple_rangesfail on Triton 3.6. CI only tests the latest Triton pre-release, so it never showed up there.pyproject.tomlstill declarestriton>=3.6.0.Cause: Triton 3.6 implements
tensor.__index__asint(self.handle.data), which callsSymbolicExprDataWrapper.__int__. That method converted the expression to Z3, where a loop index or program id is a free variable rather than a number. Newer Triton releases useint(self.handle.data.squeeze())instead. That path goes through_scalar_data(), which returns the current value.Fix:
__int__now returns the current value through_scalar_data(), likesqueeze()and__bool__already do. Both Triton versions now take the same path. In the interpreter, only Triton 3.6's__index__callsint()on the handle data.Test Plan
tests/unit/test_symbolic_client.py::test_loop_index_int_is_the_current_iterationchecks thatint()on a loop index gives the current iteration. It does not depend on the Triton version. It fails before this change and passes after it.uv run pytest tests/→ 365 passed, 6 skipped.uv pip install --target <dir> --no-deps triton==3.6.0, run withPYTHONPATH=<dir> uv run --no-sync pytest ...):tests/unit/test_sanitizer.py,tests/end_to_end/test_sanitizer.py,tests/unit/test_symbolic_client.py: 140 passed. Without the fix, the tuple test and the new unit test fail.tests/: the only failures are the existing Gluon ones described below. They also fail without this change.Related Issues
Two other sanitizer tests,
test_gemm_oob_call_stackandtest_cli_code_context_points_to_kernel, also failed locally alongside this one. They are not code bugs. The venv used had a stale pre-renametriton-vizinstall, so their subprocesses could not importtilelensor findtile-sanitizer. Both pass in a correctly installed env on Triton 3.6 and 3.8.Not addressed here: on Triton 3.6 the Gluon frontend fails to import (
cannot import name 'cluster' from 'triton.experimental.gluon.language.amd.gfx1250'). As a resulttests/end_to_end/test_gluon.pycannot be collected and 6 Gluon tests fail. That is a separate issue.Breaking Changes
None.
int()on a symbolic scalar now returns its current value where it used to raise on free Z3 variables. For expressions that reduce to a constant, the result is the same.Checklist
npm run build:frontendif the PR modified any TypeScript code.