diff options
| author | Yong He <yonghe@outlook.com> | 2024-12-03 15:52:02 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-03 15:52:02 -0800 |
| commit | ffcb1030f72af757fc03aa395e19b976d6405126 (patch) | |
| tree | 0864f34e0819d5f9073bc46a4b1a8cdea47d8868 /source/slang/slang-emit-spirv.cpp | |
| parent | a49461b2dc57d007619ec157eb0f63e77ab9c0ed (diff) | |
Add intrinsics for aligned load/store. (#5736)
* Add intrinsics for aligned load/store.
* Fix.
* Update comment.
* Implement aligned load/store as intrinsic_op.
* Fix.
* Add proposal doc.
* fix typo.
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 90d0db5d7..b0da7e4a6 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -5975,10 +5975,17 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex SpvStorageClassPhysicalStorageBuffer) { IRSizeAndAlignment sizeAndAlignment; - getNaturalSizeAndAlignment( - m_targetProgram->getOptionSet(), - ptrType->getValueType(), - &sizeAndAlignment); + if (auto alignedAttr = inst->findAttr<IRAlignedAttr>()) + { + sizeAndAlignment.alignment = (int)getIntVal(alignedAttr->getAlignment()); + } + else + { + getNaturalSizeAndAlignment( + m_targetProgram->getOptionSet(), + ptrType->getValueType(), + &sizeAndAlignment); + } return emitOpLoadAligned( parent, inst, @@ -5999,10 +6006,17 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex SpvStorageClassPhysicalStorageBuffer) { IRSizeAndAlignment sizeAndAlignment; - getNaturalSizeAndAlignment( - m_targetProgram->getOptionSet(), - ptrType->getValueType(), - &sizeAndAlignment); + if (auto alignedAttr = inst->findAttr<IRAlignedAttr>()) + { + sizeAndAlignment.alignment = (int)getIntVal(alignedAttr->getAlignment()); + } + else + { + getNaturalSizeAndAlignment( + m_targetProgram->getOptionSet(), + ptrType->getValueType(), + &sizeAndAlignment); + } return emitOpStoreAligned( parent, inst, |
