Dependencies
This extension is written against the SPIR-V Specification, Version 1.6 Revision 7.
This extension requires SPIR-V 1.2.
Overview
This extension adds AliasDomainDeclINTEL, AliasScopeDeclINTEL and AliasScopeListDeclINTEL instructions that serve a purpose to specify aliasing scopes within which annotated memory accesses don’t alias. Also the extension adds AliasScopeINTEL and NoAliasINTEL decorations and Memory Operands mask to annotate memory access instructions. The decorations and Memory Operands value use result IDs of the new instructions to specify noalias memory-access set.
When evaluating an aliasing query if two memory access instructions that have AliasScopeINTEL or NoAliasINTEL memory operands or decorated with AliasScopeINTEL or NoAliasINTEL decorations and if for some domain, the set of scopes with that domain in one instruction’s aliasing scope list is a subset of (or equal to) the set of scopes for that domain in another instruction’s noalias list, then the two memory accesses are assumed not to alias. If this assumption is violated in runtime - the behaviour is undefined.
The extension helps generating more efficient code (for example helps auto-vectorization) and doesn’t affect semantics of the user’s program.
This functionality is equal to LLVM’s alias.scope and noalias metadata, see: https://llvm.org/docs/LangRef.html#noalias-and-alias-scope-metadata .
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_INTEL_memory_access_aliasing"
Modifications to the SPIR-V Specification, Version 1.6
Capabilities
Modify Section 3.2.30, "Capability", adding these rows to the Capability table:
| Capability | Depends On | |
|---|---|---|
5910 |
MemoryAccessAliasingINTEL |
|
Instructions
Modify Section 3.3.3, "Annotation Instructions", adding to the end of the list of instructions:
OpAliasDomainDeclINTEL The Result is used by OpAliasScopeDeclINTEL instruction to form aliasing scope. |
Capability: MemoryAccessAliasingINTEL |
|
2 |
5911 |
<id> Result |
OpAliasScopeDeclINTEL The Result is used by OpAliasScopeListDeclINTEL instruction to form aliasing scope list. <id> AliasDomain parameter specifies aliasing domain within this aliasing scope, it must be the result id of OpAliasDomainDeclINTEL instruction. |
Capability: MemoryAccessAliasingINTEL |
||
3 |
5912 |
<id> Result |
<id> AliasDomain |
OpAliasScopeListDeclINTEL The Result is used by AliasScopeINTEL and NoAliasINTEL decorations and AliasScopeINTEL and NoAliasINTEL memory operands. <id> AliasScope1, … , <id> AliasScopeN parameters specifies aliasing scopes that form aliasing list of scopes, it must be the result id of OpAliasScopeDeclINTEL. |
Capability: MemoryAccessAliasingINTEL |
||
3+ |
5913 |
<id> Result |
<id> AliasScope1, <id> AliasScope2, … , <id> AliasScopeN |
Decorations
Modify Section 3.2.19 "Decoration", adding these rows to Decoration table:
| Decoration | Extra Operands | Enabling Capabilities | ||
|---|---|---|---|---|
5914 |
AliasScopeINTEL |
<id> Aliasing Scopes List |
MemoryAccessAliasingINTEL |
|
5915 |
NoAliasINTEL |
<id> Aliasing Scopes List |
MemoryAccessAliasingINTEL |
|
Annotation Instructions
Modify Section 3.3.3, "Annotation Instructions", in the description of OpDecorateId, replacing:
"All such <id> Extra Operands must be constant instructions or OpVariable instructions."
with:
"All such <id> Extra Operands must be constant instructions or OpVariable instructions, except for the AliasScopeINTEL and NoAliasINTEL decorations, whose <id> Extra Operand must be an OpAliasScopeListDeclINTEL instruction."
Memory Operands
Modify Section 3.2.25 "Memory Operands", adding these rows to Memory Operands table:
| Memory Operands | Extra Operands | Enabling Capabilities | |
|---|---|---|---|
0x10000 |
AliasScopeINTEL |
<id> Aliasing Scopes List |
MemoryAccessAliasingINTEL |
0x20000 |
NoAliasINTEL |
<id> Aliasing Scopes List |
MemoryAccessAliasingINTEL |