Skip to content

[SPIRV] Use scalar rules for BDA alignment - #8576

Open
Chris B (llvm-beanz) wants to merge 5 commits into
microsoft:mainfrom
llvm-beanz:8572
Open

[SPIRV] Use scalar rules for BDA alignment#8576
Chris B (llvm-beanz) wants to merge 5 commits into
microsoft:mainfrom
llvm-beanz:8572

Conversation

@llvm-beanz

Copy link
Copy Markdown
Collaborator

Previously the vk::RawBufferLoad and vk::RawBufferStore instructions used a default alignment of 4 unless the user explicitly specified a different value. This change instead makes the default be based on the minimum legal value for the type being loaded so that users don't need to explicitly override it when loading arbitrary data types.

Fixes #8572

Assisted by Claude Opus 4.8

Previously the `vk::RawBufferLoad` and `vk::RawBufferStore`
instructions used a default alignment of 4 unless the user explicitly
specified a different value. This change instead makes the default be
based on the minimum legal value for the type being loaded so that
users don't need to explicitly override it when loading arbitrary data
types.

Fixes microsoft#8572

Assisted by Claude Opus 4.8
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

✅ With the latest revision this PR passed the C/C++ code formatter.

@dnovillo Diego Novillo (dnovillo) added the spirv Work related to SPIR-V label Jul 10, 2026
@damyanp

Copy link
Copy Markdown
Member

[Auto-generated note from Damyan Pepper (@damyanp)]

Did you consider adding a release note?

Per our CONTRIBUTING guidance, user-visible bug fixes and new features usually need an entry in docs/ReleaseNotes.md. If this PR is part of a larger multi-PR effort, a single shared release note across that effort is totally fine.

Copilot AI balanced review requested due to automatic review settings August 19, 2026 18:38
@llvm-beanz

Copy link
Copy Markdown
Collaborator Author

Diego Novillo (@dnovillo) or Gregory Roth (@pow2clk), can one of you give this a review?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates SPIR-V raw buffer operations to infer legal default alignment from the accessed type.

Changes:

  • Computes scalar-layout alignment for raw loads and stores.
  • Adds coverage for scalar and composite types.
  • Updates existing tests and release notes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
SpirvEmitter.cpp Computes default buffer alignment.
intrinsics.vkrawbufferload.64bit-align.hlsl Tests inferred alignments.
intrinsics.vkrawbufferload.hlsl Updates 16-bit intrinsic expectations.
ReleaseNotes.md Documents the fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/ReleaseNotes.md Outdated
Comment on lines +181 to +183
- SPIR-V fixed incorrect alignment of 64-bit elements in `vk::RawBufferLoad` and
`vk::RawBufferStore` intrinsics
[#8576](https://github.com/microsoft/DirectXShaderCompiler/pull/8576)
Copilot AI review requested due to automatic review settings August 19, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

docs/ReleaseNotes.md:47

  • CONTRIBUTING.md:136-140 requires release-note entries to be a single sentence and says not to link specific PRs. Please link the fixed issue (#8572) instead and terminate the sentence; the SPIR-V: prefix also matches the surrounding entries.
- SPIR-V fixed incorrect alignment of 64-bit elements in `vk::RawBufferLoad` and
  `vk::RawBufferStore` intrinsics
  [#8576](https://github.com/microsoft/DirectXShaderCompiler/pull/8576)

@dnovillo Diego Novillo (dnovillo) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just one nit. Everything looks good for SPIR-V. Thanks.

Comment thread docs/ReleaseNotes.md
[#6464](https://github.com/microsoft/DirectXShaderCompiler/issues/6464).
- SPIR-V fixed incorrect alignment of 64-bit elements in `vk::RawBufferLoad` and
`vk::RawBufferStore` intrinsics
[#8576](https://github.com/microsoft/DirectXShaderCompiler/pull/8576)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should point to #8572, I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spirv Work related to SPIR-V

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

[SPIR-V] Improperly aligned OpLoad/OpStore for structures with 64-bit scalar types

5 participants