Repository navigation
Conversation
`ReduceSymbolicExpr` had no `concretize`, so an address built from a reduction of loaded values, such as `idx - tl.max(tl.where(...))` or `tl.argmax(vals, 0)`, raised "Concretize for op max is not implemented" in the sanitizer. It now computes `sum`, `max`, `min`, `argmax`, `argmin`, `xor_sum`, and `reduce_or` with NumPy, in the reduction's result dtype; `max` and `min` ignore NaNs, as Triton's do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Performance Benchmark
Iterations: 1 warmup + 20 measured |
This branch has not been deployed
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
An address built from a reduction of loaded values fails under the sanitizer:
When an address depends on loaded values, the sanitizer concretizes the address's subtree (
replace_subtree), andReduceSymbolicExprhad noconcretize. This PR adds one for all of its ops:sum,max,min,argmax,argmin,xor_sum, andreduce_or, computed with NumPy in the reduction's result dtype.maxandminusefmax/fminon floats, so they ignore NaNs as Triton'smaxnumf/minnumfdo;argmaxandargminreturn the first index, as withtie_break_left=True.Tests
tests/end_to_end/test_sanitizer.py:test_sanitizer_concretizes_reductions_in_addresses, a kernel that loads from offsets given by each of the seven reductions of loaded indices. With a large enough source tensor it expects no report; with smaller ones it expects reports at exactly the offsets whose reduction value is out of bounds. All 3 cases fail on main with the error above.pytest tests/: 366 passed, 6 skipped on main; 369 passed, 6 skipped with this PR (Python 3.12, Triton 3.8.0).ruff checkandruff format --check(v0.1.9) pass on the changed files.🤖 Generated with Claude Code