-
Notifications
You must be signed in to change notification settings - Fork 273
Support SPV_INTEL_non_constant_addrspace_printf #1364
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
919bf30
Support SPV_INTEL_non_constant_addrspace_printf
KornevNikita 48e04cf
Fix clang-format
KornevNikita d536ccc
Update opcode
KornevNikita 3acbfb9
Apply suggestion
KornevNikita 5457fbb
Fix reverse
KornevNikita f7f2247
Fix clang format
KornevNikita 8e421f5
Fix lit
KornevNikita ecdd28c
Fix out-of-tree warning
KornevNikita 3a11614
Merge branch 'master' into printf
KornevNikita 20afae4
Disable OCL mangling
KornevNikita dfd0989
Fix test
KornevNikita 39db81d
Apply suggestion
KornevNikita 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
92 changes: 92 additions & 0 deletions
92
test/transcoding/SPV_INTEL_non_constant_addrspace_printf/non-constant-printf.ll
This file contains hidden or 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,92 @@ | ||
| ; RUN: llvm-as %s -o %t.bc | ||
| ; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s --check-prefix=CHECK-WO-EXT | ||
|
|
||
| ; RUN: llvm-spirv -spirv-text %t.bc -o %t.spt --spirv-ext=+SPV_INTEL_non_constant_addrspace_printf | ||
| ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV | ||
|
|
||
| ; RUN: llvm-spirv -to-binary %t.spt -o %t.spv | ||
| ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc | ||
| ; RUN: llvm-dis %t.rev.bc -o %t.rev.ll | ||
| ; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM | ||
|
|
||
| ; CHECK-WO-EXT: RequiresExtension: Feature requires the following SPIR-V extension: | ||
| ; CHECK-WO-EXT: The SPV_INTEL_non_constant_addrspace_printf extension should be allowed to translate this module, because this LLVM module contains the printf function with format string, whose address space is not equal to 2 (constant). | ||
|
|
||
| ; CHECK-SPIRV: Capability NonConstantAddrspacePrintfINTEL | ||
| ; CHECK-SPIRV: Extension "SPV_INTEL_non_constant_addrspace_printf" | ||
| ; CHECK-SPIRV: ExtInstImport [[#ExtInstSetId:]] "OpenCL.std" | ||
| ; CHECK-SPIRV: TypeInt [[#TypeInt8Id:]] 8 0 | ||
| ; CHECK-SPIRV: TypeInt [[#TypeInt32Id:]] 32 0 | ||
| ; CHECK-SPIRV: TypePointer [[#FunctionStorClassPtrTy:]] 7 [[#TypeInt8Id]] | ||
| ; CHECK-SPIRV: TypePointer [[#WGStorClassPtrTy:]] 5 [[#TypeInt8Id]] | ||
| ; CHECK-SPIRV: TypePointer [[#CrossWFStorClassPtrTy:]] 4 [[#TypeInt8Id]] | ||
| ; CHECK-SPIRV: TypePointer [[#GenericStorCalssPtrTy:]] 8 [[#TypeInt8Id]] | ||
| ; CHECK-SPIRV: InBoundsPtrAccessChain [[#FunctionStorClassPtrTy]] [[#GEP1:]] | ||
| ; CHECK-SPIRV: ExtInst [[#TypeInt32Id]] [[#]] [[#ExtInstSetId:]] printf [[#GEP1]] | ||
| ; CHECK-SPIRV: InBoundsPtrAccessChain [[#WGStorClassPtrTy]] [[#GEP2:]] | ||
| ; CHECK-SPIRV: ExtInst [[#TypeInt32Id]] [[#]] [[#ExtInstSetId:]] printf [[#GEP2]] | ||
| ; CHECK-SPIRV: InBoundsPtrAccessChain [[#CrossWFStorClassPtrTy:]] [[#GEP3:]] | ||
| ; CHECK-SPIRV: ExtInst [[#TypeInt32Id]] [[#]] [[#ExtInstSetId:]] printf [[#GEP3]] | ||
| ; CHECK-SPIRV: InBoundsPtrAccessChain [[#GenericStorCalssPtrTy:]] [[#GEP4:]] | ||
| ; CHECK-SPIRV: ExtInst [[#TypeInt32Id]] [[#]] [[#ExtInstSetId:]] printf [[#GEP4]] | ||
|
|
||
| ; CHECK-LLVM: call spir_func i32 @_Z18__spirv_ocl_printfPc(i8* {{.*}} | ||
| ; CHECK-LLVM: call spir_func i32 @_Z18__spirv_ocl_printfPU3AS1c(i8 addrspace(1)* {{.*}} | ||
| ; CHECK-LLVM: call spir_func i32 @_Z18__spirv_ocl_printfPU3AS3c(i8 addrspace(3)* {{.*}} | ||
| ; CHECK-LLVM: call spir_func i32 @_Z18__spirv_ocl_printfPU3AS4c(i8 addrspace(4)* {{.*}} | ||
|
|
||
| ; CHECK-LLVM: declare spir_func i32 @_Z18__spirv_ocl_printfPc(i8*) | ||
| ; CHECK-LLVM: declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS1c(i8 addrspace(1)*) | ||
| ; CHECK-LLVM: declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS3c(i8 addrspace(3)*) | ||
| ; CHECK-LLVM: declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS4c(i8 addrspace(4)*) | ||
|
|
||
| ; ModuleID = 'non-constant-printf' | ||
| target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024" | ||
| target triple = "spir-unknown-unknown" | ||
|
|
||
| @0 = internal unnamed_addr addrspace(0) constant [6 x i8] c"Test\0A\00", align 1 | ||
| @1 = internal unnamed_addr addrspace(1) constant [6 x i8] c"Test\0A\00", align 1 | ||
| @2 = internal unnamed_addr addrspace(3) constant [6 x i8] c"Test\0A\00", align 1 | ||
| @3 = internal unnamed_addr addrspace(4) constant [6 x i8] c"Test\0A\00", align 1 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| define spir_kernel void @test() #0 !kernel_arg_addr_space !3 !kernel_arg_access_qual !3 !kernel_arg_type !3 !kernel_arg_type_qual !3 !kernel_arg_base_type !3 { | ||
| %1 = getelementptr inbounds [6 x i8], [6 x i8]* @0, i32 0, i32 0 | ||
| %2 = call spir_func i32 @_Z18__spirv_ocl_printfPc(i8* %1) #0 | ||
| %3 = getelementptr inbounds [6 x i8], [6 x i8] addrspace(1)* @1, i32 0, i32 0 | ||
| %4 = call spir_func i32 @_Z18__spirv_ocl_printfPU3AS1c(i8 addrspace(1)* %3) #0 | ||
| %5 = getelementptr inbounds [6 x i8], [6 x i8] addrspace(3)* @2, i32 0, i32 0 | ||
| %6 = call spir_func i32 @_Z18__spirv_ocl_printfPU3AS3c(i8 addrspace(3)* %5) #0 | ||
| %7 = getelementptr inbounds [6 x i8], [6 x i8] addrspace(4)* @3, i32 0, i32 0 | ||
| %8 = call spir_func i32 @_Z18__spirv_ocl_printfPU3AS4c(i8 addrspace(4)* %7) #0 | ||
| ret void | ||
| } | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare spir_func i32 @_Z18__spirv_ocl_printfPc(i8*) #0 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS1c(i8 addrspace(1)*) #0 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS3c(i8 addrspace(3)*) #0 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS4c(i8 addrspace(4)*) #0 | ||
|
|
||
| attributes #0 = { nounwind } | ||
|
|
||
| !spirv.MemoryModel = !{!0} | ||
| !opencl.enable.FP_CONTRACT = !{} | ||
| !spirv.Source = !{!1} | ||
| !opencl.spir.version = !{!2} | ||
| !opencl.ocl.version = !{!2} | ||
| !opencl.used.extensions = !{!3} | ||
| !opencl.used.optional.core.features = !{!3} | ||
| !spirv.Generator = !{!4} | ||
|
|
||
| !0 = !{i32 1, i32 2} | ||
| !1 = !{i32 3, i32 200000} | ||
| !2 = !{i32 2, i32 0} | ||
| !3 = !{} | ||
| !4 = !{i16 7, i16 0} | ||
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.
Uh oh!
There was an error while loading. Please reload this page.