@@ -209,13 +209,24 @@ def test_memref_dealloc():
209209def test_memref_dim ():
210210 idx = arith .ConstantOp .from_int_and_width (1 , IndexType ())
211211 alloc0 = AllocOp .get (i32 , 64 , [3 , 1 , 2 ])
212- dim_1 = memref .DimOp . from_source_and_index (alloc0 , idx )
212+ dim_1 = memref .DimOp (alloc0 , idx )
213213
214214 assert dim_1 .source is alloc0 .memref
215215 assert dim_1 .index is idx .result
216216 assert isinstance (dim_1 .result .type , IndexType )
217217
218218
219+ def test_memref_dim_from_source_and_index_is_deprecated ():
220+ idx = arith .ConstantOp .from_int_and_width (1 , IndexType ())
221+ alloc0 = AllocOp .get (i32 , 64 , [3 , 1 , 2 ])
222+
223+ with pytest .deprecated_call ():
224+ dim_1 = memref .DimOp .from_source_and_index (alloc0 , idx ) # pyright: ignore[reportDeprecated]
225+
226+ assert dim_1 .source is alloc0 .memref
227+ assert dim_1 .index is idx .result
228+
229+
219230def test_memref_rank ():
220231 alloc0 = AllocOp .get (i32 , 64 , [3 , 1 , 2 ])
221232 dim_1 = memref .RankOp .from_memref (alloc0 )
@@ -244,10 +255,10 @@ def matmul(args: tuple[BlockArgument, ...]) -> None:
244255
245256 lit0 = arith .ConstantOp .from_int_and_width (0 , builtin .IndexType ())
246257 lit1 = arith .ConstantOp .from_int_and_width (1 , builtin .IndexType ())
247- dim_a0 = memref .DimOp . from_source_and_index (a , lit0 )
248- dim_a1 = memref .DimOp . from_source_and_index (a , lit1 )
249- dim_b0 = memref .DimOp . from_source_and_index (b , lit0 )
250- dim_b1 = memref .DimOp . from_source_and_index (b , lit1 )
258+ dim_a0 = memref .DimOp (a , lit0 )
259+ dim_a1 = memref .DimOp (a , lit1 )
260+ dim_b0 = memref .DimOp (b , lit0 )
261+ dim_b1 = memref .DimOp (b , lit1 )
251262 out = memref .AllocaOp .get (
252263 builtin .f64 , None , [DYNAMIC_INDEX ] * 2 , [dim_a0 , dim_b1 ]
253264 )
0 commit comments