-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[SPIRV] Support for the extension SPV_ALTERA_blocking_pipes #138675
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 all commits
Commits
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
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
98 changes: 98 additions & 0 deletions
98
llvm/test/CodeGen/SPIRV/extensions/SPV_ALTERA_blocking_pipes/PipeBlocking.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,98 @@ | ||
| ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_ALTERA_blocking_pipes %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV | ||
| ; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_ALTERA_blocking_pipes %s -o - -filetype=obj | spirv-val %} | ||
|
|
||
| %opencl.pipe_ro_t = type opaque | ||
| %opencl.pipe_wo_t = type opaque | ||
|
|
||
| ; CHECK-SPIRV: OpCapability BlockingPipesALTERA | ||
| ; CHECK-SPIRV: OpExtension "SPV_ALTERA_blocking_pipes" | ||
| ; CHECK-SPIRV: %[[PipeRTy:[0-9]+]] = OpTypePipe ReadOnly | ||
| ; CHECK-SPIRV: %[[PipeWTy:[0-9]+]] = OpTypePipe WriteOnly | ||
| ; CHECK-SPIRV: %[[PipeR1:[0-9]+]] = OpLoad %[[PipeRTy]] %[[#]] Aligned 8 | ||
| ; CHECK-SPIRV: OpReadPipeBlockingALTERA %[[PipeR1]] %[[#]] %[[#]] %[[#]] | ||
| ; CHECK-SPIRV: %[[PipeR2:[0-9]+]] = OpLoad %[[PipeRTy]] %[[#]] Aligned 8 | ||
| ; CHECK-SPIRV: OpReadPipeBlockingALTERA %[[PipeR2]] %[[#]] %[[#]] %[[#]] | ||
| ; CHECK-SPIRV: %[[PipeW1:[0-9]+]] = OpLoad %[[PipeWTy]] %[[#]] Aligned 8 | ||
| ; CHECK-SPIRV: OpWritePipeBlockingALTERA %[[PipeW1]] %[[#]] %[[#]] %[[#]] | ||
| ; CHECK-SPIRV: %[[PipeW2:[0-9]+]] = OpLoad %[[PipeWTy]] %[[#]] Aligned 8 | ||
| ; CHECK-SPIRV: OpWritePipeBlockingALTERA %[[PipeW2]] %[[#]] %[[#]] %[[#]] | ||
|
|
||
| define spir_func void @foo(target("spirv.Pipe", 0) %p, ptr addrspace(1) %ptr) { | ||
| entry: | ||
| %p.addr = alloca target("spirv.Pipe", 0), align 8 | ||
| %ptr.addr = alloca ptr addrspace(1), align 8 | ||
| store target("spirv.Pipe", 0) %p, target("spirv.Pipe", 0)* %p.addr, align 8 | ||
| store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 | ||
| %0 = load target("spirv.Pipe", 0), target("spirv.Pipe", 0)* %p.addr, align 8 | ||
| %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 | ||
| %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) | ||
| call spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePiii(target("spirv.Pipe", 0) %0, ptr addrspace(4) %2, i32 4, i32 4) | ||
| ret void | ||
| } | ||
|
|
||
| declare dso_local spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePiii(target("spirv.Pipe", 0), ptr addrspace(4), i32, i32) | ||
|
|
||
| define spir_func void @bar(target("spirv.Pipe", 0) %p, ptr addrspace(1) %ptr) { | ||
| entry: | ||
| %p.addr = alloca target("spirv.Pipe", 0), align 8 | ||
| %ptr.addr = alloca ptr addrspace(1), align 8 | ||
| store target("spirv.Pipe", 0) %p, target("spirv.Pipe", 0)* %p.addr, align 8 | ||
| store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 | ||
| %0 = load target("spirv.Pipe", 0), target("spirv.Pipe", 0)* %p.addr, align 8 | ||
| %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 | ||
| %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) | ||
| call spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePvii(target("spirv.Pipe", 0) %0, ptr addrspace(4) %2, i32 4, i32 4) | ||
| ret void | ||
| } | ||
|
|
||
| declare dso_local spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePvii(target("spirv.Pipe", 0), ptr addrspace(4), i32, i32) | ||
|
|
||
| define spir_func void @boo(target("spirv.Pipe", 1) %p, ptr addrspace(1) %ptr) { | ||
| entry: | ||
| %p.addr = alloca target("spirv.Pipe", 1), align 8 | ||
| %ptr.addr = alloca ptr addrspace(1), align 8 | ||
| store target("spirv.Pipe", 1) %p, target("spirv.Pipe", 1)* %p.addr, align 8 | ||
| store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 | ||
| %0 = load target("spirv.Pipe", 1), target("spirv.Pipe", 1)* %p.addr, align 8 | ||
| %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 | ||
| %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) | ||
| call spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePiii(target("spirv.Pipe", 1) %0, ptr addrspace(4) %2, i32 4, i32 4) | ||
| ret void | ||
| } | ||
|
|
||
| declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePiii(target("spirv.Pipe", 1), ptr addrspace(4), i32, i32) | ||
|
|
||
| define spir_func void @baz(target("spirv.Pipe", 1) %p, ptr addrspace(1) %ptr) { | ||
| entry: | ||
| %p.addr = alloca target("spirv.Pipe", 1), align 8 | ||
| %ptr.addr = alloca ptr addrspace(1), align 8 | ||
| store target("spirv.Pipe", 1) %p, target("spirv.Pipe", 1)* %p.addr, align 8 | ||
| store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 | ||
| %0 = load target("spirv.Pipe", 1), target("spirv.Pipe", 1)* %p.addr, align 8 | ||
| %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 | ||
| %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) | ||
| call spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePvii(target("spirv.Pipe", 1) %0, ptr addrspace(4) %2, i32 4, i32 4) | ||
| ret void | ||
| } | ||
|
|
||
| declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePvii(target("spirv.Pipe", 1), ptr addrspace(4), i32, i32) | ||
|
|
||
| ; CHECK-LLVM: declare spir_func void @__read_pipe_2_bl(ptr addrspace(1), ptr addrspace(4), i32, i32) | ||
| ; CHECK-LLVM: declare spir_func void @__write_pipe_2_bl(ptr addrspace(1), ptr addrspace(4), i32, i32) | ||
|
|
||
| define linkonce_odr dso_local spir_func void @WritePipeBLockingi9Pointer(ptr addrspace(4) align 2 dereferenceable(2) %_Data) { | ||
| entry: | ||
| %_Data.addr = alloca ptr addrspace(4), align 8 | ||
| %_WPipe = alloca target("spirv.Pipe", 1), align 8 | ||
| %_Data.addr.ascast = addrspacecast ptr %_Data.addr to ptr addrspace(4) | ||
| %_WPipe.ascast = addrspacecast target("spirv.Pipe", 1)* %_WPipe to target("spirv.Pipe", 1) addrspace(4)* | ||
| store ptr addrspace(4) %_Data, ptr addrspace(4) %_Data.addr.ascast, align 8 | ||
| %0 = bitcast target("spirv.Pipe", 1)* %_WPipe to ptr | ||
| %1 = load target("spirv.Pipe", 1), target("spirv.Pipe", 1) addrspace(4)* %_WPipe.ascast, align 8 | ||
| %2 = load ptr addrspace(4), ptr addrspace(4) %_Data.addr.ascast, align 8 | ||
| call spir_func void @_Z30__spirv_WritePipeBlockingINTELIDU9_Ev8ocl_pipePKT_ii(target("spirv.Pipe", 1) %1, ptr addrspace(4) %2, i32 2, i32 2) | ||
| ret void | ||
| } | ||
|
|
||
| declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIDU9_Ev8ocl_pipePKT_ii(target("spirv.Pipe", 1), ptr addrspace(4), i32, i32) | ||
|
|
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
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.
@kuhar apologies, I haven't realized, that renaming affects existing MLIR flow before merging. Would it cause any issues?
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.
I don't know if this affects anything, but in general MLIR changes are better submitted separately as we don't share code paths with the spirv llvm backend