summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorSriram Murali <85252063+sriramm-nv@users.noreply.github.com>2024-04-30 12:20:16 -0700
committerGitHub <noreply@github.com>2024-04-30 12:20:16 -0700
commit70111daf43c87e182695666c34345e061e114a68 (patch)
tree5510ea669f9c5e7853810f84dfe9e01358ab77c6 /source/slang/slang-emit.cpp
parent95ca2aa72cca9968dabd6dfa1a4dcf7de3909035 (diff)
Generate vectorized version of byteaddress load/store methods (#4036)
Fixes #3533 - Add logic to perform aligned memory operations for loading from and storing to composite resources, like vectors within the ByteAddress legalize pass. - Checks Added a new test for byte address with/without alignment. --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 87f0911e7..1fa04b4be 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -716,14 +716,13 @@ Result linkAndOptimizeIR(
// of a buffer need not be more than 4-byte aligned, and loads
// of vectors need only be aligned based on their element type).
//
- // TODO: We should consider having an extended variant of `Load<T>`
- // on byte-address buffers which expresses a programmer's knowledge
- // that the load will have greater alignment than required by D3D.
- // That could either come as an explicit guaranteed-alignment
- // operand, or instead as something like a `Load4Aligned<T>` operation
- // that returns a `vector<4,T>` and assumes `4*sizeof(T)` alignemtn.
- //
- byteAddressBufferOptions.scalarizeVectorLoadStore = true;
+ // Slang IR supports a variant of `Load<T>` on byte-address buffers
+ // that will have greater alignment than required by D3D. The
+ // alignment information is inferred from the operation like a
+ // `Load4Aligned<T>` that returns a `vector<4,T>` that assumes a
+ // `4*sizeof(T)` alignment. We may choose to disable that in favor
+ // of byte-address indexing by setting this flag to true.
+ byteAddressBufferOptions.scalarizeVectorLoadStore = false;
// For GLSL targets, there really isn't a low-level concept
// of a byte-address buffer at all, and the standard "shader storage