Skip to content

Commit 16dc838

Browse files
committed
Add vector to spirv test case
1 parent 41b0195 commit 16dc838

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,22 @@ func.func @reduction_minui(%v : vector<3xi32>, %s: i32) -> i32 {
932932

933933
// -----
934934

935+
module attributes { spirv.target_env = #spirv.target_env<#spirv.vce<v1.0, [BFloat16DotProductKHR], [SPV_KHR_bfloat16]>, #spirv.resource_limits<>> } {
936+
937+
// CHECK-LABEL: func @reduction_bf16_addf_mulf
938+
// CHECK-SAME: (%[[ARG0:.+]]: vector<4xbf16>, %[[ARG1:.+]]: vector<4xbf16>)
939+
// CHECK: %[[DOT:.+]] = spirv.Dot %[[ARG0]], %[[ARG1]] : vector<4xbf16> -> bf16
940+
// CHECK: return %[[DOT]] : bf16
941+
func.func @reduction_bf16_addf_mulf(%arg0: vector<4xbf16>, %arg1: vector<4xbf16>) -> bf16 {
942+
%mul = arith.mulf %arg0, %arg1 : vector<4xbf16>
943+
%red = vector.reduction <add>, %mul : vector<4xbf16> into bf16
944+
return %red : bf16
945+
}
946+
947+
} // end module
948+
949+
// -----
950+
935951
// CHECK-LABEL: @shape_cast_same_type
936952
// CHECK-SAME: (%[[ARG0:.*]]: vector<2xf32>)
937953
// CHECK: return %[[ARG0]]

0 commit comments

Comments
 (0)