-
Notifications
You must be signed in to change notification settings - Fork 15k
[AMDGPU] Add sema check for global_atomic_fadd_v2f16 builtin #158145
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -verify %s | ||
|
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. Can you verify we have test coverage using OpenCL plus one of the C/C++/HIP variants |
||
|
|
||
| // Test semantic analysis for AMDGCN atomic fadd v2f16 builtins | ||
| // These tests ensure proper type checking for the builtin arguments | ||
|
|
||
| typedef _Float16 v2f16 __attribute__((ext_vector_type(2))); | ||
| typedef float v2f32 __attribute__((ext_vector_type(2))); | ||
| typedef _Float16 v4f16 __attribute__((ext_vector_type(4))); | ||
|
|
||
|
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. Can you also test some of the cases with the type embedded in a structure like was crashing 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 think the type was from hip though. How do I add a type from hip_fp16 to a clang test? Do I need to put the test in one of the hip/opencl folders? Thanks! |
||
| void test_global_atomic_fadd_v2f16_negative() { | ||
| v2f16 val; | ||
| v2f32 val_f32; | ||
| v4f16 val_v4f16; | ||
| _Float16 __attribute__((ext_vector_type(2))) __attribute__((address_space(1))) *ptr_v2f16; | ||
|
|
||
| __builtin_amdgcn_global_atomic_fadd_v2f16(ptr_v2f16, val_f32); // expected-error{{passing 'v2f32'}} | ||
| __builtin_amdgcn_global_atomic_fadd_v2f16(ptr_v2f16, val_v4f16); // expected-error{{passing 'v4f16'}} | ||
| __builtin_amdgcn_global_atomic_fadd_v2f16(ptr_v2f16); // expected-error{{too few arguments to function call}} | ||
| __builtin_amdgcn_global_atomic_fadd_v2f16(ptr_v2f16, val, val); // expected-error{{too many arguments to function call}} | ||
| } | ||
|
|
||
| void test_flat_atomic_fadd_v2f16_negative() { | ||
| v2f16 val; | ||
| v2f32 val_f32; | ||
| v4f16 val_v4f16; | ||
| _Float16 __attribute__((ext_vector_type(2))) __attribute__((address_space(0))) *ptr_v2f16; | ||
|
|
||
| // Same error patterns for flat atomic | ||
| __builtin_amdgcn_flat_atomic_fadd_v2f16(ptr_v2f16, val_f32); // expected-error{{passing 'v2f32'}} | ||
| __builtin_amdgcn_flat_atomic_fadd_v2f16(ptr_v2f16, val_v4f16); // expected-error{{passing 'v4f16'}} | ||
| __builtin_amdgcn_flat_atomic_fadd_v2f16(ptr_v2f16); // expected-error{{too few arguments to function call}} | ||
| __builtin_amdgcn_flat_atomic_fadd_v2f16(ptr_v2f16, val, val); // expected-error{{too many arguments to function call}} | ||
| } | ||
|
|
||
| void test_ds_atomic_fadd_v2f16_negative() { | ||
| v2f16 val; | ||
| v2f32 val_f32; | ||
| v4f16 val_v4f16; | ||
| _Float16 __attribute__((ext_vector_type(2))) __attribute__((address_space(3))) *ptr_v2f16; | ||
|
|
||
| // Same error patterns for ds atomic | ||
| __builtin_amdgcn_ds_atomic_fadd_v2f16(ptr_v2f16, val_f32); // expected-error{{passing 'v2f32'}} | ||
| __builtin_amdgcn_ds_atomic_fadd_v2f16(ptr_v2f16, val_v4f16); // expected-error{{passing 'v4f16'}} | ||
| __builtin_amdgcn_ds_atomic_fadd_v2f16(ptr_v2f16); // expected-error{{too few arguments to function call}} | ||
| __builtin_amdgcn_ds_atomic_fadd_v2f16(ptr_v2f16, val, val); // expected-error{{too many arguments to function call}} | ||
| } | ||
|
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. bf16 vector cases and f32 cases are also marked with t, and probably broken in the same way |
||
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.
Also make sure to test this with all of these similar intrinsics, the "t"s are all suspicious (I'm guessing if it was for anything, it was hacking around the address space of the pointer across the languages)