diff --git a/test/null/test_uops.py b/test/null/test_uops.py index 949f8e9790..55dc67c723 100644 --- a/test/null/test_uops.py +++ b/test/null/test_uops.py @@ -201,6 +201,7 @@ class TestFastIdiv(unittest.TestCase): self.assertNotIn(Ops.CDIV, ops, f"For dtype={dt} FLOORDIV by power of two did not simplify to shift") self.assertNotIn(Ops.FLOORDIV, ops, f"For dtype={dt} FLOORDIV survived past late rewrite") + @Context(DISABLE_FAST_IDIV=0) @unittest.skipIf(Device.DEFAULT == "WEBGPU", "WEBGPU doesn't support long") def test_fast_idiv_and_mod(self): g = UOp(Ops.PARAM, dtypes.uint32.ptr(), (), 0) @@ -220,6 +221,7 @@ class TestFastIdiv(unittest.TestCase): self.assertIn(Ops.SHR, ops) self.assertNotIn(Ops.CMOD, ops) + @Context(DISABLE_FAST_IDIV=0) def test_fast_idiv_remove_powers_of_two(self): ridx = UOp.range(2**20, 0) uops = to_uops_list([ridx//(7*64)], ren=Device[Device.DEFAULT].renderer) diff --git a/tinygrad/helpers.py b/tinygrad/helpers.py index d418e93d6c..db2e462d71 100644 --- a/tinygrad/helpers.py +++ b/tinygrad/helpers.py @@ -240,7 +240,9 @@ TRANSCENDENTAL, NOLOCALS = ContextVar("TRANSCENDENTAL", 1), ContextVar("NOLOCALS SPLIT_REDUCEOP, NO_MEMORY_PLANNER, LRU = ContextVar("SPLIT_REDUCEOP", 1), ContextVar("NO_MEMORY_PLANNER", 0), ContextVar("LRU", 1) RING, ALL2ALL, ALLREDUCE_CAST = ContextVar("RING", 1), ContextVar("ALL2ALL", 0), ContextVar("ALLREDUCE_CAST", 1) CACHELEVEL, IGNORE_BEAM_CACHE, DEVECTORIZE = ContextVar("CACHELEVEL", 2), ContextVar("IGNORE_BEAM_CACHE", 0), ContextVar("DEVECTORIZE", 1) -VALIDATE_WITH_CPU, DISABLE_FAST_IDIV = ContextVar("VALIDATE_WITH_CPU", 0), ContextVar("DISABLE_FAST_IDIV", 0) +VALIDATE_WITH_CPU = ContextVar("VALIDATE_WITH_CPU", 0) +# TODO: this is broken for some indexing +DISABLE_FAST_IDIV = ContextVar("DISABLE_FAST_IDIV", 1) FUSE_OPTIM = ContextVar("FUSE_OPTIM", 0) ALLOW_DEVICE_USAGE, MAX_BUFFER_SIZE = ContextVar("ALLOW_DEVICE_USAGE", 1), ContextVar("MAX_BUFFER_SIZE", 0) MAX_KERNEL_BUFFERS = ContextVar("MAX_KERNEL_BUFFERS", 0)