From a82a1dbad0e8c72cff2a10ff96222cbb6b72731c Mon Sep 17 00:00:00 2001 From: Tuomas Karna Date: Mon, 12 Aug 2024 17:11:45 +0300 Subject: [PATCH 1/2] add cse,canonicalize before one-shot-bufferize --- src/jit/mlir.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jit/mlir.cpp b/src/jit/mlir.cpp index d84186e..cc3b2a5 100644 --- a/src/jit/mlir.cpp +++ b/src/jit/mlir.cpp @@ -679,6 +679,7 @@ static const std::string cpu_pipeline = "add-comm-cache-keys," "lower-distruntime-to-idtr," "convert-ndarray-to-linalg," + "cse," "canonicalize," "func.func(tosa-to-linalg)," "func.func(tosa-to-tensor)," @@ -688,6 +689,8 @@ static const std::string cpu_pipeline = "arith-expand," "memref-expand," "func.func(empty-tensor-to-alloc-tensor)," + "cse," + "canonicalize," "one-shot-bufferize," "canonicalize," "imex-remove-temporaries," From 87ec64de9a4c7adbfda99d4f9af228b1d35202ed Mon Sep 17 00:00:00 2001 From: Tuomas Karna Date: Mon, 12 Aug 2024 17:12:59 +0300 Subject: [PATCH 2/2] test assign to a view --- test/test_manip.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test_manip.py b/test/test_manip.py index f2e6bcd..94630f2 100644 --- a/test/test_manip.py +++ b/test/test_manip.py @@ -33,6 +33,13 @@ def test_reshape_copy(self): assert numpy.allclose(sp.to_numpy(a), [20, 1, 2, 3, 4, 5, 6, 7]) assert numpy.allclose(sp.to_numpy(b), [[0, 1], [2, 3], [4, 5], [6, 7]]) + def test_view_assign(self): + a = sp.arange(0, 8, 1, sp.int32) + b = a[1:7] + b[0:4] = 22 + assert numpy.allclose(sp.to_numpy(a), [0, 22, 22, 22, 22, 5, 6, 7]) + assert numpy.allclose(sp.to_numpy(b), [22, 22, 22, 22, 5, 6]) + @pytest.mark.skipif(len(device), reason="FIXME 64bit on GPU") def test_astype_f64i32(self): def doit(aapi, **kwargs):