Making the hal.buffer_view assembly format consistent w/ other HAL ops.
diff --git a/iree/compiler/Bindings/Native/Transforms/test/wrap_entry_points.mlir b/iree/compiler/Bindings/Native/Transforms/test/wrap_entry_points.mlir index bcf4343..9ab791a 100644 --- a/iree/compiler/Bindings/Native/Transforms/test/wrap_entry_points.mlir +++ b/iree/compiler/Bindings/Native/Transforms/test/wrap_entry_points.mlir
@@ -7,9 +7,9 @@ // CHECK-SAME: ) attributes { // CHECK-SAME: iree.abi.stub // CHECK-SAME: } { -// CHECK-NEXT: %[[ARG0_DIM0:.+]] = hal.buffer_view.dim %[[ARG0]], 0 : index +// CHECK-NEXT: %[[ARG0_DIM0:.+]] = hal.buffer_view.dim<%[[ARG0]] : !hal.buffer_view>[0] : index // CHECK-NEXT: %[[ARG0_TENSOR:.+]] = hal.tensor.cast %[[ARG0]] : !hal.buffer_view -> tensor<?x8x8x3xf32>{%[[ARG0_DIM0]]} -// CHECK-NEXT: %[[ARG1_DIM0:.+]] = hal.buffer_view.dim %[[ARG1]], 0 : index +// CHECK-NEXT: %[[ARG1_DIM0:.+]] = hal.buffer_view.dim<%[[ARG1]] : !hal.buffer_view>[0] : index // CHECK-NEXT: %[[ARG1_TENSOR:.+]] = hal.tensor.cast %[[ARG1]] : !hal.buffer_view -> tensor<?x8x8x3xf32>{%[[ARG1_DIM0]]} // CHECK-NEXT: %[[RET_TENSOR:.+]]:2 = call @_dynamicEntry(%[[ARG0_TENSOR]], %[[ARG1_TENSOR]]) // CHECK: %[[RET0_DIM0:.+]] = tensor.dim %[[RET_TENSOR]]#0, %c0{{.*}} : tensor<?x8x8x3xf32>
diff --git a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/global_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/global_ops.mlir index cc107a0..f961fba 100644 --- a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/global_ops.mlir +++ b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/global_ops.mlir
@@ -66,8 +66,8 @@ // Checks that the implicit cast allowing a buffer_view to store into a variable // that maps to a buffer is permitted. // CHECK-LABEL: util.global public mutable @var_with_buffer_view_store -// CHECK: %[[buffer:.*]] = hal.buffer_view.buffer %arg0 : !hal.buffer -// CHECK: util.global.store %[[buffer]], @var_with_buffer_view_store : !hal.buffer +// CHECK: %[[BUFFER:.*]] = hal.buffer_view.buffer<%arg0 : !hal.buffer_view> : !hal.buffer +// CHECK: util.global.store %[[BUFFER]], @var_with_buffer_view_store : !hal.buffer util.global public mutable @var_with_buffer_view_store = dense<0.000000e+00> : tensor<f32> func @fn(%arg0: !hal.buffer_view) { %0 = hal.tensor.cast %arg0 : !hal.buffer_view -> tensor<f32> @@ -79,8 +79,8 @@ // Checks that stores are permitted for variables that do not dominate the // function containing a store. // CHECK-LABEL: func @store_var_out_of_order -// CHECK: %[[buffer:.*]] = hal.buffer_view.buffer %arg0 : !hal.buffer -// CHECK: util.global.store %[[buffer]], @var_out_of_order : !hal.buffer +// CHECK: %[[BUFFER:.*]] = hal.buffer_view.buffer<%arg0 : !hal.buffer_view> : !hal.buffer +// CHECK: util.global.store %[[BUFFER]], @var_out_of_order : !hal.buffer func @store_var_out_of_order(%arg0: !hal.buffer_view) { %0 = hal.tensor.cast %arg0 : !hal.buffer_view -> tensor<f32> util.global.store %0, @var_out_of_order : tensor<f32> @@ -92,9 +92,9 @@ // Checks that the implicit cast allowing a buffer_view to indirect store into // a variable that maps to a buffer is permitted. // CHECK-LABEL: util.global public mutable @var_indirect_with_buffer_view_store -// CHECK: %[[ptr:.*]] = util.global.address @var_indirect_with_buffer_view_store : !util.ptr<!hal.buffer> -// CHECK: %[[buffer:.*]] = hal.buffer_view.buffer %arg0 : !hal.buffer -// CHECK: util.global.store.indirect %[[buffer]], %[[ptr]] : !hal.buffer -> !util.ptr<!hal.buffer> +// CHECK: %[[PTR:.*]] = util.global.address @var_indirect_with_buffer_view_store : !util.ptr<!hal.buffer> +// CHECK: %[[BUFFER:.*]] = hal.buffer_view.buffer<%arg0 : !hal.buffer_view> : !hal.buffer +// CHECK: util.global.store.indirect %[[BUFFER]], %[[PTR]] : !hal.buffer -> !util.ptr<!hal.buffer> util.global public mutable @var_indirect_with_buffer_view_store : tensor<i32> func @fn(%arg0: !hal.buffer_view) { %0 = util.global.address @var_indirect_with_buffer_view_store : !util.ptr<tensor<i32>>
diff --git a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/stream_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/stream_ops.mlir index be08dbe..ccfaf18 100644 --- a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/stream_ops.mlir +++ b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/stream_ops.mlir
@@ -214,7 +214,7 @@ // There is nothing to verify here except that correct IR is generated (if // constants are not handled properly, it will produce illegally ordered IR). func @tensorReshapeWithTiedConstant(%arg0: !hal.buffer_view) -> !hal.buffer_view { - %0 = hal.buffer_view.dim %arg0, 0 : index + %0 = hal.buffer_view.dim<%arg0 : !hal.buffer_view>[0] : index %1 = hal.tensor.cast %arg0 : !hal.buffer_view -> tensor<?xf32>{%0} %2 = flow.ex.stream.fragment(%1) : (tensor<?xf32>{%0}) -> tensor<4xf32> = (%arg1: tensor<?xf32>) -> tensor<4xf32> {
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir index 5fc4a46..1dd1bba 100644 --- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir +++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir
@@ -5,8 +5,10 @@ // CHECK: %c4194304 = vm.const.i32 4194304 : i32 // CHECK-NOT: hal.allocator.compute_size %c1024 = constant 1024 : index + %c1_i32 = constant 1 : i32 %c32_i32 = constant 32 : i32 - %0 = hal.allocator.compute_size<%arg0 : !hal.allocator> shape([%c1024, %c1024]) type(%c32_i32) : index + %0 = hal.allocator.compute_size<%arg0 : !hal.allocator> + shape([%c1024, %c1024]) type(%c32_i32) encoding(%c1_i32) : index return %0 : index }
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/buffer_view_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/buffer_view_ops.mlir index e32cc72..f11b2e8 100644 --- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/buffer_view_ops.mlir +++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/buffer_view_ops.mlir
@@ -6,9 +6,9 @@ // CHECK-DAG: %[[D0:.+]] = vm.call @hal.buffer_view.dim(%[[VIEW]], %zero) // CHECK-DAG: %[[D1:.+]] = vm.call @hal.buffer_view.dim(%[[VIEW]], %c1) // CHECK-DAG: %[[D2:.+]] = vm.call @hal.buffer_view.dim(%[[VIEW]], %c2) - %0 = hal.buffer_view.dim %arg0, 0 : index - %1 = hal.buffer_view.dim %arg0, 1 : index - %2 = hal.buffer_view.dim %arg0, 2 : index + %0 = hal.buffer_view.dim<%arg0 : !hal.buffer_view>[0] : index + %1 = hal.buffer_view.dim<%arg0 : !hal.buffer_view>[1] : index + %2 = hal.buffer_view.dim<%arg0 : !hal.buffer_view>[2] : index // CHECK-NEXT: vm.return %[[D0]], %[[D1]], %[[D2]] return %0, %1, %2 : index, index, index }
diff --git a/iree/compiler/Dialect/HAL/Conversion/IREEToHAL/test/shape_constants.mlir b/iree/compiler/Dialect/HAL/Conversion/IREEToHAL/test/shape_constants.mlir index a043e26..3ba7c69 100644 --- a/iree/compiler/Dialect/HAL/Conversion/IREEToHAL/test/shape_constants.mlir +++ b/iree/compiler/Dialect/HAL/Conversion/IREEToHAL/test/shape_constants.mlir
@@ -7,7 +7,11 @@ // CHECK-SAME: type("HostVisible|DeviceVisible|DeviceLocal") // CHECK-SAME: usage("Constant|Transfer|Mapping|Dispatch") // CHECK-SAME: : !hal.buffer = dense<2> : tensor<2xi32> - // CHECK: %[[VIEW:.+]] = hal.buffer_view.create %[[BUFFER]], element_type = %c16777248_i32, shape = [%c2] : !hal.buffer -> !hal.buffer_view + // CHECK: %[[VIEW:.+]] = hal.buffer_view.create + // CHECK-SAME: buffer(%[[BUFFER]] : !hal.buffer) + // CHECK-SAME: shape([%c2]) + // CHECK-SAME: type(%c16777248_i32) + // CHECK-SAME: encoding(%c1_i32) : !hal.buffer_view // CHECK-NEXT: %[[RET:.+]] = util.do_not_optimize(%[[VIEW]]) : !hal.buffer_view %c = util.dynamic_shape_constant dense<2> : tensor<2xi32> -> tensor<?xi32> return
diff --git a/iree/compiler/Dialect/HAL/Conversion/StandardToHAL/test/structural_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/StandardToHAL/test/structural_ops.mlir index 01665d1..ef6460a 100644 --- a/iree/compiler/Dialect/HAL/Conversion/StandardToHAL/test/structural_ops.mlir +++ b/iree/compiler/Dialect/HAL/Conversion/StandardToHAL/test/structural_ops.mlir
@@ -37,10 +37,10 @@ // CHECK: %[[C1_1:.*]] = constant 1 : index // CHECK: %[[C4:.*]] = constant 4 : index // CHECK: %[[C1_2:.*]] = constant 1 : index - // CHECK: %[[ET:.*]] = constant {{.*}} : i32 + // CHECK: %[[ET:.*]] = constant 50331680 : i32 // CHECK: %[[VIEW:.*]] = hal.buffer_view.create - // CHECK-SAME: element_type = %[[ET]], - // CHECK-SAME: shape = [%[[C3]], %[[C2]], %[[C1_1]], %[[C4]], %[[C1_2]]] + // CHECK-SAME: shape([%[[C3]], %[[C2]], %[[C1_1]], %[[C4]], %[[C1_2]]]) + // CHECK-SAME: type(%[[ET]]) // CHECK: return %[[VIEW]] %2 = hal.tensor.cast %1 : tensor<3x2x1x4x1xf32> -> !hal.buffer_view return %2 : !hal.buffer_view
diff --git a/iree/compiler/Dialect/HAL/IR/HALOps.td b/iree/compiler/Dialect/HAL/IR/HALOps.td index c5290c2..2d87fe6 100644 --- a/iree/compiler/Dialect/HAL/IR/HALOps.td +++ b/iree/compiler/Dialect/HAL/IR/HALOps.td
@@ -614,11 +614,12 @@ ); let assemblyFormat = [{ - $buffer `,` - `shape` `=` `[` $shape `]` `,` - `element_type` `=` $element_type `,` - `encoding_type` `=` $encoding_type - attr-dict `:` type($buffer) `->` type($result) + `buffer` `(` $buffer `:` type($buffer) `)` + `shape` `(` `[` $shape `]` `)` + `type` `(` $element_type `)` + `encoding` `(` $encoding_type `)` + `:` type($result) + attr-dict-with-keyword }]; let skipDefaultBuilders = 1; @@ -654,7 +655,9 @@ ); let assemblyFormat = [{ - $buffer_view attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `:` type($result) + attr-dict-with-keyword }]; let hasCanonicalizer = 1; @@ -679,7 +682,9 @@ ); let assemblyFormat = [{ - $buffer_view attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `:` type($result) + attr-dict-with-keyword }]; let skipDefaultBuilders = 1; @@ -702,7 +707,9 @@ ); let assemblyFormat = [{ - $buffer_view attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `:` type($result) + attr-dict-with-keyword }]; } @@ -720,7 +727,9 @@ ); let assemblyFormat = [{ - $buffer_view attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `:` type($result) + attr-dict-with-keyword }]; } @@ -738,7 +747,9 @@ ); let assemblyFormat = [{ - $buffer_view attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `:` type($result) + attr-dict-with-keyword }]; } @@ -757,7 +768,10 @@ ); let assemblyFormat = [{ - $buffer_view `,` $index attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `` `[` $index `]` + `:` type($result) + attr-dict-with-keyword }]; } @@ -775,7 +789,9 @@ ); let assemblyFormat = [{ - $buffer_view attr-dict `:` type($result) + `<` $buffer_view `:` type($buffer_view) `>` + `:` type($result) + attr-dict-with-keyword }]; let hasCanonicalizer = 1; @@ -795,7 +811,8 @@ ); let assemblyFormat = [{ - attr-dict ($operands^ `:` type($operands))? + $operands `:` type($operands) + attr-dict-with-keyword }]; }
diff --git a/iree/compiler/Dialect/HAL/IR/test/allocator_op_folding.mlir b/iree/compiler/Dialect/HAL/IR/test/allocator_op_folding.mlir index 2df6fb6..7f5cbb5 100644 --- a/iree/compiler/Dialect/HAL/IR/test/allocator_op_folding.mlir +++ b/iree/compiler/Dialect/HAL/IR/test/allocator_op_folding.mlir
@@ -27,7 +27,11 @@ // CHECK-SAME: type("HostVisible|DeviceVisible|DeviceLocal") // CHECK-SAME: usage("Constant|Transfer|Mapping|Dispatch") // CHECK-SAME: : !hal.buffer - // CHECK-NEXT: %[[VIEW:.+]] = hal.buffer_view.create %[[BUFFER]], element_type = %c16777248_i32, shape = [%c4, %c4] : !hal.buffer -> !hal.buffer_view + // CHECK-NEXT: %[[VIEW:.+]] = hal.buffer_view.create + // CHECK-SAME: buffer(%[[BUFFER]] : !hal.buffer) + // CHECK-SAME: shape([%c4, %c4]) + // CHECK-SAME: type(%c16777248_i32) + // CHECK-SAME: encoding(%c1_i32) : !hal.buffer_view %ref = hal.allocator.constant<%allocator : !hal.allocator> type(DeviceLocal) usage(Transfer) : !hal.buffer_view = dense<123> : tensor<4x4xi32>
diff --git a/iree/compiler/Dialect/HAL/IR/test/allocator_ops.mlir b/iree/compiler/Dialect/HAL/IR/test/allocator_ops.mlir index 69d454f..4d6be0f 100644 --- a/iree/compiler/Dialect/HAL/IR/test/allocator_ops.mlir +++ b/iree/compiler/Dialect/HAL/IR/test/allocator_ops.mlir
@@ -8,12 +8,16 @@ %dim1 = constant 200 : index // CHECK-DAG: %[[TYPE:.+]] = constant 32 %type = constant 32 : i32 + // CHECK-DAG: %[[ENCODING:.+]] = constant 1 + %encoding = constant 1 : i32 // CHECK: %[[SIZE:.+]] = hal.allocator.compute_size<%arg0 : !hal.allocator> // CHECK-SAME: shape([%[[DIM0]], %[[DIM1]]]) - // CHECK-SAME: type(%[[TYPE]]) : index + // CHECK-SAME: type(%[[TYPE]]) + // CHECK-SAME: encoding(%[[ENCODING]]) : index %sz = hal.allocator.compute_size<%arg0 : !hal.allocator> shape([%dim0, %dim1]) - type(%type) : index + type(%type) + encoding(%encoding) : index // CHECK-NEXT: return %[[SIZE]] return %sz : index } @@ -32,14 +36,18 @@ %dim1 = constant 200 : index // CHECK-DAG: %[[TYPE:.+]] = constant 32 %type = constant 32 : i32 + // CHECK-DAG: %[[ENCODING:.+]] = constant 1 + %encoding = constant 1 : i32 // CHECK: %[[OFFSET:.+]] = hal.allocator.compute_offset<%arg0 : !hal.allocator> // CHECK-SAME: indices([%[[IDX0]], %[[IDX1]]]) // CHECK-SAME: shape([%[[DIM0]], %[[DIM1]]]) - // CHECK-SAME: type(%[[TYPE]]) : index + // CHECK-SAME: type(%[[TYPE]]) + // CHECK-SAME: encoding(%[[ENCODING]]) : index %off = hal.allocator.compute_offset<%arg0 : !hal.allocator> indices([%idx0, %idx1]) shape([%dim0, %dim1]) - type(%type) : index + type(%type) + encoding(%encoding) : index // CHECK-NEXT: return %[[OFFSET]] return %off : index } @@ -62,16 +70,20 @@ %dim1 = constant 200 : index // CHECK-DAG: %[[TYPE:.+]] = constant 32 %type = constant 32 : i32 + // CHECK-DAG: %[[ENCODING:.+]] = constant 1 + %encoding = constant 1 : i32 // CHECK: = hal.allocator.compute_range<%arg0 : !hal.allocator> // CHECK-SAME: indices([%[[IDX0]], %[[IDX1]]]) // CHECK-SAME: lengths([%[[LEN0]], %[[LEN1]]]) // CHECK-SAME: shape([%[[DIM0]], %[[DIM1]]]) - // CHECK-SAME: type(%[[TYPE]]) : index, index + // CHECK-SAME: type(%[[TYPE]]) + // CHECK-SAME: encoding(%[[ENCODING]]) : index, index %off, %len = hal.allocator.compute_range<%arg0 : !hal.allocator> indices([%idx0, %idx1]) lengths([%len0, %len1]) shape([%dim0, %dim1]) - type(%type) : index, index + type(%type) + encoding(%encoding) : index, index return %off, %len : index, index }
diff --git a/iree/compiler/Dialect/HAL/IR/test/buffer_view_folding.mlir b/iree/compiler/Dialect/HAL/IR/test/buffer_view_folding.mlir index 802b0ae..6348da4 100644 --- a/iree/compiler/Dialect/HAL/IR/test/buffer_view_folding.mlir +++ b/iree/compiler/Dialect/HAL/IR/test/buffer_view_folding.mlir
@@ -1,13 +1,17 @@ -// RUN: iree-opt -allow-unregistered-dialect -split-input-file -canonicalize -cse %s | iree-opt -allow-unregistered-dialect -split-input-file | IreeFileCheck %s +// RUN: iree-opt -split-input-file -canonicalize -cse %s | iree-opt -allow-unregistered-dialect -split-input-file | IreeFileCheck %s // CHECK-LABEL: func @skip_buffer_view_buffer // CHECK-SAME: %[[BUFFER:.+]]: !hal.buffer func @skip_buffer_view_buffer(%buffer : !hal.buffer) -> !hal.buffer { + %c1 = constant 1 : i32 %c10 = constant 10 : index %c11 = constant 11 : index %c32 = constant 32 : i32 - %view = hal.buffer_view.create %buffer, element_type = %c32, shape = [%c10, %c11] : !hal.buffer -> !hal.buffer_view - %view_buffer = hal.buffer_view.buffer %view : !hal.buffer + %view = hal.buffer_view.create buffer(%buffer : !hal.buffer) + shape([%c10, %c11]) + type(%c32) + encoding(%c1) : !hal.buffer_view + %view_buffer = hal.buffer_view.buffer<%view : !hal.buffer_view> : !hal.buffer // CHECK: return %[[BUFFER]] return %view_buffer : !hal.buffer } @@ -16,11 +20,11 @@ // CHECK-LABEL: func @expand_buffer_view_dims // CHECK-SAME: %[[VIEW:.+]]: !hal.buffer_view -func @expand_buffer_view_dims(%arg0 : !hal.buffer_view) -> (index, index, index) { - // CHECK-DAG: %[[D0:.+]] = hal.buffer_view.dim %[[VIEW]], 0 : index - // CHECK-DAG: %[[D1:.+]] = hal.buffer_view.dim %[[VIEW]], 1 : index - // CHECK-DAG: %[[D2:.+]] = hal.buffer_view.dim %[[VIEW]], 2 : index - %0, %1, %2 = hal.buffer_view.dims %arg0 : index, index, index +func @expand_buffer_view_dims(%view : !hal.buffer_view) -> (index, index, index) { + // CHECK-DAG: %[[D0:.+]] = hal.buffer_view.dim<%[[VIEW]] : !hal.buffer_view>[0] : index + // CHECK-DAG: %[[D1:.+]] = hal.buffer_view.dim<%[[VIEW]] : !hal.buffer_view>[1] : index + // CHECK-DAG: %[[D2:.+]] = hal.buffer_view.dim<%[[VIEW]] : !hal.buffer_view>[2] : index + %0, %1, %2 = hal.buffer_view.dims<%view : !hal.buffer_view> : index, index, index // CHECK-NEXT: return %[[D0]], %[[D1]], %[[D2]] return %0, %1, %2 : index, index, index }
diff --git a/iree/compiler/Dialect/HAL/IR/test/buffer_view_ops.mlir b/iree/compiler/Dialect/HAL/IR/test/buffer_view_ops.mlir index d254350..a689425 100644 --- a/iree/compiler/Dialect/HAL/IR/test/buffer_view_ops.mlir +++ b/iree/compiler/Dialect/HAL/IR/test/buffer_view_ops.mlir
@@ -1,11 +1,18 @@ -// RUN: iree-opt -allow-unregistered-dialect -split-input-file %s | iree-opt -allow-unregistered-dialect -split-input-file | IreeFileCheck %s +// RUN: iree-opt -split-input-file %s | iree-opt -allow-unregistered-dialect -split-input-file | IreeFileCheck %s // CHECK-LABEL: @buffer_view_create -func @buffer_view_create(%arg0: !hal.buffer) -> !hal.buffer_view { +func @buffer_view_create(%arg0: !hal.buffer, %arg1: index, %arg2: index) -> !hal.buffer_view { + %c1 = constant 1 : i32 %c32 = constant 32 : i32 - %0:2 = "test_hal.shape"() : () -> (index, index) - // CHECK: %view = hal.buffer_view.create %arg0, element_type = %c32_i32, shape = [%0#0, %0#1] : !hal.buffer -> !hal.buffer_view - %view = hal.buffer_view.create %arg0, element_type = %c32, shape = [%0#0, %0#1] : !hal.buffer -> !hal.buffer_view + // CHECK: %view = hal.buffer_view.create + // CHECK-SAME: buffer(%arg0 : !hal.buffer) + // CHECK-SAME: shape([%arg1, %arg2]) + // CHECK-SAME: type(%c32_i32) + // CHECK-SAME: encoding(%c1_i32) : !hal.buffer_view + %view = hal.buffer_view.create buffer(%arg0 : !hal.buffer) + shape([%arg1, %arg2]) + type(%c32) + encoding(%c1) : !hal.buffer_view return %view : !hal.buffer_view } @@ -13,8 +20,8 @@ // CHECK-LABEL: @buffer_view_buffer func @buffer_view_buffer(%arg0: !hal.buffer_view) -> !hal.buffer { - // CHECK: %buffer = hal.buffer_view.buffer %arg0 : !hal.buffer - %buffer = hal.buffer_view.buffer %arg0 : !hal.buffer + // CHECK: %buffer = hal.buffer_view.buffer<%arg0 : !hal.buffer_view> : !hal.buffer + %buffer = hal.buffer_view.buffer<%arg0 : !hal.buffer_view> : !hal.buffer return %buffer : !hal.buffer } @@ -22,8 +29,8 @@ // CHECK-LABEL: @buffer_view_byte_length func @buffer_view_byte_length(%arg0: !hal.buffer_view) -> index { - // CHECK: %len = hal.buffer_view.byte_length %arg0 : index - %len = hal.buffer_view.byte_length %arg0 : index + // CHECK: %len = hal.buffer_view.byte_length<%arg0 : !hal.buffer_view> : index + %len = hal.buffer_view.byte_length<%arg0 : !hal.buffer_view> : index return %len : index } @@ -31,11 +38,11 @@ // CHECK-LABEL: @buffer_view_shape_queries func @buffer_view_shape_queries(%arg0: !hal.buffer_view) -> (index, index, index, index) { - // CHECK: %{{.+}} = hal.buffer_view.rank %arg0 : index - %0 = hal.buffer_view.rank %arg0 : index - // CHECK: %{{.+}} = hal.buffer_view.dim %arg0, 0 : index - %1 = hal.buffer_view.dim %arg0, 0 : index - // CHECK: %{{.+}}:2 = hal.buffer_view.dims %arg0 : index, index - %2, %3 = hal.buffer_view.dims %arg0 : index, index + // CHECK: %{{.+}} = hal.buffer_view.rank<%arg0 : !hal.buffer_view> : index + %0 = hal.buffer_view.rank<%arg0 : !hal.buffer_view> : index + // CHECK: %{{.+}} = hal.buffer_view.dim<%arg0 : !hal.buffer_view>[0] : index + %1 = hal.buffer_view.dim<%arg0 : !hal.buffer_view>[0] : index + // CHECK: %{{.+}}:2 = hal.buffer_view.dims<%arg0 : !hal.buffer_view> : index, index + %2, %3 = hal.buffer_view.dims<%arg0 : !hal.buffer_view> : index, index return %0, %1, %2, %3 : index, index, index, index }
diff --git a/iree/samples/custom_modules/dialect/test/conversion.mlir b/iree/samples/custom_modules/dialect/test/conversion.mlir index d7bf428..34e5a32 100644 --- a/iree/samples/custom_modules/dialect/test/conversion.mlir +++ b/iree/samples/custom_modules/dialect/test/conversion.mlir
@@ -13,10 +13,11 @@ // CHECK-LABEL: @tensorToMessage func @tensorToMessage(%tensor : tensor<2x4xf32>) { // CHECK-DAG: [[TYPE:%.+]] = vm.const.i32 50331680 : i32 + // CHECK-DAG: [[ENCODING:%.+]] = vm.const.i32 1 : i32 // CHECK-DAG: [[DIM0:%.+]] = vm.const.i32 2 : i32 // CHECK-DAG: [[DIM1:%.+]] = vm.const.i32 4 : i32 // CHECK-NEXT: [[VIEW:%.+]] = vm.call.variadic @hal.buffer_view.create( - // CHECK-SAME: %arg0, [[TYPE]], [ + // CHECK-SAME: %arg0, [[TYPE]], [[ENCODING]], [ // CHECK-SAME: [[DIM0]], [[DIM1]] // CHECK-SAME: ]) // CHECK-NEXT: [[MSG:%.+]] = vm.call @custom.buffer_to_message([[VIEW]]) : (!vm.ref<!hal.buffer_view>) -> !vm.ref<!custom.message> @@ -32,10 +33,9 @@ // CHECK-LABEL: @dynamicTensorToMessage func @dynamicTensorToMessage(%arg0 : tensor<?x?xf32>, %arg1 : index, %arg2 : index) { // CHECK-DAG: [[TYPE:%.+]] = vm.const.i32 50331680 : i32 + // CHECK-DAG: [[ENCODING:%.+]] = vm.const.i32 1 : i32 // CHECK-NEXT: [[VIEW:%.+]] = vm.call.variadic @hal.buffer_view.create( - // CHECK-SAME: %arg0, [[TYPE]], [ - // CHECK-SAME: %arg1, %arg2 - // CHECK-SAME: ]) + // CHECK-SAME: %arg0, [[TYPE]], [[ENCODING]], [%arg1, %arg2]) // CHECK-NEXT: [[MSG:%.+]] = vm.call @custom.buffer_to_message([[VIEW]]) : (!vm.ref<!hal.buffer_view>) -> !vm.ref<!custom.message> %shape = shapex.make_ranked_shape %arg1, %arg2 : (index, index) -> !shapex.ranked_shape<[?, ?]> %shaped_tensor = shapex.tie_shape %arg0, %shape : tensor<?x?xf32>, !shapex.ranked_shape<[?, ?]> @@ -50,9 +50,10 @@ // CHECK-LABEL: @dynamicTensorToMessage2 func @dynamicTensorToMessage2(%arg0 : tensor<?x?xf32>, %arg1: !shapex.ranked_shape<[?, ?]> {iree.reflection = {}}) { - // CHECK-DAG: [[TYPE:%.+]] = vm.const.i32 50331680 : i32 - // CHECK-NEXT: [[VIEW:%.+]] = vm.call.variadic @hal.buffer_view.create(%arg0, [[TYPE]], - // CHECK-SAME: [%arg1, %arg2]) + // CHECK-DAG: [[TYPE:%.+]] = vm.const.i32 50331680 : i32 + // CHECK-DAG: [[ENCODING:%.+]] = vm.const.i32 1 : i32 + // CHECK-NEXT: [[VIEW:%.+]] = vm.call.variadic @hal.buffer_view.create( + // CHECK-SAME: %arg0, [[TYPE]], [[ENCODING]], [%arg1, %arg2]) // CHECK-NEXT: [[MSG:%.+]] = vm.call @custom.buffer_to_message([[VIEW]]) : (!vm.ref<!hal.buffer_view>) -> !vm.ref<!custom.message> %shaped_tensor = shapex.tie_shape %arg0, %arg1 : tensor<?x?xf32>, !shapex.ranked_shape<[?, ?]> %0 = "custom.tensor_to_message"(%shaped_tensor) : (tensor<?x?xf32>) -> !custom.message