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

Headers support for new FPGAMemoryAttributesINTEL #384

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

bwlodarcz
Copy link
Contributor

Implementation of three new FPGAMemoryAttributesINTEL:

  • StridesizeINTEL
  • WordsizeINTEL
  • TrueDualPortIntel

Specification: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_fpga_memory_attributes.asciidoc

@CLAassistant
Copy link

CLAassistant commented Oct 12, 2023

CLA assistant check
All committers have signed the CLA.

Implementation of three new FPGAMemoryAttributesINTEL:
 - StridesizeINTEL
 - WordsizeINTEL
 - TrueDualPortIntel

Specification: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_fpga_memory_attributes.asciidoc
@MrSidims MrSidims requested a review from bashbaug October 13, 2023 12:42
@artemrad
Copy link

Can you please add a test to test these changes?
... oh look, I have one lying around how convenient.

llvm-spirv/test/extensions/INTEL/SPV_INTEL_fpga_memory_attributes/global_var_decorations.ll

; Tests whether FPGA decorations on global variables will properly interpreted by SPIRV
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_memory_attributes -o %t.spv
; RUN: llvm-spirv %t.spv -to-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o %t.rev.bc
; RUN: llvm-dis %t.rev.bc
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-SPV-IR; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis %t.rev.bc
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM; Expected to fail - the decorations require enabled extension to be translated.
; RUN: not llvm-spirv %t.bc -o %t.spv

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
target triple = "spir64-unknown-unknown"@char_var = addrspace(1) global i8 0, !spirv.Decorations !0

; CHECK-SPIRV: Capability FPGAMemoryAttributesINTEL
; CHECK-SPIRV: Extension "SPV_INTEL_fpga_memory_attributes"
; CHECK-SPIRV: Decorate [[#VAR_ID:]] RegisterINTEL 
; CHECK-SPIRV: Decorate [[#VAR_ID]] MemoryINTEL "DEFAULT" 
; CHECK-SPIRV: Decorate [[#VAR_ID]] NumbanksINTEL 4 
; CHECK-SPIRV: Decorate [[#VAR_ID]] MaxPrivateCopiesINTEL 3 
; CHECK-SPIRV: Decorate [[#VAR_ID]] SinglepumpINTEL 
; CHECK-SPIRV: Decorate [[#VAR_ID]] DoublepumpINTEL 
; CHECK-SPIRV: Decorate [[#VAR_ID]] MaxReplicatesINTEL 5 
; CHECK-SPIRV: Decorate [[#VAR_ID]] SimpleDualPortINTEL 
; CHECK-SPIRV: Decorate [[#VAR_ID]] ForcePow2DepthINTEL 0 
; CHECK-SPIRV: Decorate [[#VAR_ID]] StridesizeINTEL 0 
; CHECK-SPIRV: Decorate [[#VAR_ID]] WordsizeINTEL 0 
; CHECK-SPIRV: Decorate [[#VAR_ID]] TrueDualPortINTEL 0 
; 5 is a global storage
; CHECK-SPIRV: Variable [[#]] [[#VAR_ID]] 5

!0 = !{!1, !2, !3, !4, !5, !6, !7, !8, !9}
!1 = !{i32 5825}
!2 = !{i32 5826, !"DEFAULT"}
!3 = !{i32 5827, i32 4}
!4 = !{i32 5829, i32 3}
!5 = !{i32 5830}
!6 = !{i32 5831}
!7 = !{i32 5832, i32 5}
!8 = !{i32 5833}
!9 = !{i32 5836, i1 false}
!10 = !{i32 5883, i32 2}
!11 = !{i32 5884, i32 8}
!12 = !{i32 5885}
; CHECK-SPV-IR: @char_var = addrspace(1) global i8 0, !spirv.Decorations ![[#VAR_DEC:]]

; CHECK-SPV-IR: ![[#VAR_DEC]] = !{![[#]], ![[#RegisterINTEL:]], ![[#MemoryINTEL:]], ![[#NumbanksINTEL:]], ![[#MaxPrivateCopiesINTEL:]], ![[#SinglepumpINTEL:]], ![[#DoublepumpINTEL:]], ![[#MaxReplicatesINTEL:]], ![[#SimpleDualPortINTEL:]], ![[#ForcePow2DepthINTEL:]], ![[#StridesizeINTEL:]], ![[#WordsizeINTEL:]], ![[#TrueDualPortINTEL:]]}
; CHECK-SPV-IR: ![[#RegisterINTEL]] = !{i32 5825}
; CHECK-SPV-IR: ![[#MemoryINTEL]] = !{i32 5826, !"DEFAULT"}
; CHECK-SPV-IR: ![[#NumbanksINTEL]] = !{i32 5827, i32 4}
; CHECK-SPV-IR: ![[#MaxPrivateCopiesINTEL]] = !{i32 5829, i32 3}
; CHECK-SPV-IR: ![[#SinglepumpINTEL]] = !{i32 5830}
; CHECK-SPV-IR: ![[#DoublepumpINTEL]] = !{i32 5831}
; CHECK-SPV-IR: ![[#MaxReplicatesINTEL]] = !{i32 5832, i32 5}
; CHECK-SPV-IR: ![[#SimpleDualPortINTEL]] = !{i32 5833}
; CHECK-SPV-IR: ![[#ForcePow2DepthINTEL]] = !{i32 5836, i32 0}
; CHECK-SPV-IR: ![[#StridesizeINTEL]] = !{i32 5883, i32 2}
; CHECK-SPV-IR: ![[#WordsizeINTEL]] = !{i32 5884, i32 8}
; CHECK-SPV-IR: ![[#TrueDualPortINTEL]] = !{i32 5885}

; CHECK-LLVM-NOT: @char_var = {{.*}}, !spirv.Decorations ![[#]]

Copy link

@artemrad artemrad left a comment

Choose a reason for hiding this comment

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

See previous comment

@MrSidims
Copy link
Contributor

MrSidims commented Oct 13, 2023

@artemrad it's wrong repository, such tests (as well as the actual implementation) go to https://github.com/KhronosGroup/SPIRV-LLVM-Translator

@artemrad
Copy link

@artemrad it's wrong repository, such tests (as well as the actual implementation) go to https://github.com/KhronosGroup/SPIRV-LLVM-Translator

Apologies. I am new to SPIRV changes. @bwlodarcz please make sure that when you are adding the changes to KhronosGroup/SPIRV-LLVM-Translator to teach the translator about these decorations that you add the tests in that change. Thank you.

@bashbaug
Copy link
Contributor

Merging as discussed in the October 18th teleconference.

@bashbaug bashbaug merged commit 88bc5e3 into KhronosGroup:main Oct 18, 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.

5 participants