-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AMDGPU] Adding instruction specific features #167809
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
eccc491
Adding instruction specific features
Shoreshen d6d1d87
Merge branch 'main' into Add-specific-insts-feature
Shoreshen 3327654
fix comments
Shoreshen 83b9e8d
Merge branch 'main' into Add-specific-insts-feature
Shoreshen 04413e2
Merge branch 'main' into Add-specific-insts-feature
Shoreshen cd83519
add feature to builtins
Shoreshen 15e6eec
fix builtin features
Shoreshen c6ac0f1
fix format
Shoreshen a3987b1
fix tests
Shoreshen 2b6be97
fix description
Shoreshen 3691fc9
fix failing tests
Shoreshen 6a8d41a
fix fialing test
Shoreshen 91bd908
fix failing tests
Shoreshen c8d8011
fix failing test
Shoreshen b6ad1ac
format code
Shoreshen 7d3d397
Merge branch 'main' into Add-specific-insts-feature
Shoreshen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // REQUIRES: amdgpu-registered-target | ||
| // RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu fiji -emit-llvm -o - %s | FileCheck -enable-var-scope --check-prefixes=CHECK %s | ||
|
|
||
|
|
||
| #pragma OPENCL EXTENSION cl_khr_fp64 : enable | ||
|
|
||
| typedef unsigned long ulong; | ||
| typedef unsigned int uint; | ||
| typedef unsigned short ushort; | ||
| typedef half __attribute__((ext_vector_type(2))) half2; | ||
| typedef short __attribute__((ext_vector_type(2))) short2; | ||
| typedef ushort __attribute__((ext_vector_type(2))) ushort2; | ||
| typedef uint __attribute__((ext_vector_type(4))) uint4; | ||
|
|
||
| // CHECK-LABEL: @test_lerp | ||
| // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.lerp | ||
| void test_lerp(global int* out, int a, int b, int c) | ||
| { | ||
| *out = __builtin_amdgcn_lerp(a, b, c); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_cubeid( | ||
| // CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.cubeid(float %a, float %b, float %c) | ||
| void test_cubeid(global float* out, float a, float b, float c) { | ||
| *out = __builtin_amdgcn_cubeid(a, b, c); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_cubesc( | ||
| // CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.cubesc(float %a, float %b, float %c) | ||
| void test_cubesc(global float* out, float a, float b, float c) { | ||
| *out = __builtin_amdgcn_cubesc(a, b, c); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_cubetc( | ||
| // CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.cubetc(float %a, float %b, float %c) | ||
| void test_cubetc(global float* out, float a, float b, float c) { | ||
| *out = __builtin_amdgcn_cubetc(a, b, c); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_cubema( | ||
| // CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.cubema(float %a, float %b, float %c) | ||
| void test_cubema(global float* out, float a, float b, float c) { | ||
| *out = __builtin_amdgcn_cubema(a, b, c); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_cvt_pknorm_i16( | ||
| // CHECK: tail call{{.*}} <2 x i16> @llvm.amdgcn.cvt.pknorm.i16(float %src0, float %src1) | ||
| kernel void test_cvt_pknorm_i16(global short2* out, float src0, float src1) { | ||
| *out = __builtin_amdgcn_cvt_pknorm_i16(src0, src1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_cvt_pknorm_u16( | ||
| // CHECK: tail call{{.*}} <2 x i16> @llvm.amdgcn.cvt.pknorm.u16(float %src0, float %src1) | ||
| kernel void test_cvt_pknorm_u16(global ushort2* out, float src0, float src1) { | ||
| *out = __builtin_amdgcn_cvt_pknorm_u16(src0, src1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_sad_u8( | ||
| // CHECK: tail call{{.*}} i32 @llvm.amdgcn.sad.u8(i32 %src0, i32 %src1, i32 %src2) | ||
| kernel void test_sad_u8(global uint* out, uint src0, uint src1, uint src2) { | ||
| *out = __builtin_amdgcn_sad_u8(src0, src1, src2); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_msad_u8( | ||
| // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.msad.u8(i32 %src0, i32 %src1, i32 %src2) | ||
| kernel void test_msad_u8(global uint* out, uint src0, uint src1, uint src2) { | ||
| *out = __builtin_amdgcn_msad_u8(src0, src1, src2); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_sad_hi_u8( | ||
| // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.sad.hi.u8(i32 %src0, i32 %src1, i32 %src2) | ||
| kernel void test_sad_hi_u8(global uint* out, uint src0, uint src1, uint src2) { | ||
| *out = __builtin_amdgcn_sad_hi_u8(src0, src1, src2); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_sad_u16( | ||
| // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.sad.u16(i32 %src0, i32 %src1, i32 %src2) | ||
| kernel void test_sad_u16(global uint* out, uint src0, uint src1, uint src2) { | ||
| *out = __builtin_amdgcn_sad_u16(src0, src1, src2); | ||
| } | ||
|
|
||
| // CHECK-LABEL: @test_qsad_pk_u16_u8( | ||
| // CHECK: {{.*}}call{{.*}} i64 @llvm.amdgcn.qsad.pk.u16.u8(i64 %src0, i32 %src1, i64 %src2) | ||
| kernel void test_qsad_pk_u16_u8(global ulong* out, ulong src0, uint src1, ulong src2) { | ||
| *out = __builtin_amdgcn_qsad_pk_u16_u8(src0, src1, src2); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: I'd just swap this two to make them align.