Repository navigation
Conversation
…ltin cache test_scope_restores_tensor_descriptor_base_builtins fakes inspect.getmembers and tl.core.is_builtin, then takes a snapshot scope. The frontend caches each language object's builtin names on first use, so when this test was the first to snapshot in the process it cached almost no names, and every later patch_lang/unpatch_lang left triton.language's builtins (load, store, atomic_*, arange, ...) patched by the interpreter. Run after it, test_patch_lang_restores_core_reduce_scan_from_tl_kernel and any later host compile then saw the patched language. Give the test an empty cache of its own, restored with the other monkeypatches.
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.
Problem
tests/unit/test_patch_scope.py::test_scope_restores_tensor_descriptor_base_builtinsmonkeypatchesinspect.getmembersandtl.core.is_builtinso that only one fake builtin exists, then takes a frontend snapshot scope. The Triton frontend caches each language object's builtin names on first use (_triton_builtin_attr_cache, keyed by object id). When this test is the first in the process to take a snapshot, the cache is filled from the fake member lists, so it holds almost no names. The monkeypatches are undone afterwards, but the cache is not.From then on, every
patch_lang/unpatch_langin the process saves and restores only those few names, and the interpreter's replacements oftriton.language.corebuiltins (load,store,atomic_*,arange,dot, ...) stay installed. Running onlyleaves about 40
tl.corebuiltins replaced. On the IR-mode stack, every later host compile in that process then fails (13 failures intest_ir_lifecycle_compiled.pywith that ordering). Which tests run first on an xdist worker decides whether it happens, so CI can fail at random.Change
The test also monkeypatches the frontend's cache with an empty dict of its own, so whatever it caches under the fake member lists is discarded with the other monkeypatches. No product code changes.
Tests
tl/tl.core/tl.core.tensorattribute: without the change ~40tl.corebuiltins differ from their originals; with it, none do.tests/end_to_end/test_ir_lifecycle_compiled.py: 13 failed before, 18 passed / 4 skipped after.tests/unit/test_patch_scope.py: 8 passed; withtests/end_to_end/test_core.pyunder-n 4: 19 passed, 1 skipped.