mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[MLIR] Fix 0-dimensional case of conversion of vector ops to GPU (#128075)
This is a follow-up to #127844. That PR got vectors of arbitrary rank working, but I hadn't thought about the rank-0 case. Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
This commit is contained in:
@@ -624,7 +624,8 @@ LogicalResult impl::scalarizeVectorOp(Operation *op, ValueRange operands,
|
||||
const LLVMTypeConverter &converter) {
|
||||
TypeRange operandTypes(operands);
|
||||
if (llvm::any_of(operandTypes, llvm::IsaPred<VectorType>)) {
|
||||
VectorType vectorType = cast<VectorType>(op->getResultTypes()[0]);
|
||||
VectorType vectorType =
|
||||
cast<VectorType>(converter.convertType(op->getResultTypes()[0]));
|
||||
rewriter.replaceOp(op, scalarizeVectorOpHelper(op, operands, vectorType,
|
||||
rewriter, converter));
|
||||
return success();
|
||||
|
||||
@@ -516,6 +516,20 @@ module {
|
||||
|
||||
// -----
|
||||
|
||||
module @test_module {
|
||||
// CHECK: llvm.func @__ocml_sin_f16(f16) -> f16
|
||||
// CHECK-LABEL: func @math_sin_vector_0d
|
||||
func.func @math_sin_vector_0d(%arg : vector<f16>) -> vector<f16> {
|
||||
// CHECK: llvm.extractelement {{.*}} : vector<1xf16>
|
||||
// CHECK: llvm.call @__ocml_sin_f16(%{{.*}}) : (f16) -> f16
|
||||
// CHECK: llvm.insertelement {{.*}} : vector<1xf16>
|
||||
%result = math.sin %arg : vector<f16>
|
||||
func.return %result : vector<f16>
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
module @test_module {
|
||||
// CHECK: llvm.func @__ocml_sin_f16(f16) -> f16
|
||||
// CHECK-LABEL: func @math_sin_vector_1d
|
||||
|
||||
Reference in New Issue
Block a user