Repository navigation
Fix KS evaluator dropping literal Triton constexpr globals - #194
Merged
Merged
Conversation
Preserve literal-valued Triton constexpr globals, including infinity sentinels and import aliases. Keep arbitrary calls filtered and strict output comparison unchanged.
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.
Problem
The definition loader keeps module-level assignments only when their RHS is a literal. Valid Triton globals such as
LOG2_E = tl.constexpr(1.4426950408889634)andNEG_INF = tl.constexpr(float("-inf"))are silently discarded. Kernels referencing them then fail with undefined-name errors before an effective accuracy comparison.Changes
float(...)sentinels.This remains a narrow definition-loading policy, not a security sandbox: imports, decorators, and class bodies already execute.
Validation
All 6 CPU-only regression tests pass. PyTorch/Triton dependencies are stubbed, while the actual evaluator loader is exercised. Coverage includes constant visibility in a kernel, aliases, annotated assignments, arbitrary constant names, source ordering, rejected arbitrary calls, unrelated constexpr methods, and unchanged strict list/Tensor rejection.
The regression case also reproduces
NameError: name 'LOG2_E' is not definedwith the original upstream filter. Uploaded files were fetched back and verified byte-for-byte against the locally tested files.No accelerator end-to-end benchmark has been run with this generalized patch. This PR does not change submissions or determine competition scores.