test_failure_48 for wrong truncation in idx on NV (#6055)

also added `RAWAST` to print pre-modified AST in DEBUG=3
This commit is contained in:
chenyu
2024-08-12 16:17:42 -04:00
committed by GitHub
parent 6ed9711898
commit 3f2d24a6ec
2 changed files with 15 additions and 1 deletions

View File

@@ -440,7 +440,7 @@ class TestLinearizerFailures(unittest.TestCase):
helper_test_lin(Kernel(ast), opts=opts, failed_platforms=[])
def test_failure_47(self):
# upcast an arange, failed with UOP_IS_SYMBOLIC=1
# upcast an arange, failed with UOP_IS_SYMBOLIC=1 (fixed!)
ast = LazyOp(MetaOps.KERNEL, arg=None, src=(
LazyOp(BufferOps.STORE, arg=MemBuffer(idx=0, dtype=dtypes.int, st=ShapeTracker(views=(View(shape=(60000, 1), strides=(1, 0), offset=0, mask=None, contiguous=True),))), src=(
LazyOp(BinaryOps.ADD, arg=None, src=(
@@ -450,5 +450,18 @@ class TestLinearizerFailures(unittest.TestCase):
opts = [Opt(op=OptOps.UPCAST, axis=0, amt=3)]
helper_test_lin(Kernel(ast), opts=opts, failed_platforms=[])
@unittest.skipUnless(not CI and Device.DEFAULT in ("NV", "CUDA"), "for real NV")
def test_failure_48(self):
# with UOP_IS_SYMBOLIC=1, generates the wrong IDIV
ast = LazyOp(MetaOps.KERNEL, arg=None, src=(
LazyOp(BufferOps.STORE, arg=MemBuffer(idx=0, dtype=dtypes.float, st=ShapeTracker(views=(View(shape=(1, 1, 64, 1, 1, 256, 1, 1, 256), strides=(0, 0, 65536, 0, 0, 256, 0, 0, 1), offset=0, mask=None, contiguous=True),))), src=(
LazyOp(ReduceOps.SUM, arg=(3, 4), src=(
LazyOp(UnaryOps.CAST, arg=dtypes.float, src=(
LazyOp(BinaryOps.MUL, arg=None, src=(
LazyOp(BufferOps.LOAD, arg=MemBuffer(idx=1, dtype=dtypes.half, st=ShapeTracker(views=(View(shape=(1, 1, 64, 56, 56, 256, 1, 1, 256), strides=(0, 0, 0, 56, 1, 3136, 0, 0, 802816), offset=0, mask=None, contiguous=False),))), src=()),
LazyOp(BufferOps.LOAD, arg=MemBuffer(idx=2, dtype=dtypes.half, st=ShapeTracker(views=(View(shape=(1, 1, 64, 56, 56, 256, 1, 1, 256), strides=(0, 0, 3136, 56, 1, 0, 0, 0, 200704), offset=0, mask=None, contiguous=False),))), src=()),)),)),)),)),))
opts = [Opt(op=OptOps.TC, axis=0, amt=0), Opt(op=OptOps.UPCAST, axis=1, amt=4), Opt(op=OptOps.UPCAST, axis=0, amt=4), Opt(op=OptOps.LOCAL, axis=0, amt=2)]
helper_test_lin(Kernel(ast, opts=Device[Device.DEFAULT].renderer), opts=opts, failed_platforms=[])
if __name__ == '__main__':
unittest.main()

View File

@@ -724,6 +724,7 @@ class Kernel:
if DEBUG >= 3:
print(self.name)
if getenv("RAWAST"): print(self.ast)
print(modified_ast)
print(self.applied_opts)
verify_lazyop(modified_ast)