Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/pipeline_check.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ It also exits 2, before loading Vulkan, if `index.json` is missing, unreadable,
directory can't pass as an empty corpus. A valid `{}` is an intentionally empty index.

For an index entry with `lds_bytes`, the checker compares the reported workgroup memory with the selected GPU's
`maxComputeSharedMemorySize` for compute or `maxMeshSharedMemorySize` for supported mesh shaders. An entry above its
limit counts as a module failure before Vulkan receives the shader. Older indexes without this field still use the
normal driver check. Mesh pipelines on devices without mesh shader support still use the existing feature skip.
`maxComputeSharedMemorySize` for compute (and `--mesh-compute` mesh shaders, whose SPIR-V modules are `GLCompute`
compute pipelines checked without `VK_EXT_mesh_shader`, including under `--stage cs`) or `maxMeshSharedMemorySize`
for supported native mesh shaders. An entry above its limit counts as a module failure before Vulkan receives the
shader. Older indexes without this field still use the normal driver check. Native mesh pipelines on devices without
mesh shader support still use the existing feature skip.

Build with `make_game.py --stages shaders --compact-spirv` to run SPIRV-Tools local load elimination, redundant value elimination and dead-code elimination before validation. The same flag works on `tools/rdna2spirv.py` and `scripts/translate_pipeline_compute.py`. It preserves stage interfaces, descriptor bindings and specialization constants. Omit the flag for an unoptimized comparison. On NVIDIA use separate empty pipeline caches and set `__GL_SHADER_DISK_CACHE=0` for both arms. Use one pipeline per checker process with `--jobs 1 --slow 0` for per-module timings.

Expand Down
6 changes: 6 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,12 @@ if(TARGET Vulkan::Headers)
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/vk_pipeline_check_cli_input"
"-DRUNNER=${CMAKE_CROSSCOMPILING_EMULATOR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/test/check_vk_pipeline_cli.cmake")
if(Python3_FOUND AND NOT CMAKE_CROSSCOMPILING)
add_test(NAME vk_pipeline_check_mesh_compute COMMAND "${Python3_EXECUTABLE}" -I
"${CMAKE_CURRENT_SOURCE_DIR}/test/check_vk_pipeline_mesh_compute.py"
--ctest --exe "$<TARGET_FILE:vk_pipeline_check>")
set_tests_properties(vk_pipeline_check_mesh_compute PROPERTIES SKIP_RETURN_CODE 77)
endif()
add_test(NAME vk_texture_cube_alpha COMMAND vk_texture_test --self-test-cube-alpha)
if(WIN32)
# Reads SizeOfStackReserve from the built file; the program is not run, so it needs no emulator.
Expand Down
19 changes: 19 additions & 0 deletions runtime/test/check_vk_pipeline_cli.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,22 @@ foreach(bytes -1 1.5 4294967296)
message(FATAL_ERROR "pc_tail.bytes=${bytes}: expected a malformed index, got ${code}\n${log}")
endif()
endforeach()

# mesh_compute must be a JSON object (or null) on an "ms" entry, rejected before Vulkan loads.
foreach(bad_mc 123 true "\"obj\"" "[]")
file(WRITE "${TEST_DIR}/index.json" "{\"example\":{\"stage\":\"ms\",\"mesh_compute\":${bad_mc}}}\n")
execute_process(COMMAND ${RUNNER} "${TOOL}" "${TEST_DIR}"
RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log TIMEOUT 5)
if(NOT code STREQUAL "2" OR NOT log MATCHES "expected object for mesh_compute at byte [0-9]+")
message(FATAL_ERROR "mesh_compute=${bad_mc}: expected a malformed index, got ${code}\n${log}")
endif()
endforeach()

foreach(wrong_stage cs ps vs gs)
file(WRITE "${TEST_DIR}/index.json" "{\"example\":{\"mesh_compute\":{},\"stage\":\"${wrong_stage}\"}}\n")
execute_process(COMMAND ${RUNNER} "${TOOL}" "${TEST_DIR}"
RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log TIMEOUT 5)
if(NOT code STREQUAL "2" OR NOT log MATCHES "mesh_compute requires stage ms at byte [0-9]+")
message(FATAL_ERROR "mesh_compute on stage=${wrong_stage}: expected a malformed index, got ${code}\n${log}")
endif()
endforeach()
Loading
Loading