Skip to content

Commit 7e7add4

Browse files
committed
Address comments
1 parent f15d21e commit 7e7add4

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ struct VectorInsertOpConvert final
245245
std::optional<int64_t> id =
246246
getConstantIntValue(insertOp.getMixedPosition()[0]);
247247

248-
// rewriter.replaceOpWithNewOp<spirv::CompositeInsertOp>(
249-
// insertOp, adaptor.getSource(), adaptor.getDest(), id);
250-
// return success();
251-
252248
if (id.has_value())
253249
rewriter.replaceOpWithNewOp<spirv::CompositeInsertOp>(
254250
insertOp, adaptor.getSource(), adaptor.getDest(), id.value());

mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@ func.func @extract_size1_vector(%arg0 : vector<1xf32>) -> f32 {
186186

187187
// -----
188188

189+
// CHECK-LABEL: @extract_size1_vector_dynamic
190+
// CHECK-SAME: %[[ARG0:.+]]: vector<1xf32>
191+
// CHECK: %[[R:.+]] = builtin.unrealized_conversion_cast %[[ARG0]]
192+
// CHECK: return %[[R]]
193+
func.func @extract_size1_vector_dynamic(%arg0 : vector<1xf32>, %id : index) -> f32 {
194+
%0 = vector.extract %arg0[%id] : f32 from vector<1xf32>
195+
return %0: f32
196+
}
197+
198+
// -----
199+
189200
// CHECK-LABEL: @extract_dynamic
190201
// CHECK-SAME: %[[V:.*]]: vector<4xf32>, %[[ARG1:.*]]: index
191202
// CHECK: %[[ID:.+]] = builtin.unrealized_conversion_cast %[[ARG1]] : index to i32
@@ -236,6 +247,17 @@ func.func @insert_size1_vector(%arg0 : vector<1xf32>, %arg1: f32) -> vector<1xf3
236247

237248
// -----
238249

250+
// CHECK-LABEL: @insert_size1_vector_dynamic
251+
// CHECK-SAME: %[[V:.*]]: vector<1xf32>, %[[S:.*]]: f32
252+
// CHECK: %[[R:.+]] = builtin.unrealized_conversion_cast %[[S]]
253+
// CHECK: return %[[R]]
254+
func.func @insert_size1_vector_dynamic(%arg0 : vector<1xf32>, %arg1: f32, %id : index) -> vector<1xf32> {
255+
%1 = vector.insert %arg1, %arg0[%id] : f32 into vector<1xf32>
256+
return %1 : vector<1xf32>
257+
}
258+
259+
// -----
260+
239261
// CHECK-LABEL: @insert_dynamic
240262
// CHECK-SAME: %[[VAL:.*]]: f32, %[[V:.*]]: vector<4xf32>, %[[ARG2:.*]]: index
241263
// CHECK: %[[ID:.+]] = builtin.unrealized_conversion_cast %[[ARG2]] : index to i32

0 commit comments

Comments
 (0)