From ece4e2758b6f58af89af28e4de30df4b8b7a7880 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Fri, 24 Jan 2025 13:24:25 +0100 Subject: [PATCH] explicitly clear cache Signed-off-by: Anatoly Myachev --- python/test/unit/runtime/test_cache.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/python/test/unit/runtime/test_cache.py b/python/test/unit/runtime/test_cache.py index fe944f7e03..9523a96b38 100644 --- a/python/test/unit/runtime/test_cache.py +++ b/python/test/unit/runtime/test_cache.py @@ -155,12 +155,6 @@ def test_kernel(i): def test_reuse(device, fresh_triton_cache): counter = 0 - @triton.jit - def kernel(X, i, BLOCK: tl.constexpr): - i = i + 1 - i = function_1(i) - tl.store(X, i) - def inc_counter(*args, **kwargs): nonlocal counter counter += 1 @@ -170,6 +164,7 @@ def inc_counter(*args, **kwargs): for i in range(10): kernel[(1, )](x, 1, BLOCK=1024) assert counter == 1 + kernel.device_caches[device][0].clear() @pytest.mark.parametrize('mode', ['enable', 'disable', 'disable_on_alignment']) @@ -187,7 +182,9 @@ def inc_counter(*args, **kwargs): for i in [1, 2, 4, 8, 16, 32]: function[(1, )](x, i, BLOCK=512) assert counter == target - getattr(torch, device).synchronize() + kernel.device_caches[device][0].clear() + kernel_nospec.device_caches[device][0].clear() + kernel_nospec_on_alignment.device_caches[device][0].clear() def test_annotation(device):