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

Can apply MemoryINTEL annotation multiple times on same variable #2230

Merged
merged 8 commits into from
Nov 30, 2023

Conversation

artemrad
Copy link
Contributor

@artemrad artemrad commented Nov 21, 2023

According to SPIRV spec only one instance of a specific decoration can be on a SPIRV-Id, unless the decoration explicitly allows it.

LLVM IR has no such limitation.

MemoryINTEL can have two annotations on the same pointer in LLVM IR. When it comes to translating this to SPIRV, we can filter out the less precise annotation (DEFAULT) and only keep one that will be translated to a SPIRV decoration.

@CLAassistant
Copy link

CLAassistant commented Nov 21, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@vmaksimo vmaksimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change itself looks ok, but we need tests to verify.

The main concern is that specification does not mention that we allow MemoryINTEL decoration several times. Is it a planned change to the spec?

@artemrad artemrad marked this pull request as ready for review November 28, 2023 22:49
Copy link
Contributor

@vmaksimo vmaksimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Please address comments and change the title and the description - we actually don't apply MemoryINTEL decoration twice or multiple times

Comment on lines 33 to 39
; CHECK-SPV-IR: [[empty_annot:]] = private unnamed_addr constant [17 x i8] c"{memory:DEFAULT}\00", align 1
; CHECK-SPV-IR: [[mlab_annot:]] = private unnamed_addr constant [14 x i8] c"{memory:MLAB}\00", align 1
; CHECK-SPV-IR: [[block_ram_annot:]] = private unnamed_addr constant [19 x i8] c"{memory:BLOCK_RAM}\00", align 1

; CHECK-LLVM: [[empty_annot:]] = private unnamed_addr constant [17 x i8] c"{memory:DEFAULT}\00", align 1
; CHECK-LLVM: [[mlab_annot:]] = private unnamed_addr constant [14 x i8] c"{memory:MLAB}\00", align 1
; CHECK-LLVM: [[block_ram_annot:]] = private unnamed_addr constant [19 x i8] c"{memory:BLOCK_RAM}\00", align 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These checks are basically the same, I guess we can have only one tag (e.g., CHECK-LLVM) and check it for both reverse runs. Same for the IR below

Comment on lines 17 to 19
; CHECK-SPIRV: Decorate [[#empty:]] MemoryINTEL "DEFAULT"
; CHECK-SPIRV: Decorate [[#mlab:]] MemoryINTEL "MLAB"
; CHECK-SPIRV: Decorate [[#block_ram:]] MemoryINTEL "BLOCK_RAM"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I ask you to add checks that prove that we don't generate "DEFAULT" more than once?

@artemrad artemrad changed the title DRAFT: Can apply MemoryINTEL decoration multiple times on same variable Can apply MemoryINTEL annotation multiple times on same variable Nov 29, 2023
lib/SPIRV/SPIRVWriter.cpp Outdated Show resolved Hide resolved
Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
@MrSidims MrSidims merged commit ff48393 into KhronosGroup:main Nov 30, 2023
9 checks passed
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

Successfully merging this pull request may close these issues.

4 participants