-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize mem fence passing to barrier in runtime if necessary
If a flag passed to ControlBarrier or MemoryBarrier is being initialized in runtime - don't lose it's initialization. Signed-off-by: Dmitry Sidorov <[email protected]>
- Loading branch information
Showing
5 changed files
with
190 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
119734787 65536 393230 10 0 | ||
2 Capability Addresses | ||
2 Capability Linkage | ||
2 Capability Kernel | ||
5 ExtInstImport 1 "OpenCL.std" | ||
3 MemoryModel 1 2 | ||
3 Source 3 102000 | ||
4 Name 5 "test" | ||
3 Name 6 "val" | ||
4 Name 7 "entry" | ||
6 Decorate 5 LinkageAttributes "test" Export | ||
4 TypeInt 3 32 0 | ||
4 Constant 3 8 2 | ||
2 TypeVoid 2 | ||
4 TypeFunction 4 2 3 | ||
|
||
5 Function 2 5 0 4 | ||
3 FunctionParameter 3 6 | ||
|
||
2 Label 7 | ||
4 ControlBarrier 8 8 6 | ||
1 Return | ||
|
||
1 FunctionEnd | ||
|
||
; RUN: llvm-spirv %s -to-binary -o %t.spv | ||
; RUN: spirv-val %t.spv | ||
; RUN: llvm-spirv -r %t.spv -o %t.bc | ||
; RUN: llvm-dis < %t.bc | FileCheck %s | ||
|
||
; CHECK: define spir_func void @test(i32 %val) | ||
; CHECK: %call = call spir_func i32 @__translate_spirv_memory_fence(i32 %val) | ||
; CHECK: call spir_func void @_Z7barrierj(i32 %call) | ||
; CHECK: define private spir_func i32 @__translate_spirv_memory_fence(i32 %key) | ||
; CHECK: entry: | ||
; CHECK: switch i32 %key, label %default [ | ||
; CHECK: i32 256, label %case.256 | ||
; CHECK: i32 512, label %case.512 | ||
; CHECK: i32 768, label %case.768 | ||
; CHECK: i32 2048, label %case.2048 | ||
; CHECK: i32 2304, label %case.2304 | ||
; CHECK: i32 2560, label %case.2560 | ||
; CHECK: i32 2816, label %case.2816 | ||
; CHECK: ] | ||
; CHECK: default: | ||
; CHECK: unreachable | ||
; CHECK: case.256: | ||
; CHECK: ret i32 1 | ||
; CHECK: case.512: | ||
; CHECK: ret i32 2 | ||
; CHECK: case.768: | ||
; CHECK: ret i32 3 | ||
; CHECK: case.2048: | ||
; CHECK: ret i32 4 | ||
; CHECK: case.2304: | ||
; CHECK: ret i32 5 | ||
; CHECK: case.2560: | ||
; CHECK: ret i32 6 | ||
; CHECK: case.2816: | ||
; CHECK: ret i32 7 | ||
; CHECK: } | ||
; CHECK: declare spir_func void @_Z7barrierj(i32) |
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,62 @@ | ||
119734787 65536 393230 10 0 | ||
2 Capability Addresses | ||
2 Capability Linkage | ||
2 Capability Kernel | ||
5 ExtInstImport 1 "OpenCL.std" | ||
3 MemoryModel 1 2 | ||
3 Source 3 102000 | ||
4 Name 5 "test" | ||
3 Name 6 "val" | ||
4 Name 7 "entry" | ||
6 Decorate 5 LinkageAttributes "test" Export | ||
4 TypeInt 3 32 0 | ||
4 Constant 3 8 2 | ||
2 TypeVoid 2 | ||
4 TypeFunction 4 2 3 | ||
|
||
5 Function 2 5 0 4 | ||
3 FunctionParameter 3 6 | ||
|
||
2 Label 7 | ||
3 MemoryBarrier 8 6 | ||
1 Return | ||
|
||
1 FunctionEnd | ||
|
||
; RUN: llvm-spirv %s -to-binary -o %t.spv | ||
; RUN: spirv-val %t.spv | ||
; RUN: llvm-spirv -r %t.spv -o %t.bc | ||
; RUN: llvm-dis < %t.bc | FileCheck %s | ||
|
||
; CHECK: define spir_func void @test(i32 %val) | ||
; CHECK: %call = call spir_func i32 @__translate_spirv_memory_fence(i32 %val) | ||
; CHECK: call spir_func void @_Z9mem_fencej(i32 %call) | ||
; CHECK: define private spir_func i32 @__translate_spirv_memory_fence(i32 %key) | ||
; CHECK: entry: | ||
; CHECK: switch i32 %key, label %default [ | ||
; CHECK: i32 256, label %case.256 | ||
; CHECK: i32 512, label %case.512 | ||
; CHECK: i32 768, label %case.768 | ||
; CHECK: i32 2048, label %case.2048 | ||
; CHECK: i32 2304, label %case.2304 | ||
; CHECK: i32 2560, label %case.2560 | ||
; CHECK: i32 2816, label %case.2816 | ||
; CHECK: ] | ||
; CHECK: default: | ||
; CHECK: unreachable | ||
; CHECK: case.256: | ||
; CHECK: ret i32 1 | ||
; CHECK: case.512: | ||
; CHECK: ret i32 2 | ||
; CHECK: case.768: | ||
; CHECK: ret i32 3 | ||
; CHECK: case.2048: | ||
; CHECK: ret i32 4 | ||
; CHECK: case.2304: | ||
; CHECK: ret i32 5 | ||
; CHECK: case.2560: | ||
; CHECK: ret i32 6 | ||
; CHECK: case.2816: | ||
; CHECK: ret i32 7 | ||
; CHECK: } | ||
; CHECK: declare spir_func void @_Z9mem_fencej(i32) |