Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligned decoration and its connection to Vulkan's Alignment Requirements #151

Open
nanokatze opened this issue Jun 27, 2022 · 2 comments
Open

Comments

@nanokatze
Copy link

Vulkan describes constraints on how types may be laid out in memory, in section 15.6.4. Offset and Stride Assignment, but then seems to not say anything about Load and Store operations that specify a lower alignment. Indeed, it seems that the only rules mentioning Aligned decoration are

VUID-StandaloneSpirv-PhysicalStorageBuffer64-04708
If the PhysicalStorageBuffer64 addressing model is enabled, all instructions that support memory access operands and that use a physical pointer must include the Aligned operand

and

VUID-RuntimeSpirv-PhysicalStorageBuffer64-06315
If the PhysicalStorageBuffer64 addressing model is enabled the pointer value of a memory access instruction must be at least as aligned as specified by the Aligned memory access operand.

Moreover, emitting Loads and Stores of int32 with Aligned value of 1 seems not to trip the validator, though I haven't tested whether misaligned loads and stores actually happen to work or not.

Thus far it appears to me that this is hole in the specification, and it would be nice to see it clarified and validator fixed.

@johnkslang
Copy link
Member

Regarding which specification, the SPIR-V specification says "Valid values are defined by the execution environment.", for the Aligned Memory Operand.

@nanokatze
Copy link
Author

nanokatze commented Jul 2, 2022

Yes, this is up to Vulkan specification to address (which is what the issue description talks about) but I wasn't sure whether the issue should be opened against this repo or Vulkan-Docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants