-
Notifications
You must be signed in to change notification settings - Fork 228
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
Translate nonsemantic attribute and metadata of GlobalVariable #2944
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
56 changes: 56 additions & 0 deletions
56
test/extensions/KHR/SPV_KHR_non_semantic_info/preserve-gv-attributes.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,56 @@ | ||
; RUN: llvm-as < %s -o %t.bc | ||
; RUN: not llvm-spirv %t.bc -spirv-text --spirv-preserve-auxdata --spirv-max-version=1.5 --spirv-ext=-SPV_KHR_non_semantic_info,+SPV_INTEL_global_variable_decorations -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SPIRV-EXT-DISABLED | ||
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-preserve-auxdata --spirv-max-version=1.5 --spirv-ext=+SPV_INTEL_global_variable_decorations | ||
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-EXT | ||
; RUN: llvm-spirv -r --spirv-preserve-auxdata %t.spv -o %t.rev.bc | ||
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
; RUN: llvm-spirv -r %t.spv -o %t.rev.without.bc | ||
; RUN: llvm-dis %t.rev.without.bc -o - | FileCheck %s --implicit-check-not="{{foo|bar|baz}}" | ||
|
||
; RUN: llvm-spirv %t.bc -spirv-text --spirv-preserve-auxdata --spirv-ext=+SPV_KHR_non_semantic_info,+SPV_INTEL_global_variable_decorations -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NOEXT | ||
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-preserve-auxdata --spirv-ext=+SPV_INTEL_global_variable_decorations | ||
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NOEXT | ||
; RUN: llvm-spirv -r --spirv-preserve-auxdata %t.spv -o %t.rev.bc | ||
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
; RUN: llvm-spirv -r %t.spv -o %t.rev.without.bc | ||
; RUN: llvm-dis %t.rev.without.bc -o - | FileCheck %s --implicit-check-not="{{foo|bar|baz}}" | ||
|
||
; Check SPIR-V versions in a format magic number + version | ||
; CHECK-SPIRV-EXT: 119734787 65536 | ||
; CHECK-SPIRV-EXT: Extension "SPV_KHR_non_semantic_info" | ||
; CHECK-SPIRV-NOEXT: 119734787 67072 | ||
|
||
; CHECK-SPIRV: ExtInstImport [[#Import:]] "NonSemantic.AuxData" | ||
|
||
; CHECK-SPIRV: String [[#Attr0LHS:]] "sycl-device-global-size" | ||
; CHECK-SPIRV: String [[#Attr0RHS:]] "32" | ||
; CHECK-SPIRV: String [[#Attr1:]] "sycl-device-image-scope" | ||
; CHECK-SPIRV: String [[#Attr2LHS:]] "sycl-host-access" | ||
; CHECK-SPIRV: String [[#Attr2RHS:]] "0" | ||
; CHECK-SPIRV: String [[#Attr3LHS:]] "sycl-unique-id" | ||
; CHECK-SPIRV: String [[#Attr3RHS:]] "_Z20__AsanKernelMetadata" | ||
|
||
; CHECK-SPIRV: Name [[#GVName:]] "__AsanKernelMetadata" | ||
|
||
; CHECK-SPIRV: TypeVoid [[#VoidT:]] | ||
|
||
; CHECK-SPIRV: ExtInst [[#VoidT]] [[#Attr0Inst:]] [[#Import]] NonSemanticAuxDataGlobalVariableAttribute [[#GVName]] [[#Attr0LHS]] [[#Attr0RHS]] {{$}} | ||
; CHECK-SPIRV: ExtInst [[#VoidT]] [[#Attr1Inst:]] [[#Import]] NonSemanticAuxDataGlobalVariableAttribute [[#GVName]] [[#Attr1]] {{$}} | ||
; CHECK-SPIRV: ExtInst [[#VoidT]] [[#Attr1Inst:]] [[#Import]] NonSemanticAuxDataGlobalVariableAttribute [[#GVName]] [[#Attr2LHS]] [[#Attr2RHS]] {{$}} | ||
; CHECK-SPIRV: ExtInst [[#VoidT]] [[#Attr1Inst:]] [[#Import]] NonSemanticAuxDataGlobalVariableAttribute [[#GVName]] [[#Attr3LHS]] [[#Attr3RHS]] {{$}} | ||
|
||
target triple = "spir64-unknown-unknown" | ||
|
||
; CHECK-LLVM: @__AsanKernelMetadata = addrspace(1) global [1 x %structtype] [%structtype { i64 0, i64 92 }] #[[#GVIRAttr:]] | ||
%structtype = type { i64, i64 } | ||
|
||
@__AsanKernelMetadata = addrspace(1) global [1 x %structtype] [%structtype { i64 ptrtoint (ptr addrspace(2) null to i64), i64 92 }], !spirv.Decorations !0 #0 | ||
|
||
; CHECK-LLVM: attributes #[[#GVIRAttr]] = { "sycl-device-global-size"="32" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="_Z20__AsanKernelMetadata" } | ||
attributes #0 = { "sycl-device-global-size"="32" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="_Z20__AsanKernelMetadata" } | ||
|
||
!0 = !{!1} | ||
!1 = !{i32 6147, i32 0, !"_Z20__AsanKernelMetadata"} | ||
|
||
; CHECK-SPIRV-EXT-DISABLED: RequiresExtension: Feature requires the following SPIR-V extension: | ||
; CHECK-SPIRV-EXT-DISABLED-NEXT: SPV_KHR_non_semantic_info |
41 changes: 41 additions & 0 deletions
41
test/extensions/KHR/SPV_KHR_non_semantic_info/preserve-gv-metadata.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,41 @@ | ||
; RUN: llvm-as < %s -o %t.bc | ||
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-preserve-auxdata --spirv-max-version=1.5 | ||
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-EXT | ||
; RUN: llvm-spirv -r --spirv-preserve-auxdata %t.spv -o %t.rev.bc | ||
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
; RUN: llvm-spirv -r %t.spv -o %t.rev.without.bc | ||
; RUN: llvm-dis %t.rev.without.bc -o - | FileCheck %s --implicit-check-not="{{foo|bar|baz}}" | ||
|
||
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-preserve-auxdata | ||
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NOEXT | ||
; RUN: llvm-spirv -r --spirv-preserve-auxdata %t.spv -o %t.rev.bc | ||
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
; RUN: llvm-spirv -r %t.spv -o %t.rev.without.bc | ||
; RUN: llvm-dis %t.rev.without.bc -o - | FileCheck %s --implicit-check-not="{{foo|bar|baz}}" | ||
|
||
; Check SPIR-V versions in a format magic number + version | ||
; CHECK-SPIRV-EXT: 119734787 65536 | ||
; CHECK-SPIRV-EXT: Extension "SPV_KHR_non_semantic_info" | ||
; CHECK-SPIRV-NOEXT: 119734787 67072 | ||
|
||
; CHECK-SPIRV: ExtInstImport [[#Import:]] "NonSemantic.AuxData" | ||
|
||
; CHECK-SPIRV: String [[#MDName:]] "absolute_symbol" | ||
|
||
; CHECK-SPIRV: Name [[#GVName:]] "a" | ||
|
||
; CHECK-SPIRV: TypeInt [[#Int32T:]] 64 0 | ||
; CHECK-SPIRV: Constant [[#Int32T]] [[#MDValue0:]] 0 | ||
; CHECK-SPIRV: Constant [[#Int32T]] [[#MDValue1:]] 16 | ||
|
||
; CHECK-SPIRV: TypeVoid [[#VoidT:]] | ||
|
||
; CHECK-SPIRV: ExtInst [[#VoidT]] [[#ValInst:]] [[#Import]] NonSemanticAuxDataGlobalVariableMetadata [[#GVName]] [[#MDName]] [[#MDValue0]] [[#MDValue1]] {{$}} | ||
|
||
target triple = "spir64-unknown-unknown" | ||
|
||
; CHECK-LLVM: @a = external addrspace(1) global i8, !absolute_symbol ![[#LLVMVal:]] | ||
@a = external addrspace(1) global i8, !absolute_symbol !0 | ||
|
||
; CHECK-LLVM: ![[#LLVMVal]] = !{i64 0, i64 16} | ||
!0 = !{i64 0, i64 16} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
PreserveCount
is (and has been previously) unused it should be probably deleted entirely. Otherwise, this line introduces a concern about binary incompatibility due to changingPreserveCount
's value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted. It is unused.