-
Notifications
You must be signed in to change notification settings - Fork 896
[202x][unroll] Only run the default LLVM loop unroll for 202x onward #8822
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
Open
Farzon Lotfi (farzonl)
wants to merge
4
commits into
microsoft:main
Choose a base branch
from
farzonl:feature/202x_unroll-issues-8789
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b42f0f6
[202x][unroll] Only run the default LLVM loop unroll for 202x onward
farzonl 9d4b85b
add co-pilot comment, fix failing test caused by typo
farzonl c1edf4d
remove check count as it breaks the tests also make check-prefix one …
farzonl de4c1a6
expose UnrollCountIsHint via python hctdb.py file
farzonl 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
Some comments aren't visible on the classic Files Changed page.
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
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
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
2 changes: 1 addition & 1 deletion
2
tools/clang/test/HLSLFileCheck/hlsl/control_flow/attributes/unroll/count_cbuff.hlsl
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
2 changes: 1 addition & 1 deletion
2
tools/clang/test/HLSLFileCheck/hlsl/control_flow/attributes/unroll/count_greater_than_i.hlsl
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
24 changes: 24 additions & 0 deletions
24
tools/clang/test/HLSLFileCheck/hlsl/control_flow/attributes/unroll/count_hint_202x.hlsl
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,24 @@ | ||
| // RUN: %dxc -E main -T ps_6_0 -HV 202x -O2 %s | FileCheck %s -check-prefix=O2 | ||
| // RUN: %dxc -E main -T ps_6_0 -HV 202x -O3 %s | FileCheck %s -check-prefix=O3 | ||
|
|
||
| // O2: call float @dx.op.dot3 | ||
| // O2-NOT: call float @dx.op.dot3 | ||
| // O2: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop | ||
| // O2: !{!"llvm.loop.unroll.count", i32 3} | ||
|
|
||
| // O3: call float @dx.op.dot3 | ||
| // O3: call float @dx.op.dot3 | ||
| // O3: call float @dx.op.dot3 | ||
| // O3: call float @dx.op.dot3 | ||
| // O3-NOT: call float @dx.op.dot3 | ||
| // O3: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop | ||
| // O3: !{!"llvm.loop.unroll.disable"} | ||
|
|
||
| float main(float3 a : A, float3 b : B) : SV_Target { | ||
| float result = 0; | ||
| [unroll(3)] | ||
| for (int i = 0; i < 10; i++) { | ||
| result += dot(a * i, b); | ||
| } | ||
| return result; | ||
| } |
2 changes: 1 addition & 1 deletion
2
tools/clang/test/HLSLFileCheck/hlsl/control_flow/attributes/unroll/count_less_than_i.hlsl
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
46 changes: 46 additions & 0 deletions
46
...clang/test/HLSLFileCheck/hlsl/control_flow/attributes/unroll/count_runtime_hint_202x.hlsl
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,46 @@ | ||
| // RUN: %dxc -E main -T ps_6_0 -HV 202x -O2 %s | FileCheck %s -check-prefixes=COMMON,O2 | ||
| // RUN: %dxc -E main -T ps_6_0 -HV 202x -O3 %s | FileCheck %s -check-prefixes=COMMON,O3 | ||
| // RUN: %dxc -E mainPowerOfTwo -T ps_6_0 -HV 202x -O2 %s | FileCheck %s -check-prefixes=COMMON,POWER-O2 | ||
| // RUN: %dxc -E mainPowerOfTwo -T ps_6_0 -HV 202x -O3 %s | FileCheck %s -check-prefix=POWER-O3 | ||
|
|
||
| // O2 Doesn't unroll and O3 Runtime unrolling only supports | ||
| // power-of-two factors, so the count hint is | ||
| // consumed without cloning the loop body. | ||
| // COMMON: call float @dx.op.dot3 | ||
| // COMMON-NOT: call float @dx.op.dot3 | ||
| // COMMON: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop | ||
| // O2: !{!"llvm.loop.unroll.count", i32 3} | ||
| // O3: !{!"llvm.loop.unroll.disable"} | ||
| // POWER-O2: !{!"llvm.loop.unroll.count", i32 4} | ||
|
|
||
| // The O3 output has one remainder-loop body and four unrolled main-loop bodies. | ||
| // POWER-O3: and i32 {{.*}}, 3 | ||
| // POWER-O3: call float @dx.op.dot3 | ||
| // POWER-O3: call float @dx.op.dot3 | ||
| // POWER-O3: call float @dx.op.dot3 | ||
| // POWER-O3: call float @dx.op.dot3 | ||
| // POWER-O3: call float @dx.op.dot3 | ||
| // POWER-O3-NOT: call float @dx.op.dot3 | ||
| // POWER-O3: add i32 {{.*}}, 4 | ||
| // POWER-O3: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop | ||
| // POWER-O3: !{!"llvm.loop.unroll.disable"} | ||
|
|
||
| float main(float3 a : A, float3 b : B, | ||
| uint iterationCount : COUNT) : SV_Target { | ||
| float result = 0; | ||
| [unroll(3)] | ||
| for (uint i = 0; i < iterationCount; i++) { | ||
| result += dot(a * i, b); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| float mainPowerOfTwo(float3 a : A, float3 b : B, | ||
| uint iterationCount : COUNT) : SV_Target { | ||
| float result = 0; | ||
| [unroll(4)] | ||
| for (uint i = 0; i < iterationCount; i++) { | ||
| result += dot(a * i, b); | ||
| } | ||
| return result; | ||
| } |
25 changes: 25 additions & 0 deletions
25
tools/clang/test/HLSLFileCheck/hlsl/control_flow/attributes/unroll/full_hint_202x.hlsl
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,25 @@ | ||
| // RUN: %dxc -E main -T ps_6_0 -HV 202x -O2 %s | FileCheck %s -check-prefix=CHECK | ||
| // RUN: %dxc -E main -T ps_6_0 -HV 202x -O3 %s | FileCheck %s -check-prefix=CHECK | ||
|
|
||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK: call float @dx.op.dot3 | ||
| // CHECK-NOT: call float @dx.op.dot3 | ||
| // CHECK-NOT: br i1 | ||
| // CHECK-NOT: !llvm.loop | ||
|
|
||
| float main(float3 a : A, float3 b : B) : SV_Target { | ||
| float result = 0; | ||
| [unroll] | ||
| for (int i = 0; i < 10; i++) { | ||
| result += dot(a * i, b); | ||
| } | ||
| return result; | ||
| } |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.