Skip to content

Commit d0652dc

Browse files
authored
Merge pull request #204 from frasercrmck/spirv-ll-validate-tests
[spirv-ll] Validate LIT tests with `spirv-val`
2 parents 6a870d1 + 29a8ce6 commit d0652dc

2,904 files changed

Lines changed: 2941 additions & 8 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎modules/compiler/spirv-ll/test/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if(CA_ASSEMBLE_SPIRV_LL_LIT_TESTS_OFFLINE)
3333
else()
3434
endif()
3535

36-
find_package(SpirvTools COMPONENTS spirv-as)
36+
find_package(SpirvTools COMPONENTS spirv-as spirv-val)
3737
if(TARGET spirv::spirv-as)
3838
# Get the found spirv-as version, takes the form: v<year>.<point>(-dev)?
3939
# We treat 'dev' as the previous point release: see below.

‎modules/compiler/spirv-ll/test/glsl/CMakeLists.txt‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,19 @@ foreach(glsl ${GLSL_FILES})
806806
if(GLSL_UNSUPPORTED STREQUAL False)
807807
# Generate .spv from .comp source.
808808
file(RELATIVE_PATH spvOut ${CMAKE_BINARY_DIR} ${spv})
809+
810+
# Work out whether we're validating this SPIR-V file.
811+
set(OPTIONAL_VALIDATE_DEPENDS)
812+
set(OPTIONAL_VALIDATE_COMMAND)
813+
if(TARGET spirv::spirv-val)
814+
set(OPTIONAL_VALIDATE_DEPENDS spirv::spirv-val)
815+
set(OPTIONAL_VALIDATE_COMMAND COMMAND spirv::spirv-val ${spv})
816+
endif()
817+
809818
add_custom_command(OUTPUT ${spv}
810819
COMMAND ${glslangValidator_EXECUTABLE} -s -V -o ${spv} ${comp}
811-
DEPENDS ${glslangValidator_EXECUTABLE} ${comp}
820+
${OPTIONAL_VALIDATE_COMMAND}
821+
DEPENDS ${glslangValidator_EXECUTABLE} ${OPTIONAL_VALIDATE_DEPENDS} ${comp}
812822
COMMENT "Building SPIR-V ${spvOut}")
813823
list(APPEND LitTestFiles ${spv})
814824
endif()

‎modules/compiler/spirv-ll/test/glsl/builtin_var_gl_GlobalInvocationID.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/builtin_var_gl_LocalInvocationID.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/builtin_var_gl_LocalInvocationIndex.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/builtin_var_gl_NumWorkGroups.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/builtin_var_gl_WorkGroupID.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/descriptor_set_bool.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/descriptor_set_double.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan -c Float64 %spv_file_s | FileCheck %s
1920

2021
#version 450

‎modules/compiler/spirv-ll/test/glsl/descriptor_set_float.comp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
1616

1717
// RUN: %if online-glsl %{ glslangValidator -s -V -o %spv_file_s %s %}
18+
// RUN: %if online-glsl %{ spirv-val %spv_file_s %}
1819
// RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
1920

2021
#version 450

0 commit comments

Comments
 (0)