-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[mlir][x86vector] AVX Convert/Broadcast BF16 to F32 instructions #135143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
860ccf7
cc45538
486ec2d
0a80bbc
a9df22e
5dfcee7
0ae2dc5
63df6fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// REQUIRES: target=x86{{.*}} | ||
|
||
// RUN: mlir-opt %s \ | ||
// RUN: -convert-vector-to-llvm="enable-x86vector" -convert-to-llvm \ | ||
// RUN: -reconcile-unrealized-casts | \ | ||
// RUN: mlir-translate --mlir-to-llvmir | \ | ||
// RUN: llc -mcpu=sierraforest | \ | ||
// RUN: FileCheck %s | ||
|
||
func.func @avxbf16_bcst_bf16_to_f32_packed_128(%arg0: !llvm.ptr) -> vector<4xf32> { | ||
%0 = x86vector.avx.bcst.bf16_to_f32.packed %arg0 : !llvm.ptr -> vector<4xf32> | ||
return %0 : vector<4xf32> | ||
} | ||
// CHECK-LABEL: avxbf16_bcst_bf16_to_f32_packed_128: | ||
// CHECK: vbcstnebf162ps{{.*}}%xmm | ||
|
||
func.func @avxbf16_bcst_bf16_to_f32_packed_256(%arg0: !llvm.ptr) -> vector<8xf32> { | ||
%0 = x86vector.avx.bcst.bf16_to_f32.packed %arg0 : !llvm.ptr -> vector<8xf32> | ||
return %0 : vector<8xf32> | ||
} | ||
// CHECK-LABEL: avxbf16_bcst_bf16_to_f32_packed_256: | ||
// CHECK: vbcstnebf162ps{{.*}}%ymm |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// REQUIRES: target=x86{{.*}} | ||
|
||
// RUN: mlir-opt %s \ | ||
// RUN: -convert-vector-to-llvm="enable-x86vector" -convert-to-llvm \ | ||
// RUN: -reconcile-unrealized-casts | \ | ||
// RUN: mlir-translate --mlir-to-llvmir | \ | ||
// RUN: llc -mcpu=sierraforest | \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the value of checking assembly? Shouldn't this be tested in LLVM instead? I appreciate the desire for more complete, e2e testing, but these things come at a cost and I'd rather for us to focus on the bare minimum. Especially for things that are definitely tested in LLVM (i.e. lowering LLVM intrinsics to ASM). Hopefully this make sense :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed! |
||
// RUN: FileCheck %s | ||
|
||
func.func @avxbf16_cvt_packed_even_indexed_bf16_to_f32_128(%arg0: memref<8xbf16>) -> vector<4xf32> { | ||
%intptr = memref.extract_aligned_pointer_as_index %arg0 : memref<8xbf16> -> index | ||
%0 = arith.index_cast %intptr : index to i32 | ||
%1 = llvm.inttoptr %0 : i32 to !llvm.ptr | ||
%2 = x86vector.avx.cvt.packed.even.indexed.bf16_to_f32 %1 : !llvm.ptr -> vector<4xf32> | ||
return %2 : vector<4xf32> | ||
} | ||
// CHECK-LABEL: avxbf16_cvt_packed_even_indexed_bf16_to_f32_128: | ||
// CHECK: vcvtneebf162ps{{.*}}%xmm | ||
|
||
func.func @avxbf16_cvt_packed_even_indexed_bf16_to_f32_256(%arg0: memref<16xbf16>) -> vector<8xf32> { | ||
%intptr = memref.extract_aligned_pointer_as_index %arg0 : memref<16xbf16> -> index | ||
%0 = arith.index_cast %intptr : index to i32 | ||
%1 = llvm.inttoptr %0 : i32 to !llvm.ptr | ||
%2 = x86vector.avx.cvt.packed.even.indexed.bf16_to_f32 %1 : !llvm.ptr -> vector<8xf32> | ||
return %2 : vector<8xf32> | ||
} | ||
// CHECK-LABEL: avxbf16_cvt_packed_even_indexed_bf16_to_f32_256: | ||
// CHECK: vcvtneebf162ps{{.*}}%ymm | ||
|
||
func.func @avxbf16_cvt_packed_odd_indexed_bf16_to_f32_128(%arg0: memref<8xbf16>) -> vector<4xf32> { | ||
%intptr = memref.extract_aligned_pointer_as_index %arg0 : memref<8xbf16> -> index | ||
%0 = arith.index_cast %intptr : index to i32 | ||
%1 = llvm.inttoptr %0 : i32 to !llvm.ptr | ||
%2 = x86vector.avx.cvt.packed.odd.indexed.bf16_to_f32 %1 : !llvm.ptr -> vector<4xf32> | ||
return %2 : vector<4xf32> | ||
} | ||
// CHECK-LABEL: avxbf16_cvt_packed_odd_indexed_bf16_to_f32_128: | ||
// CHECK: vcvtneobf162ps{{.*}}%xmm | ||
|
||
func.func @avxbf16_cvt_packed_odd_indexed_bf16_to_f32_256(%arg0: memref<16xbf16>) -> vector<8xf32> { | ||
%intptr = memref.extract_aligned_pointer_as_index %arg0 : memref<16xbf16> -> index | ||
%0 = arith.index_cast %intptr : index to i32 | ||
%1 = llvm.inttoptr %0 : i32 to !llvm.ptr | ||
%2 = x86vector.avx.cvt.packed.odd.indexed.bf16_to_f32 %1 : !llvm.ptr -> vector<8xf32> | ||
return %2 : vector<8xf32> | ||
} | ||
// CHECK-LABEL: avxbf16_cvt_packed_odd_indexed_bf16_to_f32_256: | ||
// CHECK: vcvtneobf162ps{{.*}}%ymm |
Uh oh!
There was an error while loading. Please reload this page.