-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Allow fixed vector operand for LLVM_AtomicRMWOp #110553
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 all commits
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 |
---|---|---|
|
@@ -1496,7 +1496,8 @@ llvm.func @elements_constant_3d_array() -> !llvm.array<2 x array<2 x array<2 x i | |
// CHECK-LABEL: @atomicrmw | ||
llvm.func @atomicrmw( | ||
%f32_ptr : !llvm.ptr, %f32 : f32, | ||
%i32_ptr : !llvm.ptr, %i32 : i32) { | ||
%i32_ptr : !llvm.ptr, %i32 : i32, | ||
%f16_vec_ptr : !llvm.ptr, %f16_vec : vector<2xf16>) { | ||
// CHECK: atomicrmw fadd ptr %{{.*}}, float %{{.*}} monotonic | ||
%0 = llvm.atomicrmw fadd %f32_ptr, %f32 monotonic : !llvm.ptr, f32 | ||
// CHECK: atomicrmw fsub ptr %{{.*}}, float %{{.*}} monotonic | ||
|
@@ -1535,11 +1536,19 @@ llvm.func @atomicrmw( | |
%17 = llvm.atomicrmw usub_cond %i32_ptr, %i32 monotonic : !llvm.ptr, i32 | ||
// CHECK: atomicrmw usub_sat ptr %{{.*}}, i32 %{{.*}} monotonic | ||
%18 = llvm.atomicrmw usub_sat %i32_ptr, %i32 monotonic : !llvm.ptr, i32 | ||
// CHECK: atomicrmw fadd ptr %{{.*}}, <2 x half> %{{.*}} monotonic | ||
%19 = llvm.atomicrmw fadd %f16_vec_ptr, %f16_vec monotonic : !llvm.ptr, vector<2xf16> | ||
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. also test fmin/fmax/fsub with vector. Also the scalar cases are supported, as well as bfloat 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.
I'm not sure about fmin/fmax/fsub, so currently I filtered other operations here.
Bfloat also should be tested (done), agree, but scalar cases is out of scope of this PR. 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. You're applying a bunch of restrictions to these that simply do not exist in the underlying IR. FP vectors are supported for all the FP operations (except xchg, for now, which doesn't really count) 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. Ideally the LLVM dialect verifiers should follow the LLVM IR verifiers as closely as possible: At the moment, the LLVM dialect verifiers are still very incomplete since it is mostly a lowering dialect in MLIR. However, we should try to avoid having verifiers that fail on correct LLVM IR (as it obviously was the case before your PR). |
||
// CHECK: atomicrmw fsub ptr %{{.*}}, <2 x half> %{{.*}} monotonic | ||
%20 = llvm.atomicrmw fsub %f16_vec_ptr, %f16_vec monotonic : !llvm.ptr, vector<2xf16> | ||
// CHECK: atomicrmw fmax ptr %{{.*}}, <2 x half> %{{.*}} monotonic | ||
%21 = llvm.atomicrmw fmax %f16_vec_ptr, %f16_vec monotonic : !llvm.ptr, vector<2xf16> | ||
// CHECK: atomicrmw fmin ptr %{{.*}}, <2 x half> %{{.*}} monotonic | ||
%22 = llvm.atomicrmw fmin %f16_vec_ptr, %f16_vec monotonic : !llvm.ptr, vector<2xf16> | ||
|
||
// CHECK: atomicrmw volatile | ||
// CHECK-SAME: syncscope("singlethread") | ||
// CHECK-SAME: align 8 | ||
%19 = llvm.atomicrmw volatile udec_wrap %i32_ptr, %i32 syncscope("singlethread") monotonic {alignment = 8 : i64} : !llvm.ptr, i32 | ||
%23 = llvm.atomicrmw volatile udec_wrap %i32_ptr, %i32 syncscope("singlethread") monotonic {alignment = 8 : i64} : !llvm.ptr, i32 | ||
llvm.return | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test with a scalable vector as well?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please check https://github.com/llvm/llvm-project/pull/110553/files#diff-ff9a14cb96ea30dc57bad4dc2c44b34d54d57a25777288c26f305279e387f1a1R646
But it verifies tablegen introduced rule, not verifier.
Verifier checks scalability second time. In my opinion it is more consistant to have such check in verifier then don't have. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see there is also
LLVM_AnyFixedVector
. I think it is ok to keep the redundant check yes.