-
Notifications
You must be signed in to change notification settings - Fork 718
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
dxc generates invalid alignment on groupshared matrix load/store instructions #6416
Labels
bug
Bug, regression, crash
correctness
Bugs that impact shader correctness
matrix-bug
Bugs relating to matrix types
Milestone
Comments
pow2clk
added a commit
to pow2clk/DirectXShaderCompiler
that referenced
this issue
May 6, 2024
When flattening the global for a groupshared matrix, the alignment information was getting lost. As a result, the alignments of the loads and stores were calculating their own alignment based on preferred alignment and trailing zeros of the index. The preferred alignment switched to 16 when the type size was over 128 bits due to a heuristic whose rationale is lost to time. When the global has its own alignment, that gets used, so by retaining it through lowering, the alignments are consistent and reliable. Includes testing for a few matrix variants fixes microsoft#6416
pow2clk
added a commit
that referenced
this issue
May 22, 2024
When flattening the global for a groupshared matrix, the alignment information was getting lost. As a result, the alignments of the loads and stores were calculating their own alignment based on preferred alignment and trailing zeros of the index. The preferred alignment switched to 16 when the type size was over 128 bits due to a heuristic whose rationale is lost to time. When the global has its own alignment, that gets used, so by calculating it at lowering, the alignments are consistent and reliable. Includes testing for a few matrix variants and a pass test. fixes #6416
pow2clk
added a commit
to pow2clk/DirectXShaderCompiler
that referenced
this issue
May 22, 2024
…rosoft#6589) When flattening the global for a groupshared matrix, the alignment information was getting lost. As a result, the alignments of the loads and stores were calculating their own alignment based on preferred alignment and trailing zeros of the index. The preferred alignment switched to 16 when the type size was over 128 bits due to a heuristic whose rationale is lost to time. When the global has its own alignment, that gets used, so by calculating it at lowering, the alignments are consistent and reliable. Includes testing for a few matrix variants and a pass test. fixes microsoft#6416 (cherry picked from commit a6f4025)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Bug, regression, crash
correctness
Bugs that impact shader correctness
matrix-bug
Bugs relating to matrix types
Description
When loading or storing a matrix to
groupshared
dxc is using an alignment on the instruction that is not guaranteed by the underlying global variable.Steps to Reproduce
https://godbolt.org/z/9c9os31MW
Actual Behavior
Compiling this shader produces loads and stores that do not match the alignment of the underlying global.
The global does not specify an alignment so it will get the default alignment of 4 for this type
But the load
and store
both specify an alignment of
align 16
for the first element (other elements are overaligned as well).From the llvm language reference manual, the aligment on the instruction should be guaranteed by somehow, but the alignment of the global does not do it.
Environment
The text was updated successfully, but these errors were encountered: