You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] What's the way to set OpMemoryModel ? #7180
Is your feature request related to a problem? Please describe.
When targetting below SPIR-V 1.5 the Vulkan memory model and BDA are extensions, and to function they require changes to the OpMemoryModel
Describe the solution you'd like
Compile flag (since its for the entire module) which lets us control OpMemoryModel
Additional context
For now it seems to just work, I wonder if in the presence of any capability requiring a change in OpMemoryModel DXC/SPIR-V Tools just declares ti correctly?
DXC relies on the UpgradeMemoryModelPass in spir-v tools to modify the code the use the Vulkan memory model. That pass does nothing unless the logical addressing model is used. In your examples, the pass does nothing, an invalid module is generated.
Sorakrit Chonwattanagul (@keptsecret) I'm looking into a fix for that. On your side, you need to modify your code a little to add a storage class to the atomic. I randomly picked one. You need to pick the correct one:
btw I've ran into limitations of not being able to codegen VMM directly before (being gatekept by the UpdateMemorModelPass - having the intial codegen happen in GLSL450 model)
Activity
devshgraphicsprogramming commentedon Jun 12, 2025
Steven Perron (@s-perron) I see that in 06da989 you added
-fspv_use_vulkan_memory_modelbut its not a recognised option anymore?https://godbolt.org/z/6rdheznWP
keptsecret commentedon Jun 12, 2025
Trying to use the memory semantic
spv::MemorySemanticsMakeAvailableMaskrequires memory model set to Vulkan (Vulkan KHR) as per the spec (https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_memory_model_2). Is there a way to set OpMemoryModel?See repro on godbolt: https://godbolt.org/z/edETTxq13
s-perron commentedon Jun 12, 2025
The option is
-fspv-use-vulkan-memory-model, but it does not seem to be setting the right memory model. I'll look into this.s-perron commentedon Jun 12, 2025
DXC relies on the
UpgradeMemoryModelPassin spir-v tools to modify the code the use the Vulkan memory model. That pass does nothing unless the logical addressing model is used. In your examples, the pass does nothing, an invalid module is generated.Sorakrit Chonwattanagul (@keptsecret) I'm looking into a fix for that. On your side, you need to modify your code a little to add a storage class to the atomic. I randomly picked one. You need to pick the correct one:
devshgraphicsprogramming commentedon Jul 3, 2025
btw I've ran into limitations of not being able to codegen VMM directly before (being gatekept by the UpdateMemorModelPass - having the intial codegen happen in GLSL450 model)
#7533