Test fixup and reordering initializers to be consistent.
diff --git a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertVariableOps.cpp b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertVariableOps.cpp
index 40053dd..195b7a0 100644
--- a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertVariableOps.cpp
+++ b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertVariableOps.cpp
@@ -70,6 +70,7 @@
// an appropriate HAL Buffer-based initializer.
if (auto initialValueElements =
variableOp.initial_valueAttr().dyn_cast_or_null<ElementsAttr>()) {
+ rewriter.setInsertionPointAfter(variableOp);
auto initializerFunc = createInitializerFromImmediate(
variableOp, initialValueElements, rewriter);
initializer = initializerFunc.getName();
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 36533f9..72922dc 100644
--- a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/stream_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/stream_ops.mlir
@@ -26,7 +26,7 @@
// CHECK-NEXT: hal.command_buffer.begin %[[CMD]]
%0 = flow.ex.stream.fragment(%arg1 = %cst : index, %arg2 = %arg0 : tensor<128xf32>) -> tensor<128xf32> {
// CHECK-DAG: %[[EXE_LAYOUT:.+]] = hal.executable_layout.lookup
- // CHECK: hal.command_buffer.push_descriptor_set %[[CMD]], %[[EXE_LAYOUT]], set=0, bindings=[0 = (%arg0, %c0, %sz_3), 1 = (%buffer_1, %c0, %sz_4)]
+ // CHECK: hal.command_buffer.push_descriptor_set %[[CMD]], %[[EXE_LAYOUT]], set=0, bindings=[0 = (%arg0, %c0, %c512), 1 = (%[[TMP_BUF]], %c0, %c512)]
// CHECK: hal.command_buffer.dispatch.symbol {{.+}}, @ex0::@vmla::@entry0, workgroup_xyz
// CHECK: hal.command_buffer.execution_barrier
%1 = flow.dispatch @ex0::@entry0[%arg1 : index](%arg2) : (tensor<128xf32>) -> tensor<128xf32>
@@ -47,7 +47,6 @@
// CHECK-LABEL: @tensorUpdate
// CHECK-SAME: (%[[UBUF:.+]]:{{.+}}, %[[TBUF:.+]]:{{.+}})
func @tensorUpdate(%arg0 : tensor<1x1x10xf32>, %arg1 : tensor<5x1x10xf32>) -> tensor<5x1x10xf32> {
- // CHECK: %[[C0:.+]] = constant 0
%c4 = constant 4 : index
%c1 = constant 1 : index
// CHECK: %[[RET_BUF:.+]] = hal.allocator.allocate
@@ -56,11 +55,9 @@
%0 = flow.ex.stream.fragment(%arg2 = %arg0 : tensor<1x1x10xf32>, %arg3 = %arg1 : tensor<5x1x10xf32>, %arg4 = %c4 : index, %arg5 = %c1 : index) -> tensor<5x1x10xf32> {
// TODO(laurenzo): Update these checks to be more precise. The regexes can
// match too much, masking issues.
- // CHECK: %[[UOFF:.+]], %[[ULEN:.+]] = hal.allocator.compute_range %{{.+}}
- // CHECK: %[[TLEN:.+]] = hal.allocator.compute_size %{{.+}}
- // CHECK-NEXT: hal.command_buffer.copy_buffer %[[CMD]], %[[TBUF]], %[[C0]], %[[RET_BUF]], %[[C0]], %[[TLEN]]
+ // CHECK-NEXT: hal.command_buffer.copy_buffer %[[CMD]], %[[TBUF]], %c0, %[[RET_BUF]], %c0, %c200
// CHECK: hal.command_buffer.execution_barrier
- // CHECK-NEXT: hal.command_buffer.copy_buffer %[[CMD]], %[[UBUF]], %[[C0]], %[[RET_BUF]], %[[UOFF]], %[[ULEN]]
+ // CHECK-NEXT: hal.command_buffer.copy_buffer %[[CMD]], %[[UBUF]], %c0, %[[RET_BUF]], %c204, %c40
%1 = flow.tensor.update %arg2, %arg3[%arg4, %arg5, %arg5] : tensor<1x1x10xf32> -> tensor<5x1x10xf32>
flow.return %1 : tensor<5x1x10xf32>
}
@@ -89,14 +86,13 @@
// CHECK-LABEL: func @dispatchWithShapeTies
// CHECK-SAME: (%[[T:.+]]:{{.+}}, %[[BS:.+]]:{{.+}})
func @dispatchWithShapeTies(%arg0: tensor<?x128xf32>, %bs : index) -> tensor<?x128xf32> {
- // CHECK: %[[C128:.+]] = constant 128
%cst = constant 128 : index
// Verify that size computation derives from the passed dynamic index.
- // CHECK: hal.allocator.compute_size %allocator, shape = [%[[BS]], %[[C128]]], element_type = 50331680
+ // CHECK-DAG: %[[BS4:.+]] = muli %[[BS]], %c4 : index
+ // CHECK-DAG: = muli %[[BS4]], %c128 : index
// Verify that an i32 is pushed.
// CHECK: %[[CAST_BS:.+]] = index_cast %[[BS]] : index to i32
// CHECK: hal.command_buffer.push_constants %[[UNUSED0:.+]], %[[UNUSED1:.+]], offset = 0, values = [%[[CAST_BS]]] : i32
- // CHECK: %[[ALLOCATOR0:.+]] = hal.buffer.allocator %[[T]] : !hal.allocator
// Note that multiple dispatches in the stream verifies that transient
// allocation is covering all ops.
%0 = flow.ex.stream.fragment(%arg1 = %cst : index, %arg2 = %arg0 : tensor<?x128xf32>, %arg3 = %bs : index) -> tensor<?x128xf32> {
diff --git a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/variable_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/variable_ops.mlir
index 5f38d7a..284199c 100644
--- a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/variable_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/test/variable_ops.mlir
@@ -39,10 +39,10 @@
// -----
// Checks that an initializer function is generated, used and operates on
// a hal.buffer (versus tensor).
-// CHECK-LABEL: func @__var_with_tensor_initializer_initializer() -> !hal.buffer
// CHECK: hal.variable @var_with_tensor_initializer
// CHECK-SAME: init(@__var_with_tensor_initializer_initializer)
// CHECK-SAME: : !hal.buffer
+// CHECK-LABEL: func @__var_with_tensor_initializer_initializer() -> !hal.buffer
flow.variable @var_with_tensor_initializer mutable dense<0.000000e+00> : tensor<f32>
func @fn() {
%0 = flow.variable.load @var_with_tensor_initializer : tensor<f32>
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 55cb8d5..2541eb8 100644
--- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/allocator_ops.mlir
@@ -1,9 +1,10 @@
-// RUN: iree-opt -split-input-file -iree-convert-hal-to-vm %s | IreeFileCheck %s
+// RUN: iree-opt -split-input-file -canonicalize -iree-convert-hal-to-vm %s | IreeFileCheck %s
-// CHECK-LABEL: @allocatorComputeSize
-func @allocatorComputeSize(%arg0 : !hal.allocator) -> index {
+// CHECK-LABEL: @allocatorComputeSizeFoldsAway
+func @allocatorComputeSizeFoldsAway(%arg0 : !hal.allocator) -> index {
+ // CHECK: %c4194304 = vm.const.i32 4194304 : i32
+ // CHECK-NOT: hal.allocator.compute_size
%c1024 = constant 1024 : index
- // CHECK: %0 = vm.call.variadic @hal.allocator.compute_size(%arg0, [%c1024, %c1024], %c32) : (!vm.ref<!hal.allocator>, i32 ..., i32) -> i32
%0 = hal.allocator.compute_size %arg0, shape=[%c1024, %c1024], element_type=32
return %0 : index
}
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/variable_ops.mlir b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/variable_ops.mlir
index 5ff3018..acaf1c1 100644
--- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/variable_ops.mlir
+++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/test/variable_ops.mlir
@@ -1,7 +1,7 @@
// RUN: iree-opt -split-input-file -iree-convert-hal-to-vm %s | IreeFileCheck %s
// CHECK: vm.global.i32 @v_initialized_const 4 : i32
-hal.variable @v_initialized_const 4 : i32
+hal.variable @v_initialized_const = 4 : i32
// -----
diff --git a/iree/compiler/Dialect/HAL/IR/HALOps.cpp b/iree/compiler/Dialect/HAL/IR/HALOps.cpp
index 719ce07..fc90e0a 100644
--- a/iree/compiler/Dialect/HAL/IR/HALOps.cpp
+++ b/iree/compiler/Dialect/HAL/IR/HALOps.cpp
@@ -138,24 +138,34 @@
}
}
- if (failed(parser.parseOptionalColon())) {
+ if (failed(parser.parseOptionalAttrDictWithKeyword(result->attributes))) {
+ return failure();
+ }
+
+ Type type;
+ if (succeeded(parser.parseOptionalEqual())) {
+ // @foo = 4 : i32
Attribute initialValueAttr;
if (failed(parser.parseAttribute(initialValueAttr, "initial_value",
result->attributes))) {
return failure();
}
- result->addAttribute("type", TypeAttr::get(initialValueAttr.getType()));
+ type = initialValueAttr.getType();
} else {
- Type type;
- if (failed(parser.parseType(type))) {
+ // @foo : index = 4 : i32
+ if (failed(parser.parseColonType(type)) ||
+ failed(parser.parseOptionalAttrDictWithKeyword(result->attributes))) {
return failure();
}
- result->addAttribute("type", TypeAttr::get(type));
+ if (succeeded(parser.parseOptionalEqual())) {
+ Attribute initialValueAttr;
+ if (failed(parser.parseAttribute(initialValueAttr, "initial_value",
+ result->attributes))) {
+ return failure();
+ }
+ }
}
-
- if (failed(parser.parseOptionalAttrDictWithKeyword(result->attributes))) {
- return failure();
- }
+ result->addAttribute("type", TypeAttr::get(type));
return success();
}
@@ -171,10 +181,11 @@
p.printSymbolName(op.initializer().getValue());
p << ')';
}
- if (op.initial_value().hasValue()) {
- p << ' ';
- p.printAttribute(op.initial_value().getValue());
+ if (op.initial_value().hasValue() &&
+ op.type() == op.initial_value().getValue().getType()) {
+ // @foo = 4 : i32
} else {
+ // @foo : index = 4 : i32
p << " : ";
p.printType(op.type());
}
@@ -185,6 +196,10 @@
"initializer",
"initial_value",
});
+ if (op.initial_value().hasValue()) {
+ p << " = ";
+ p.printAttribute(op.initial_value().getValue());
+ }
}
static LogicalResult verifyVariableOp(VariableOp op) {
@@ -208,14 +223,6 @@
<< " is " << op.type() << " but initializer function "
<< initializerOp.getName() << " is " << initializerOp.getType();
}
- } else if (op.initial_value().hasValue()) {
- // Ensure the value is something we can store in the variable
- if (!isVariableTypeCompatible(op.type(), op.initial_value()->getType())) {
- return op.emitOpError()
- << "initial value type mismatch; variable " << op.sym_name()
- << " is " << op.type() << " but initial value provided is "
- << op.initial_value()->getType();
- }
}
return success();
}
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 54d51dd..2d1d209 100644
--- a/iree/compiler/Dialect/HAL/IR/test/buffer_view_folding.mlir
+++ b/iree/compiler/Dialect/HAL/IR/test/buffer_view_folding.mlir
@@ -1,14 +1,13 @@
-// Tests folding and canonicalization of HAL buffer view ops.
-
// RUN: iree-opt -split-input-file -canonicalize %s | iree-opt -split-input-file | IreeFileCheck %s
// CHECK-LABEL: @expand_buffer_view_const
func @expand_buffer_view_const() -> !hal.buffer_view {
%0 = "test_hal.allocator"() : () -> !hal.allocator
- // CHECK: %[[BUFFER:.+]] = hal.allocator.allocate.const %0, "HostVisible|HostCoherent", "Transfer" : !hal.buffer = dense<[4, 1, 2]> : tensor<3xi32>
- // CHECK-NEXT: %[[VIEW:.+]] = hal.buffer_view.create %[[BUFFER]], shape = [%c3], element_type = 16777248 : !hal.buffer_view
+ // CHECK: [[CONST:%.+]] = iree.byte_buffer.constant : !iree.byte_buffer = dense<[4, 1, 2]> : tensor<3xi32>
+ // CHECK-NEXT: [[BUFFER:%.+]] = hal.allocator.map {{.+}}, "HostVisible|HostCoherent", "Transfer", [[CONST]][%c0, %c-1] : !iree.byte_buffer -> !hal.buffer
+ // CHECK-NEXT: [[VIEW:%.+]] = hal.buffer_view.create [[BUFFER]], shape = [%c3], element_type = 16777248 : !hal.buffer_view
%view = hal.buffer_view.const %0, "HostVisible|HostCoherent", "Transfer" : !hal.buffer_view = dense<[4, 1, 2]> : tensor<3xi32>
- // CHECK-NEXT: return %[[VIEW]]
+ // CHECK-NEXT: return [[VIEW]]
return %view : !hal.buffer_view
}
diff --git a/iree/compiler/Dialect/HAL/IR/test/variable_folding.mlir b/iree/compiler/Dialect/HAL/IR/test/variable_folding.mlir
index 487a7da..887006f 100644
--- a/iree/compiler/Dialect/HAL/IR/test/variable_folding.mlir
+++ b/iree/compiler/Dialect/HAL/IR/test/variable_folding.mlir
@@ -2,7 +2,7 @@
// RUN: iree-opt -split-input-file -canonicalize %s | iree-opt -split-input-file | IreeFileCheck %s
-// CHECK: hal.variable @v_initialized 4 : i32
+// CHECK: hal.variable @v_initialized = 4 : i32
hal.variable @v_initialized init(@initializer) : i32
func @initializer() -> i32 {
%0 = constant 4 : i32
diff --git a/iree/compiler/Dialect/HAL/IR/test/variable_ops.mlir b/iree/compiler/Dialect/HAL/IR/test/variable_ops.mlir
index 46a25e0..2eba9a5 100644
--- a/iree/compiler/Dialect/HAL/IR/test/variable_ops.mlir
+++ b/iree/compiler/Dialect/HAL/IR/test/variable_ops.mlir
@@ -9,8 +9,14 @@
// -----
-// CHECK: hal.variable @v_initialized_const 4 : i32
-hal.variable @v_initialized_const 4 : i32
+// CHECK: hal.variable @v_initialized_const0 = 4 : i32
+hal.variable @v_initialized_const0 = 4 : i32
+
+// CHECK: hal.variable @v_initialized_const1 = 40 : i32
+hal.variable @v_initialized_const1 : i32 = 40 : i32
+
+// CHECK: hal.variable @v_initialized_const2 : i32 = 40 : i64
+hal.variable @v_initialized_const2 : i32 = 40 : i64
// -----
diff --git a/iree/compiler/Dialect/HAL/Target/VMLA/test/i1_types.mlir b/iree/compiler/Dialect/HAL/Target/VMLA/test/i1_types.mlir
index f9be39e..429db63 100644
--- a/iree/compiler/Dialect/HAL/Target/VMLA/test/i1_types.mlir
+++ b/iree/compiler/Dialect/HAL/Target/VMLA/test/i1_types.mlir
@@ -3,7 +3,7 @@
// CHECK-LABEL: @i1_op_usage(%arg0: !hal.buffer) -> !hal.buffer
func @i1_op_usage(%arg0: tensor<4xi1>) -> tensor<4xi1> {
%c4 = constant 4 : index
- // CHECK: hal.allocator.allocate.const {{.+}} dense<[1, 0, 1, 0]> : tensor<4xi8>
+ // CHECK: %0 = iree.byte_buffer.constant : !iree.byte_buffer = dense<[1, 0, 1, 0]> : tensor<4xi8>
%cst = constant dense<[true, false, true, false]> : tensor<4xi1>
%0 = flow.ex.stream.fragment(%arg1 = %c4 : index, %arg2 = %arg0 : tensor<4xi1>, %arg3 = %cst : tensor<4xi1>) -> tensor<4xi1> {
%1 = flow.dispatch @i1_op_usage_ex_dispatch_0::@i1_op_usage_ex_dispatch_0[%arg1 : index](%arg2, %arg3) : (tensor<4xi1>, tensor<4xi1>) -> tensor<4xi1>
diff --git a/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir b/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir
index 939f06a..b4fb233 100644
--- a/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir
+++ b/iree/compiler/Dialect/HAL/Target/VMLA/test/smoketest.mlir
@@ -106,7 +106,7 @@
// CHECK-NEXT: hal.executable.entry_point @reduction_ex_dispatch_0 attributes {interface = @legacy_io_0, ordinal = 0 : i32, signature = (tensor<4x8xf32>) -> tensor<4xf32>}
// CHECK-NEXT: module {
// CHECK-NEXT: vm.module @linked_module {
-// CHECK-NEXT: vm.rodata @reduction_ex_dispatch_0_const_0 dense<0.000000e+00> : tensor<f32>
+// CHECK-NEXT: vm.rodata @reduction_ex_dispatch_0_const dense<0.000000e+00> : tensor<1xf32>
// CHECK-NEXT: vm.func @reduction_ex_dispatch_0(%arg0: !vm.ref<!vmla.interface>, %arg1: i32, %arg2: i32, %arg3: i32) {
// CHECK-NEXT: %zero = vm.const.i32.zero : i32
// CHECK-NEXT: %c128 = vm.const.i32 128 : i32
@@ -114,14 +114,16 @@
// CHECK-NEXT: %c4 = vm.const.i32 4 : i32
// CHECK-NEXT: %c8 = vm.const.i32 8 : i32
// CHECK-NEXT: %c1 = vm.const.i32 1 : i32
-// CHECK-NEXT: %reduction_ex_dispatch_0_const_0 = vm.const.ref.rodata @reduction_ex_dispatch_0_const_0 : !vm.ref<!iree.byte_buffer>
-// CHECK-NEXT: %ref = vm.call @vmla.buffer.const(%reduction_ex_dispatch_0_const_0) : (!vm.ref<!iree.byte_buffer>) -> !vm.ref<!vmla.buffer>
-// CHECK-NEXT: %ref_0 = vm.call @vmla.interface.binding(%arg0, %zero, %zero) : (!vm.ref<!vmla.interface>, i32, i32) -> !vm.ref<!vmla.buffer>
-// CHECK-NEXT: %ref_1 = vm.call @vmla.buffer.view(%ref_0, %zero, %c128) : (!vm.ref<!vmla.buffer>, i32, i32) -> !vm.ref<!vmla.buffer>
-// CHECK-NEXT: %ref_2 = vm.call @vmla.buffer.alloc(%c16) : (i32) -> !vm.ref<!vmla.buffer>
-// CHECK-NEXT: vm.call.variadic @vmla.reduce.sum.f32(%ref_1, [%c4, %c8], %ref, [], %c1, %ref_2, [%c4]) : (!vm.ref<!vmla.buffer>, i32 ..., !vm.ref<!vmla.buffer>, i32 ..., i32, !vm.ref<!vmla.buffer>, i32 ...)
-// CHECK-NEXT: %ref_3 = vm.call @vmla.interface.binding(%arg0, %zero, %c1) : (!vm.ref<!vmla.interface>, i32, i32) -> !vm.ref<!vmla.buffer>
-// CHECK-NEXT: vm.call @vmla.buffer.copy(%ref_2, %zero, %ref_3, %zero, %c16) : (!vm.ref<!vmla.buffer>, i32, !vm.ref<!vmla.buffer>, i32, i32) -> ()
+// CHECK-NEXT: %reduction_ex_dispatch_0_const = vm.const.ref.rodata @reduction_ex_dispatch_0_const : !vm.ref<!iree.byte_buffer>
+// CHECK-NEXT: %ref = vm.call @vmla.buffer.const(%reduction_ex_dispatch_0_const) : (!vm.ref<!iree.byte_buffer>) -> !vm.ref<!vmla.buffer>
+// CHECK-NEXT: %ref_0 = vm.call @vmla.buffer.alloc(%c4) : (i32) -> !vm.ref<!vmla.buffer>
+// CHECK-NEXT: vm.call @vmla.buffer.fill(%ref, %ref_0) : (!vm.ref<!vmla.buffer>, !vm.ref<!vmla.buffer>) -> ()
+// CHECK-NEXT: %ref_1 = vm.call @vmla.interface.binding(%arg0, %zero, %zero) : (!vm.ref<!vmla.interface>, i32, i32) -> !vm.ref<!vmla.buffer>
+// CHECK-NEXT: %ref_2 = vm.call @vmla.buffer.view(%ref_1, %zero, %c128) : (!vm.ref<!vmla.buffer>, i32, i32) -> !vm.ref<!vmla.buffer>
+// CHECK-NEXT: %ref_3 = vm.call @vmla.buffer.alloc(%c16) : (i32) -> !vm.ref<!vmla.buffer>
+// CHECK-NEXT: vm.call.variadic @vmla.reduce.sum.f32(%ref_2, [%c4, %c8], %ref_0, [], %c1, %ref_3, [%c4]) : (!vm.ref<!vmla.buffer>, i32 ..., !vm.ref<!vmla.buffer>, i32 ..., i32, !vm.ref<!vmla.buffer>, i32 ...)
+// CHECK-NEXT: %ref_4 = vm.call @vmla.interface.binding(%arg0, %zero, %c1) : (!vm.ref<!vmla.interface>, i32, i32) -> !vm.ref<!vmla.buffer>
+// CHECK-NEXT: vm.call @vmla.buffer.copy(%ref_3, %zero, %ref_4, %zero, %c16) : (!vm.ref<!vmla.buffer>, i32, !vm.ref<!vmla.buffer>, i32, i32) -> ()
// CHECK-NEXT: vm.return
// CHECK-NEXT: }
// CHECK-NEXT: vm.export @reduction_ex_dispatch_0
@@ -130,4 +132,5 @@
// CHECK-NEXT: vm.import @vmla.buffer.alloc(%byte_length : i32) -> !vm.ref<!vmla.buffer>
// CHECK-NEXT: vm.import @vmla.buffer.view(%src : !vm.ref<!vmla.buffer>, %byte_offset : i32, %byte_length : i32) -> !vm.ref<!vmla.buffer>
// CHECK-NEXT: vm.import @vmla.buffer.copy(%src : !vm.ref<!vmla.buffer>, %src_byte_offset : i32, %dst : !vm.ref<!vmla.buffer>, %dst_byte_offset : i32, %byte_length : i32)
+// CHECK-NEXT: vm.import @vmla.buffer.fill(%value : !vm.ref<!vmla.buffer>, %dst : !vm.ref<!vmla.buffer>)
// CHECK-NEXT: vm.import @vmla.reduce.sum.f32(%src : !vm.ref<!vmla.buffer>, %src_shape : i32 ..., %init : !vm.ref<!vmla.buffer>, %init_shape : i32 ..., %dimension : i32, %dst : !vm.ref<!vmla.buffer>, %dst_shape : i32 ...)
diff --git a/iree/compiler/Dialect/HAL/Transforms/MemoizeDeviceQueries.cpp b/iree/compiler/Dialect/HAL/Transforms/MemoizeDeviceQueries.cpp
index 3e343eb..7a90486 100644
--- a/iree/compiler/Dialect/HAL/Transforms/MemoizeDeviceQueries.cpp
+++ b/iree/compiler/Dialect/HAL/Transforms/MemoizeDeviceQueries.cpp
@@ -75,11 +75,13 @@
moduleBuilder.getFunctionType({}, {moduleBuilder.getI1Type()}));
SymbolTable::setSymbolVisibility(initializerOp,
SymbolTable::Visibility::Private);
+ moduleBuilder.setInsertionPoint(initializerOp);
auto variableOp = moduleBuilder.create<IREE::HAL::VariableOp>(
fusedLoc, variableName,
/*isMutable=*/false, initializerOp);
SymbolTable::setSymbolVisibility(variableOp,
SymbolTable::Visibility::Private);
+ moduleBuilder.setInsertionPointAfter(initializerOp);
auto funcBuilder = OpBuilder::atBlockBegin(initializerOp.addEntryBlock());
auto device =
diff --git a/iree/compiler/Dialect/HAL/Transforms/test/memoize_device_queries.mlir b/iree/compiler/Dialect/HAL/Transforms/test/memoize_device_queries.mlir
index de7f576..a081a4c 100644
--- a/iree/compiler/Dialect/HAL/Transforms/test/memoize_device_queries.mlir
+++ b/iree/compiler/Dialect/HAL/Transforms/test/memoize_device_queries.mlir
@@ -1,15 +1,15 @@
// RUN: iree-opt -split-input-file -iree-hal-memoize-device-queries %s | IreeFileCheck %s
+// CHECK: hal.variable @_device_match_id_0 init(@_device_match_id_0_initializer) : i1
// CHECK: func @_device_match_id_0_initializer() -> i1
// CHECK-NEXT: %[[DEVICE:.+]] = hal.ex.shared_device : !hal.device
// CHECK-NEXT: %[[IS_MATCH:.+]] = hal.device.match.id %[[DEVICE]], pattern = ["vulkan-v1.?-*"] : (!hal.device) -> i1
// CHECK-NEXT: return %[[IS_MATCH]] : i1
-// CHECK: hal.variable @_device_match_id_0 init(@_device_match_id_0_initializer) : i1
// CHECK: hal.variable @_device_match_id_1
// CHECK: hal.variable @_device_match_id_2
-// CHECK-LABEL: @device_matchers
+// CHECK-LABEL: func @device_matchers
func @device_matchers(%device : !hal.device) {
// CHECK-NEXT: = hal.variable.load @_device_match_id_0 : i1
%0 = hal.device.match.id %device, pattern = ["vulkan-v1.?-*"] : (!hal.device) -> i1
diff --git a/iree/compiler/Dialect/VM/Conversion/TypeConverter.cpp b/iree/compiler/Dialect/VM/Conversion/TypeConverter.cpp
index 2edcf88..a36fe2a 100644
--- a/iree/compiler/Dialect/VM/Conversion/TypeConverter.cpp
+++ b/iree/compiler/Dialect/VM/Conversion/TypeConverter.cpp
@@ -77,6 +77,12 @@
return IntegerType::get(targetOptions_.indexBits, indexType.getContext());
});
+ // Vectors are used for arbitrary byte storage.
+ addConversion([](VectorType vectorType) -> Optional<Type> {
+ return IREE::VM::RefType::get(
+ IREE::ByteBufferType::get(vectorType.getContext()));
+ });
+
// Convert ranked shape types (expanding all dims).
addConversion([this](Shape::RankedShapeType rankedShape,
SmallVectorImpl<Type> &results) {
diff --git a/iree/compiler/Translation/test/do_not_optimize.mlir b/iree/compiler/Translation/test/do_not_optimize.mlir
index 4a5d367..00becd0 100644
--- a/iree/compiler/Translation/test/do_not_optimize.mlir
+++ b/iree/compiler/Translation/test/do_not_optimize.mlir
@@ -45,7 +45,7 @@
// -----
-// CHECK-LABEL: vm.rodata @dynamic_constant_const_0 dense<3.000000e+00> : tensor<2x3xf32>
+// CHECK-LABEL: vm.rodata @dynamic_constant_const dense<3.000000e+00> : tensor<2x3xf32>
// CHECK: vm.func @dynamic_constant
func @dynamic_constant() -> tensor<?x?xf32> {
// CHECK: vm.call @hal.buffer_view.dim