From 1e0908bd7107dfbdac912b693c3ab9bd6e1dc8b3 Mon Sep 17 00:00:00 2001 From: 16-Bit-Dog <67922228+16-Bit-Dog@users.noreply.github.com> Date: Fri, 10 Oct 2025 13:09:24 -0400 Subject: Addition of `Load`/`Store` coherent operations (#8395) Fixes: https://github.com/shader-slang/slang/issues/7634 Duplicate of PR https://github.com/shader-slang/slang/pull/8052 Primary Changes: * Added `storeCoherent` and `loadCoherent` for coherent load/store via pointers. This is backed by `IRMemoryScopeAttr` which is an `IRAttr` attached to `IRLoad` and `IRStore` * Logic in `source\slang\slang-emit-spirv.cpp` for load/store emitting has been reworked to be less messy and more maintainable * Add to `hlsl.meta.slang` coop vector and coop matrix coherent load/store operations Secondary Changes: * Added a missing load/store test for coop matrix: `tests\cooperative-matrix\load-store-pointer.slang` --------- Co-authored-by: ArielG-NV Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Nathan V. Morrical --- source/slang/slang-ir-defer-buffer-load.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-ir-defer-buffer-load.cpp') diff --git a/source/slang/slang-ir-defer-buffer-load.cpp b/source/slang/slang-ir-defer-buffer-load.cpp index 4736b4e65..3c8a9f4c7 100644 --- a/source/slang/slang-ir-defer-buffer-load.cpp +++ b/source/slang/slang-ir-defer-buffer-load.cpp @@ -151,9 +151,19 @@ struct DeferBufferLoadContext void deferBufferLoadInst(IRBuilder& builder, List& workList, IRInst* loadInst) { + bool failDueToAttributeFound = false; + for (auto attr : loadInst->getAllAttrs()) + { + if (as(attr) || as(attr)) + { + failDueToAttributeFound = true; + break; + } + } + // Don't defer the load anymore if the type is simple. - if (!isTypePreferrableToDeferLoad(codeGenContext, loadInst->getDataType()) || - loadInst->findAttr()) + if (failDueToAttributeFound || + !isTypePreferrableToDeferLoad(codeGenContext, loadInst->getDataType())) { return; } -- cgit v1.2.3