-
Notifications
You must be signed in to change notification settings - Fork 851
Fix rawBufferVectorLoad/Store to widen min precision types to 32-bit #8274
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
alsepkow
merged 14 commits into
microsoft:main
from
alsepkow:user/alsepkow/fix-min-precision-vector-load
Mar 31, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e13d0dc
Fix rawBufferVectorLoad/Store to widen min precision types to 32-bit
alsepkow ddeb1bd
Merge remote-tracking branch 'upstream/main' into user/alsepkow/fix-m…
alsepkow 9defa02
Fix min16uint debug test to accept named SSA values
alsepkow b9f249a
Fix min16int_vec and min16float_vec debug tests for named SSA values
alsepkow 7c95fb0
Address review: extract helpers, simplify code, shorten comments
alsepkow 4302236
Apply suggestions from code review
alsepkow 8e7c6fb
Update lib/HLSL/HLOperationLower.cpp
alsepkow 41f37f9
Address review: refactor widenMinPrecisionType, extend to RawBufferStore
alsepkow df53605
Remove redundant comment on widenMinPrecisionType
alsepkow d6b3294
Trim verbose comments to explain why, not what
alsepkow 14396ae
Rename test to min_precision_raw_load_store.hlsl
alsepkow 81a1f81
Revert accidental submodule and unrelated file changes
alsepkow d7a0760
Fix min precision store widening: scope to ByteAddressBuffer only
alsepkow 52a7193
Fix min precision store widening for ByteAddressBuffer scalars
alsepkow 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
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
62 changes: 62 additions & 0 deletions
62
...clang/test/HLSLFileCheck/hlsl/objects/ByteAddressBuffer/min_precision_raw_load_store.hlsl
|
alsepkow marked this conversation as resolved.
|
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,62 @@ | ||
| // RUN: %dxc -E main -T cs_6_9 %s | FileCheck %s | ||
|
|
||
| // Regression test for min precision rawBufferLoad/Store. | ||
| // Min precision types should use i32/f32 operations (not i16/f16) | ||
| // to match how pre-SM6.9 RawBufferLoad handles min precision. | ||
|
|
||
| RWByteAddressBuffer g_buf : register(u0); | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| // === Vector loads/stores (RawBufferVectorLoad/Store) === | ||
|
|
||
| // min16int: should load as v3i32, not v3i16 | ||
| // CHECK: call %dx.types.ResRet.v3i32 @dx.op.rawBufferVectorLoad.v3i32 | ||
| min16int3 vi = g_buf.Load< min16int3 >(0); | ||
| // CHECK: call void @dx.op.rawBufferVectorStore.v3i32 | ||
| g_buf.Store< min16int3 >(12, vi); | ||
|
|
||
| // min16uint: should load as v3i32, not v3i16 | ||
| // CHECK: call %dx.types.ResRet.v3i32 @dx.op.rawBufferVectorLoad.v3i32 | ||
| min16uint3 vu = g_buf.Load< min16uint3 >(24); | ||
| // CHECK: call void @dx.op.rawBufferVectorStore.v3i32 | ||
| g_buf.Store< min16uint3 >(36, vu); | ||
|
|
||
| // min16float: should load as v3f32, not v3f16 | ||
| // CHECK: call %dx.types.ResRet.v3f32 @dx.op.rawBufferVectorLoad.v3f32 | ||
| // CHECK: fptrunc <3 x float> {{.*}} to <3 x half> | ||
| min16float3 vf = g_buf.Load< min16float3 >(48); | ||
| // CHECK: fpext <3 x half> {{.*}} to <3 x float> | ||
| // CHECK: call void @dx.op.rawBufferVectorStore.v3f32 | ||
| g_buf.Store< min16float3 >(60, vf); | ||
|
|
||
| // === Scalar loads/stores (RawBufferLoad/Store) === | ||
|
|
||
| // min16int scalar: should use i32 rawBufferStore | ||
| // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32 | ||
| min16int si = g_buf.Load< min16int >(72); | ||
| // CHECK: call void @dx.op.rawBufferStore.i32 | ||
| g_buf.Store< min16int >(76, si); | ||
|
|
||
| // min16uint scalar: should use i32 rawBufferStore | ||
| // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32 | ||
| min16uint su = g_buf.Load< min16uint >(80); | ||
| // CHECK: call void @dx.op.rawBufferStore.i32 | ||
| g_buf.Store< min16uint >(84, su); | ||
|
|
||
| // min16float scalar: should use f32 rawBufferStore | ||
| // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32 | ||
| min16float sf = g_buf.Load< min16float >(88); | ||
| // CHECK: call void @dx.op.rawBufferStore.f32 | ||
| g_buf.Store< min16float >(92, sf); | ||
|
|
||
| // Verify i16/f16 ops are NOT used. | ||
| // CHECK-NOT: rawBufferVectorLoad.v{{[0-9]+}}i16 | ||
| // CHECK-NOT: rawBufferVectorStore.v{{[0-9]+}}i16 | ||
| // CHECK-NOT: rawBufferVectorLoad.v{{[0-9]+}}f16 | ||
| // CHECK-NOT: rawBufferVectorStore.v{{[0-9]+}}f16 | ||
| // CHECK-NOT: rawBufferLoad.i16 | ||
| // CHECK-NOT: rawBufferStore.i16 | ||
| // CHECK-NOT: rawBufferLoad.f16 | ||
| // CHECK-NOT: rawBufferStore.f16 | ||
| } |
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.