Skip to content

Commit

Permalink
explicitly clear cache
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed Jan 24, 2025
1 parent a11add2 commit ece4e27
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions python/test/unit/runtime/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'])
Expand All @@ -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):
Expand Down

0 comments on commit ece4e27

Please sign in to comment.