Skip to content

Revert out-of-scope DxilGenerationPass changes from #8274#8321

Merged
alsepkow merged 1 commit intomicrosoft:mainfrom
alsepkow:user/alsepkow/fix-min-precision-store-scope
Apr 1, 2026
Merged

Revert out-of-scope DxilGenerationPass changes from #8274#8321
alsepkow merged 1 commit intomicrosoft:mainfrom
alsepkow:user/alsepkow/fix-min-precision-store-scope

Conversation

@alsepkow
Copy link
Copy Markdown
Contributor

@alsepkow alsepkow commented Apr 1, 2026

Summary

Reverts the DxilGenerationPass ByteAddressBuffer scalar store changes and removes scalar store tests that were included in PR #8274. These changes were out of scope for the vector load/store fix and, on further discussion, were concluded to be incomplete.

Follow-up issue for the proper fix: #8322

What changed

  • DxilGenerationPass.cpp: Reverted the ByteAddressBuffer fallback path added in ReplaceMinPrecisionRawBufferStoreByType. The sext fallback was wrong for min16uint (loses signedness), and the fix belongs in CodeGen where signedness info is still available.
  • min_precision_raw_load_store.hlsl: Removed scalar load/store tests. Scalar ByteAddressBuffer::Store<min16int>() hits a pre-existing crash in TranslateMinPrecisionRawBuffer (cast<StructType> on ByteAddressBuffer's i32 inner element). Test now covers vector loads/stores only, which is the scope of the original fix.

Context

The original PR #8274 correctly fixed RawBufferVectorLoad/Store to widen min precision types to 32-bit. However, it also added a ByteAddressBuffer scalar store fix in DxilGenerationPass that:

  1. Crept outside the scope of the vector load/store fix
  2. Was incomplete — the sext fallback is wrong for unsigned types (min16uint)
  3. Should instead be handled during Clang CodeGen, where signedness information is available

Scalar ByteAddressBuffer template store widening for min precision types is a separate pre-existing issue that needs a proper fix in CodeGen.

Reverts the DxilGenerationPass ByteAddressBuffer scalar store fix from
PR microsoft#8274 — it was out of scope and incomplete (sext fallback is wrong
for min16uint). Scalar ByteAddressBuffer template store widening should
be handled during CodeGen where signedness info is still available.

Removes scalar load/store tests from min_precision_raw_load_store.hlsl
since scalar ByteAddressBuffer::Store<min16int>() hits a pre-existing
crash in TranslateMinPrecisionRawBuffer (cast<StructType> on non-struct
resource type). Test now covers vector loads/stores only, which is the
scope of the original fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@alsepkow alsepkow merged commit 71aa195 into microsoft:main Apr 1, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Apr 1, 2026
alsepkow added a commit to alsepkow/DirectXShaderCompiler that referenced this pull request Apr 14, 2026
…icrosoft#8321)

## Summary

Reverts the `DxilGenerationPass` ByteAddressBuffer scalar store changes
and removes scalar store tests that were included in PR microsoft#8274. These
changes were out of scope for the vector load/store fix and, on further
discussion, were concluded to be incomplete.

Follow-up issue for the proper fix: microsoft#8322

## What changed

- **DxilGenerationPass.cpp**: Reverted the ByteAddressBuffer fallback
path added in `ReplaceMinPrecisionRawBufferStoreByType`. The `sext`
fallback was wrong for `min16uint` (loses signedness), and the fix
belongs in CodeGen where signedness info is still available.
- **min_precision_raw_load_store.hlsl**: Removed scalar load/store
tests. Scalar `ByteAddressBuffer::Store<min16int>()` hits a pre-existing
crash in `TranslateMinPrecisionRawBuffer` (`cast<StructType>` on
ByteAddressBuffer's `i32` inner element). Test now covers vector
loads/stores only, which is the scope of the original fix.

## Context

The original PR microsoft#8274 correctly fixed `RawBufferVectorLoad/Store` to
widen min precision types to 32-bit. However, it also added a
ByteAddressBuffer scalar store fix in `DxilGenerationPass` that:
1. Crept outside the scope of the vector load/store fix
2. Was incomplete — the `sext` fallback is wrong for unsigned types
(`min16uint`)
3. Should instead be handled during Clang CodeGen, where signedness
information is available

Scalar ByteAddressBuffer template store widening for min precision types
is a separate pre-existing issue that needs a proper fix in CodeGen.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ByteAddressBuffer::Store<min16int/min16uint>() crashes for integer min precision types

3 participants