Skip to content

Commit f169591

Browse files
authored
Revert "Include constexprs in cache keys, fixes #7322 (#7332)" (#7344)
This reverts #7332 as it essentially made the disk cache useless. Any function that calls another function lists it as a global value, and when printed that function includes the pointer to the python object which is not stable across different runs. Thus the cache always misses.
1 parent b3769b2 commit f169591

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

python/test/unit/runtime/test_cache.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -400,23 +400,6 @@ def kernel():
400400
assert not kernel.used_global_vals
401401

402402

403-
def test_constexpr_cache_invalidation_recreated(device):
404-
405-
def test_run(val):
406-
VAL = tl.constexpr(val)
407-
408-
@triton.jit
409-
def kernel(out):
410-
tl.store(out, VAL)
411-
412-
out = torch.zeros(1, device=device)
413-
kernel[(1, )](out)
414-
return out.item()
415-
416-
assert test_run(123) == 123
417-
assert test_run(1234) == 1234
418-
419-
420403
def test_jit_warmup_cache(device) -> None:
421404

422405
@triton.jit

python/triton/runtime/jit.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,6 @@ def cache_key(self):
696696
dependencies_finder.visit(self.parse())
697697
self.hash = dependencies_finder.ret + str(self.starting_line_number)
698698
self.used_global_vals = dict(sorted(dependencies_finder.used_global_vals.items()))
699-
# Include current constexpr values in cache key for proper invalidation
700-
self.hash += str(self.used_global_vals)
701-
self.hash = hashlib.sha256(self.hash.encode("utf-8")).hexdigest()
702699
return self.hash
703700

704701
@property

0 commit comments

Comments
 (0)