diff options
| author | Yong He <yonghe@outlook.com> | 2025-07-01 19:09:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-02 02:09:29 +0000 |
| commit | c701ec00ccce6dfa8094d6550ce2db929fc8cefe (patch) | |
| tree | 4f729e8fa5700b2d6d7d99f34514682e3ad351f8 /source/slang/slang-emit.cpp | |
| parent | 83c72fd8772d312233f4e3ccd4154b81030d4795 (diff) | |
Defer immutable buffer loads when emitting spirv. (#7579)
* Defer immutable buffer loads when emitting spirv.
* Fix.
* Fix.
* Fix.
* Fix tests.
* Fix test.
Diffstat (limited to 'source/slang/slang-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 49b27383d..db8a9ba61 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -1227,11 +1227,6 @@ Result linkAndOptimizeIR( // Inline calls to any functions marked with [__unsafeInlineEarly] or [ForceInline]. performForceInlining(irModule); - // Push `structuredBufferLoad` to the end of access chain to avoid loading unnecessary data. - if (isKhronosTarget(targetRequest) || isMetalTarget(targetRequest) || - isWGPUTarget(targetRequest)) - deferBufferLoad(irModule); - // Specialization can introduce dead code that could trip // up downstream passes like type legalization, so we // will run a DCE pass to clean up after the specialization. @@ -1386,6 +1381,11 @@ Result linkAndOptimizeIR( specializeResourceUsage(codeGenContext, irModule); specializeFuncsForBufferLoadArgs(codeGenContext, irModule); + // Push `structuredBufferLoad` to the end of access chain to avoid loading unnecessary data. + if (isKhronosTarget(targetRequest) || isMetalTarget(targetRequest) || + isWGPUTarget(targetRequest)) + deferBufferLoad(irModule); + // We also want to specialize calls to functions that // takes unsized array parameters if possible. // Moreover, for Khronos targets, we also want to specialize calls to functions |
