forked from KhronosGroup/SPIRV-LLVM-Translator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update decorations for global variables
This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: * Capability names and a new capability was added * Values for decorations have been updated to enums * Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
- Loading branch information
Showing
12 changed files
with
194 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
51b106461707f46d962554efe1bf56dee28958a3 | ||
b8b9eb8640c8c0107ba580fbcb10f969022ca32c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
test/extensions/INTEL/SPV_INTEL_global_variable_host_access/global_var_host_access.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
; RUN: llvm-as %s -o %t.bc | ||
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_global_variable_host_access -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" | ||
|
||
@int_var = addrspace(1) global i32 42, !spirv.Decorations !1 | ||
@bool_var = addrspace(1) global i1 0, !spirv.Decorations !4 | ||
|
||
; CHECK-SPIRV: Capability GlobalVariableHostAccessINTEL | ||
; CHECK-SPIRV: Extension "SPV_INTEL_global_variable_host_access" | ||
; CHECK-SPIRV: Decorate [[#INT_VAR_ID:]] HostAccessINTEL 1 "IntVarName" | ||
; CHECK-SPIRV: Decorate [[#BOOL_VAR_ID:]] HostAccessINTEL 3 "BoolVarName" | ||
|
||
; 5 is a global storage | ||
; CHECK-SPIRV: Variable [[#]] [[#INT_VAR_ID]] 5 | ||
; CHECK-SPIRV: Variable [[#]] [[#BOOL_VAR_ID]] 5 | ||
|
||
!1 = !{!2} | ||
!2 = !{i32 6168, i32 1, !"IntVarName"} ; HostAccessINTEL 1 "IntVarName" | ||
!3 = !{i32 6168, i32 3, !"BoolVarName"} ; HostAccessINTEL 3 "BoolVarName" | ||
!4 = !{!3} | ||
|
||
; CHECK-SPV-IR: @int_var = addrspace(1) global i32 42, !spirv.Decorations ![[#INT_VAR_DEC:]] | ||
; CHECK-SPV-IR: @bool_var = addrspace(1) global i1 false, !spirv.Decorations ![[#BOOL_VAR_DEC:]] | ||
|
||
; CHECK-SPV-IR: ![[#INT_VAR_DEC]] = !{![[#]], ![[#MD_HOST_ACCESS_INTVAR:]]} | ||
; CHECK-SPV-IR: ![[#MD_HOST_ACCESS_INTVAR]] = !{i32 6168, i32 1, !"IntVarName"} | ||
; CHECK-SPV-IR: ![[#BOOL_VAR_DEC]] = !{![[#]], ![[#MD_HOST_ACCESS_BOOLVAR:]]} | ||
; CHECK-SPV-IR: ![[#MD_HOST_ACCESS_BOOLVAR]] = !{i32 6168, i32 3, !"BoolVarName"} | ||
|
||
; CHECK-LLVM-NOT: @int_var = {{.*}}, !spirv.Decorations ![[#]] | ||
; CHECK-LLVM-NOT: @bool_var = {{.*}}, !spirv.Decorations ![[#]] | ||
|
||
; CHECK-LLVM: @int_var = addrspace(1) global i32 42 | ||
; CHECK-LLVM: @bool_var = addrspace(1) global i1 false |
Oops, something went wrong.