From 86352988d8f5a03ded93449e603d24f5e94de423 Mon Sep 17 00:00:00 2001 From: chenyu Date: Thu, 12 Feb 2026 12:26:13 -0500 Subject: [PATCH] update test_uops_stats for setitem (#14710) realize both full tensor and the slice should not add to global_mem --- test/null/test_uops_stats.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/null/test_uops_stats.py b/test/null/test_uops_stats.py index a9bf4459ef..f6580d8510 100644 --- a/test/null/test_uops_stats.py +++ b/test/null/test_uops_stats.py @@ -72,6 +72,7 @@ class TestMemoryCount(unittest.TestCase): t = Tensor.empty(100, dtype=dtypes.int).realize() GlobalCounters.reset() t[20:50] = 3 + t.realize() self.assertEqual(GlobalCounters.global_mem, 30*4) # 30 elements written def test_setitem_slice_tensor(self): @@ -79,12 +80,14 @@ class TestMemoryCount(unittest.TestCase): v = Tensor.empty(30, dtype=dtypes.int).realize() GlobalCounters.reset() t[20:50] = v + t.realize() self.assertEqual(GlobalCounters.global_mem, 30*4*2) # 30 read + 30 written def test_setitem_full(self): t = Tensor.empty(100, dtype=dtypes.int).realize() GlobalCounters.reset() t[:] = 3 + t.realize() self.assertEqual(GlobalCounters.global_mem, 100*4) # full buffer written @unittest.skipIf(Device.DEFAULT == "CPU", "test copy to CPU from other device")