Skip to content

Commit 7778563

Browse files
committed
add vector test
1 parent e556cbf commit 7778563

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/test_vector.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@
4242
from mlir.extras.runtime.refbackend import LLVMJITBackend
4343

4444
# noinspection PyUnresolvedReferences
45-
from mlir.extras.testing import MLIRContext, filecheck, mlir_ctx as ctx
45+
from mlir.extras.testing import (
46+
MLIRContext,
47+
filecheck,
48+
mlir_ctx as ctx,
49+
filecheck_with_comments,
50+
)
4651
from mlir.extras.util import find_ops
4752

4853
# needed since the fix isn't defined here nor conftest.py
@@ -453,3 +458,15 @@ def result(a, x, b):
453458

454459
assert np.allclose(B, [21, 39, 73, 24, 20, 36, 37, 29])
455460
assert np.allclose(B, A.T @ X)
461+
462+
463+
def test_vector_load(ctx: MLIRContext):
464+
vcf32 = T.vector(5, T.i32())
465+
# CHECK: %alloc = memref.alloc() : memref<10x10xi32>
466+
mem = memref.alloc((10, 10), T.i32())
467+
# CHECK: %c2 = arith.constant 2 : index
468+
# CHECK: %c0 = arith.constant 0 : index
469+
# CHECK: %{{.*}} = vector.load %alloc[%c2, %c0] : memref<10x10xi32>, vector<5xi32>
470+
mem @ load(vcf32) @ [2, 0]
471+
472+
filecheck_with_comments(ctx.module)

0 commit comments

Comments
 (0)