File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ if(SPIRV_TOOLS_FOUND)
15
15
set (SPIRV_TOOLS_SPIRV_AS_FOUND True )
16
16
endif ()
17
17
18
+ find_program (SPIRV_TOOLS_SPIRV_LINK NAMES spirv-link PATHS ${SPIRV_TOOLS_PREFIX} /bin )
19
+ if (SPIRV_TOOLS_SPIRV_LINK )
20
+ set (SPIRV_TOOLS_SPIRV_LINK_FOUND True )
21
+ endif ()
22
+
18
23
find_program (SPIRV_TOOLS_SPIRV_VAL NAMES spirv-val PATHS ${SPIRV_TOOLS_PREFIX} /bin )
19
24
if (SPIRV_TOOLS_SPIRV_VAL )
20
25
set (SPIRV_TOOLS_SPIRV_VAL_FOUND True )
@@ -28,6 +33,11 @@ if(NOT SPIRV_TOOLS_SPIRV_AS)
28
33
set (SPIRV_TOOLS_SPIRV_AS_FOUND False )
29
34
endif ()
30
35
36
+ if (NOT SPIRV_TOOLS_SPIRV_LINK )
37
+ message (WARNING "spirv-link not found! SPIR-V test involving the linker will not be run." )
38
+ set (SPIRV_TOOLS_SPIRV_LINK_FOUND False )
39
+ endif ()
40
+
31
41
if (NOT SPIRV_TOOLS_SPIRV_VAL )
32
42
message (WARNING "spirv-val not found! SPIR-V generated for test suite will not be validated." )
33
43
set (SPIRV_TOOLS_SPIRV_VAL_FOUND False )
Original file line number Diff line number Diff line change 60
60
config .available_features .add ('spirv-as' )
61
61
using_spirv_tools = True
62
62
63
+ if config .spirv_tools_have_spirv_link :
64
+ llvm_config .add_tool_substitutions (['spirv-link' ], [config .spirv_tools_bin_dir ])
65
+ config .available_features .add ('spirv-link' )
66
+ using_spirv_tools = True
67
+
63
68
if config .spirv_tools_have_spirv_val :
64
69
llvm_config .add_tool_substitutions (['spirv-val' ], [config .spirv_tools_bin_dir ])
65
70
using_spirv_tools = True
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ config.host_arch = "@HOST_ARCH@"
16
16
config.python_executable = "@PYTHON_EXECUTABLE@"
17
17
config.test_run_dir = "@CMAKE_CURRENT_BINARY_DIR@"
18
18
config.spirv_tools_have_spirv_as = @SPIRV_TOOLS_SPIRV_AS_FOUND@
19
+ config.spirv_tools_have_spirv_link = @SPIRV_TOOLS_SPIRV_LINK_FOUND@
19
20
config.spirv_tools_have_spirv_val = @SPIRV_TOOLS_SPIRV_VAL_FOUND@
20
21
config.spirv_tools_bin_dir = "@SPIRV_TOOLS_BINDIR@"
21
22
config.spirv_tools_lib_dir = "@SPIRV_TOOLS_LIBDIR@"
Original file line number Diff line number Diff line change
1
+ ; REQUIRES: spirv-link
2
+ ;
3
+ ; FIXME This currently crashes when translating back from SPIR-V.
4
+ ; XFAIL: *
5
+ ;
6
+ ; RUN: llvm-as %s -o %t.bc
7
+ ; RUN: llvm-spirv %t.bc -o %t.spv
8
+ ; RUN: spirv-val %t.spv
9
+ ; RUN: spirv-link %t.spv -o %t.linked.spv
10
+ ; RUN: llvm-spirv -r %t.linked.spv -o %t.rev.bc
11
+ ; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s
12
+ ;
13
+ ; This checks that SPIR-V programs with global variables are still consumable
14
+ ; after spirv-link.
15
+
16
+ target triple = "spir-unknown-unknown"
17
+
18
+ @foo = common dso_local local_unnamed_addr addrspace (1 ) global i32 0 , align 4
19
+ ; CHECK: @foo = internal addrspace(1) global i32 0, align 4
20
+
21
+ define dso_local spir_kernel void @bar () local_unnamed_addr {
22
+ entry:
23
+ store i32 42 , i32 addrspace (1 )* @foo , align 4
24
+ ret void
25
+ }
You can’t perform that action at this time.
0 commit comments