From 512f1c160a63a7ba1b0097166d8ec0324542d639 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 12 Jan 2023 14:28:26 -0800 Subject: [PATCH] ci/zink: Add coverage using the vulkan validation layer on lvp. Let's make sure we aren't introducing new validation failures as development proceeds. Basically, we record the current set of known validation failures from the CTS, and for any validation failure we have the layer log it and abort. I had started encoding xfails from piglit, but it turns out that piglit and the validation layer fight about the teardown process, producing use-after-frees. Part-of: --- .../container/build-vulkan-validation.sh | 15 ++ .gitlab-ci/container/debian/x86_test-gl.sh | 5 + .gitlab-ci/image-tags.yml | 2 +- .../drivers/zink/ci/deqp-zink-lvp.toml | 6 + src/gallium/drivers/zink/ci/gitlab-ci.yml | 4 + .../zink/ci/zink-lvp-validation-settings.txt | 225 ++++++++++++++++++ 6 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci/container/build-vulkan-validation.sh create mode 100644 src/gallium/drivers/zink/ci/zink-lvp-validation-settings.txt diff --git a/.gitlab-ci/container/build-vulkan-validation.sh b/.gitlab-ci/container/build-vulkan-validation.sh new file mode 100644 index 00000000000..ead6c127f50 --- /dev/null +++ b/.gitlab-ci/container/build-vulkan-validation.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -ex + +VALIDATION_TAG="v1.3.238" + +git clone -b "$VALIDATION_TAG" --single-branch --depth 1 https://github.com/KhronosGroup/Vulkan-ValidationLayers.git +pushd Vulkan-ValidationLayers +mkdir build +pushd build +python3 ../scripts/update_deps.py --dir ../external --arch x64 --config debug +cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=OFF -DBUILD_WERROR=OFF -C ../external/helper.cmake .. +ninja install +popd +rm -rf Vulkan-ValidationLayers diff --git a/.gitlab-ci/container/debian/x86_test-gl.sh b/.gitlab-ci/container/debian/x86_test-gl.sh index 8ea3f3209ba..d616c3ec2f1 100644 --- a/.gitlab-ci/container/debian/x86_test-gl.sh +++ b/.gitlab-ci/container/debian/x86_test-gl.sh @@ -29,6 +29,7 @@ STABLE_EPHEMERAL=" \ libx11-xcb-dev \ libxcb-dri2-0-dev \ libxkbcommon-dev \ + libxrandr-dev \ libxrender-dev \ llvm-13-dev \ llvm-11-dev \ @@ -78,6 +79,10 @@ DEQP_TARGET=surfaceless . .gitlab-ci/container/build-deqp.sh . .gitlab-ci/container/build-apitrace.sh +############### Build validation layer for zink + +. .gitlab-ci/container/build-vulkan-validation.sh + ############### Uninstall the build software ccache --show-stats diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml index 388b3dab1d5..1ecfa6ff23e 100644 --- a/.gitlab-ci/image-tags.yml +++ b/.gitlab-ci/image-tags.yml @@ -14,7 +14,7 @@ variables: DEBIAN_X86_TEST_IMAGE_VK_PATH: "debian/x86_test-vk" DEBIAN_X86_TEST_IMAGE_PATH: ${DEBIAN_X86_TEST_IMAGE_GL_PATH} - DEBIAN_X86_TEST_GL_TAG: "2023-01-12-cts" + DEBIAN_X86_TEST_GL_TAG: "2023-01-23-vkvalidate" DEBIAN_X86_TEST_VK_TAG: "2023-01-12-cts" ALPINE_X86_BUILD_TAG: "2023-01-20-all-in-1" diff --git a/src/gallium/drivers/zink/ci/deqp-zink-lvp.toml b/src/gallium/drivers/zink/ci/deqp-zink-lvp.toml index 9e7f36f2e7b..edbb613df82 100644 --- a/src/gallium/drivers/zink/ci/deqp-zink-lvp.toml +++ b/src/gallium/drivers/zink/ci/deqp-zink-lvp.toml @@ -57,3 +57,9 @@ profile = "gpu" process_isolation = true timeout = 180.0 [piglit.env] + # Disable validation on piglit. We end up with use-after-frees from + # piglit_report() -> exit() having freed validation layer state, with a + # st_glFlush() -> tc_batch_execute() -> zink_set_vertex_buffers -> + # vulkan_layer_chassis::CmdPipelineBarrier2() (etc.) happening after that + # somehow. + ZINK_DEBUG = "" diff --git a/src/gallium/drivers/zink/ci/gitlab-ci.yml b/src/gallium/drivers/zink/ci/gitlab-ci.yml index c480d78d853..d034f85a3ad 100644 --- a/src/gallium/drivers/zink/ci/gitlab-ci.yml +++ b/src/gallium/drivers/zink/ci/gitlab-ci.yml @@ -37,6 +37,10 @@ zink-lvp: variables: DEQP_SUITE: zink-lvp PIGLIT_NO_WINDOW: 1 + # Enable validation (except for on piglit, see deqp-zink-lvp.toml), logging + # to stdout and aborting on unknown failures. + ZINK_DEBUG: validation + VK_LAYER_SETTINGS_PATH: ${CI_PROJECT_DIR}/install/zink-lvp-validation-settings.txt script: - xvfb-run --server-args='-noreset' sh -c "GALLIUM_DRIVER=zink VK_DRIVER=lvp install/deqp-runner.sh" diff --git a/src/gallium/drivers/zink/ci/zink-lvp-validation-settings.txt b/src/gallium/drivers/zink/ci/zink-lvp-validation-settings.txt new file mode 100644 index 00000000000..cbdd1084901 --- /dev/null +++ b/src/gallium/drivers/zink/ci/zink-lvp-validation-settings.txt @@ -0,0 +1,225 @@ +# Please include a comment with the log message and a testcase triggering each +# VUID at the bottom of the file. +khronos_validation.message_id_filter = VUID-vkCmdDrawMultiEXT-commandBuffer-02701,VUID-vkCmdDrawMultiIndexedEXT-commandBuffer-02701,VUID-vkCmdDrawMultiEXT-colorAttachmentCount-06188,VUID-VkGraphicsPipelineCreateInfo-Geometry-07725,VUID-VkShaderModuleCreateInfo-pCode-01091,VUID-vkCmdCopyImage-srcImage-07743,VUID-vkCmdDrawMultiEXT-None-06479,VUID-vkCmdDrawMultiIndexedEXT-format-07753,VUID-vkCmdDrawMultiEXT-viewType-07752,VUID-vkCmdDispatch-viewType-07752,VUID-vkCmdDrawMultiEXT-magFilter-04553,VUID-vkCmdDrawMultiIndexedEXT-magFilter-04553,VUID-RuntimeSpirv-Location-06272,VUID-vkDestroyDevice-device-00378,UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout,VUID-VkDescriptorImageInfo-imageLayout-00344,VUID-vkCmdDrawMultiEXT-None-02699 +khronos_validation.report_flags = error +khronos_validation.debug_action = VK_DBG_LAYER_ACTION_LOG_MSG,VK_DBG_LAYER_ACTION_BREAK +VK_LAYER_ENABLES=VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT +khronos_validation.printf_buffer_size = 40960 +khronos_validation.printf_to_stdout = true +khronos_validation.log_filename = stdout + +# dEQP-GLES2.functional.shaders.builtin_variable.pointcoord: +# +# leak on most rendering tests with glthread. Also leaks on +# some tests +# (KHR-GL45.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsAdditionSubstractionTestCase) +# without glthread. https://gitlab.freedesktop.org/mesa/mesa/-/issues/8104 and +# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20867 +# +# [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x55b94c15adb0, type = +# VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0x95a125000000001a, type = +# VK_OBJECT_TYPE_BUFFER; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice +# 0x55b94c15adb0[], VkBuffer 0x95a125000000001a[] has not been destroyed. The +# Vulkan spec states: All child objects created on device must have been destroyed +# prior to destroying device +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkDestroyDevice-device-00378) + +# caselist of: +# dEQP-GLES3.functional.primitive_restart.end_restart_duplicate_restarts.lines.unsigned_short.draw_elements_instanced +# dEQP-GLES3.functional.primitive_restart.end_restart_duplicate_restarts.triangles.unsigned_byte.draw_range_elements +# +# [ VUID-vkCmdDrawMultiIndexedEXT-commandBuffer-02701 ] Object 0: handle = +# 0x56094dcd5a20, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xef7d036b | +# vkCmdDrawMultiIndexedEXT: VK_DYNAMIC_STATE_VIEWPORT state not set for this +# command buffer. The Vulkan spec states: If the VkPipeline object bound to the +# pipeline bind point used by this command requires any dynamic state, that state +# must have been set or inherited (if the VK_NV_inherited_viewport_scissor +# extension is enabled) for commandBuffer, and done so after any previously bound +# pipeline with the corresponding state not specified as dynamic +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawMultiIndexedEXT-commandBuffer-02701) + +# caselist of : +# dEQP-GLES31.functional.shaders.helper_invocation.value.triangles +# dEQP-GLES31.functional.shaders.helper_invocation.value.wide_points_4_samples +# +# [VUID-vkCmdDrawMultiEXT-colorAttachmentCount-06188 ] Object 0: handle +# = 0x56444e83ff20, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = +# 0x3d2cdcc3 | vkCmdDrawMultiEXT: Color attachment (0) sample count +# (VK_SAMPLE_COUNT_4_BIT) must match corresponding +# VkPipelineMultisampleStateCreateInfo sample count +# (VK_SAMPLE_COUNT_1_BIT) The Vulkan spec states: If the currently +# bound pipeline was created without a VkAttachmentSampleCountInfoAMD +# or VkAttachmentSampleCountInfoNV structure, and the current render +# pass instance was begun with vkCmdBeginRendering with a +# VkRenderingInfo::colorAttachmentCount parameter greater than 0, then +# each element of the VkRenderingInfo::pColorAttachments array with a +# imageView not equal to VK_NULL_HANDLE must have been created with a +# sample count equal to the value of +# VkPipelineMultisampleStateCreateInfo::rasterizationSamples used to +# create the currently bound graphics pipeline +# (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-vkCmdDrawMultiEXT-colorAttachmentCount-06188) +# +# https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5136 + +# dEQP-GLES31.functional.geometry_shading.emit.points_emit_0_end_1: +# +# [ VUID-VkGraphicsPipelineCreateInfo-Geometry-07725 ] Object 0: handle = +# 0x2e2941000000001f, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = +# 0x64e29d24 | vkCreateGraphicsPipelines(): +# shaderTessellationAndGeometryPointSize is enabled, but PointSize is not +# written in the Geometry shader. The Vulkan spec states: If the pipeline +# is being created with a Geometry {ExecutionModel}, uses the +# OutputPoints {ExecutionMode}, and +# shaderTessellationAndGeometryPointSize is enabled, a PointSize +# decorated variable must be written to +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-Geometry-07725) + +# KHR-GL46.compute_shader.resources-max: +# +# [ VUID-VkShaderModuleCreateInfo-pCode-01091 ] Object 0: handle = +# 0x55b4bf3a48d0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xa7bb8db6 +# | vkCreateShaderModule(): The SPIR-V Capability +# (StorageImageArrayDynamicIndexing) was declared, but none of the +# requirements were met to use it. The Vulkan spec states: If pCode +# declares any of the capabilities listed in the SPIR-V Environment +# appendix, one of the corresponding requirements must be satisfied +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-01091) +# +# lvp doesn't support the feature and we don't lower it. Hopefully lvp gains it with +# https://gitlab.freedesktop.org/mesa/mesa/-/issues/6972 + +# KHR-GL46.copy_image.invalid_target: +# +# [ VUID-vkCmdCopyImage-srcImage-07743 ] Object 0: handle = +# 0x557060e9ffd0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = +# 0xa4e981d8 | vkCmdCopyImage: pRegion[0] srcImage (VK_IMAGE_TYPE_2D) +# must be equal to dstImage (VK_IMAGE_TYPE_1D) or else one must be 2D and +# the other 3D The Vulkan spec states: If srcImage and dstImage have a +# different VkImageType, one must be VK_IMAGE_TYPE_3D and the other must +# be VK_IMAGE_TYPE_2D +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdCopyImage-srcImage-07743) +# +# Recent VU regression: +# https://gitlab.khronos.org/vulkan/vulkan/-/issues/3357 + +# KHR-GL46.incomplete_texture_access.sampler: +# +# [ VUID-vkCmdDrawMultiEXT-None-06479 ] Object 0: handle = +# 0x56c9bd0000000040, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: +# handle = 0x2e2941000000001f, type = VK_OBJECT_TYPE_IMAGE_VIEW; | +# MessageID = 0xcb44bfdd | vkCmdDrawMultiEXT: Descriptor set +# VkDescriptorSet 0x56c9bd0000000040[] in binding #128 index 0, +# VkImageView 0x2e2941000000001f[], image view format +# VK_FORMAT_R8G8B8A8_UNORM feature flags +# (VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT|VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT|VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT|VK_FORMAT_FEATURE_2_BLIT_SRC_BIT|VK_FORMAT_FEATURE_2_BLIT_DST_BIT|VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT|VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT|VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT|VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT) +# doesn't contain VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT +# The Vulkan spec states: If a VkImageView is sampled with depth +# comparison, the image view's format features must contain +# VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawMultiEXT-None-06479) +# +# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20817 + +# KHR-GL46.shader_atomic_counter_ops_tests.ShaderAtomicCounterOpsAdditionSubstractionTestCase: +# +# [ VUID-vkCmdDrawMultiIndexedEXT-format-07753 ] Object 0: handle = +# 0xa952a5000000016f, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = +# 0xd35852d3 | vkCmdDrawMultiIndexedEXT: Descriptor set VkDescriptorSet +# 0xa952a5000000016f[] in binding #128 index 0 requires FLOAT component +# type, but bound descriptor format is VK_FORMAT_R32G32B32A32_UINT +# (VkImageView 0xbf15540000000166[]). The Vulkan spec states: If a +# VkImageView is accessed as a result of this command, then the image +# view's format must match the numeric format from the Sampled Type +# operand of the OpTypeImage as described in the SPIR-V Sampled Type +# column of the Interpretation of Numeric Format table +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawMultiIndexedEXT-format-07753) +# +# https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4244 +# https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4250 + +# KHR-GL46.shader_image_load_store.basic-allTargets-atomic: +# [ VUID-vkCmdDrawMultiEXT-viewType-07752 ] Object 0: handle = +# 0x5581c500000000d5, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = +# 0xacde5967 | vkCmdDrawMultiEXT: Descriptor set VkDescriptorSet +# 0x5581c500000000d5[] in binding #129 index 0 requires an image view of type +# VK_IMAGE_VIEW_TYPE_CUBE but got VkImageView 0x359e9300000000cb[] which is of +# type VK_IMAGE_VIEW_TYPE_CUBE_ARRAY. The Vulkan spec states: If a VkImageView is +# accessed as a result of this command, then the image view's viewType must match +# the Dim operand of the OpTypeImage as described in Instruction/Sampler/Image +# View Validation +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawMultiEXT-viewType-07752) + +# KHR-GL46.shader_image_size.advanced-nonMS-cs-int: +# +# [ VUID-vkCmdDispatch-viewType-07752 ] Object 0: handle = 0xc8986900000032ed, +# type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0x6174abc7 | vkCmdDispatch: +# Descriptor set VkDescriptorSet 0xc8986900000032ed[] in binding #3 index 0 +# requires an image view of type VK_IMAGE_VIEW_TYPE_CUBE but got VkImageView +# 0x3ce28700000032e2[] which is of type VK_IMAGE_VIEW_TYPE_2D. The Vulkan spec +# states: If a VkImageView is accessed as a result of this command, then the image +# view's viewType must match the Dim operand of the OpTypeImage as described in +# Instruction/Sampler/Image View Validation +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDispatch-viewType-07752) +# +# https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4250 + +# KHR-GL46.texture_border_clamp.Texture2DDC16Linear: +# +# VUID-vkCmdDrawMultiEXT-magFilter-04553 ] Object 0: handle = 0xa43473000000002d, +# type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0xb991fa0000000024, +# type = VK_OBJECT_TYPE_SAMPLER; Object 2: handle = 0xa7c5450000000023, type = +# VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0x6823381d | vkCmdDrawMultiEXT: +# Descriptor set VkDescriptorSet 0xa43473000000002d[] Sampler (VkSampler +# 0xb991fa0000000024[]) is set to use VK_FILTER_LINEAR with compareEnable is set +# to VK_FALSE, but image view's (VkImageView 0xa7c5450000000023[]) format +# (VK_FORMAT_D16_UNORM) does not contain +# VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in its format features. The +# Vulkan spec states: If a VkSampler created with magFilter or minFilter equal to +# VK_FILTER_LINEAR and compareEnable equal to VK_FALSE is used to sample a +# VkImageView as a result of this command, then the image view's format features +# must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawMultiEXT-magFilter-04553) + +# KHR-GL46.texture_view.coherency +# +# [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = +# 0x55ba2375da70, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4dae5635 | +# vkQueueSubmit(): pSubmits[0].pCommandBuffers[1] command buffer VkCommandBuffer +# 0x55ba2375da70[] expects VkImage 0x908683000000001d[] (subresource: aspectMask +# 0x1 array layer 0, mip level 1) to be in layout +# VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL--instead, current layout is +# VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT. +# +# [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = +# 0x55ba23788bf0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xde55a405 | +# vkCmdDrawMultiEXT: Cannot use VkImage 0x53e60f000000006b[] (layer=0 mip=0) with +# specific layout VK_IMAGE_LAYOUT_GENERAL that doesn't match the previous known +# layout VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT. The Vulkan spec +# states: imageLayout must match the actual VkImageLayout of each subresource +# accessible from imageView at the time this descriptor is accessed as defined by +# the image layout matching rules +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344) +# +# [ VUID-vkCmdDrawMultiEXT-None-02699 ] Object 0: handle = 0xb82de40000000077, +# type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0x568f7614 | +# vkCmdDrawMultiEXT: Descriptor set VkDescriptorSet 0xb82de40000000077[] Image +# layout specified at vkCmdBindDescriptorSets time doesn't match actual image +# layout at time descriptor is used. See previous error callback for specific +# details. The Vulkan spec states: Descriptors in each bound descriptor set, +# specified via vkCmdBindDescriptorSets, must be valid as described by descriptor +# validity if they are statically used by the VkPipeline bound to the pipeline +# bind point used by this command +# (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-vkCmdDrawMultiEXT-None-02699) + + +# KHR-Single-GL46.enhanced_layouts.varying_array_locations: +# +# [ VUID-RuntimeSpirv-Location-06272 ] Object 0: handle = +# 0x8f5f070000000095, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = +# 0xa3614f8b | Invalid Pipeline CreateInfo State: Geometry shader exceeds +# VkPhysicalDeviceLimits::maxGeometryInputComponents of 64 components by +# 1 components The Vulkan spec states: The sum of Location and the number +# of locations the variable it decorates consumes must be less than or +# equal to the value for the matching {ExecutionModel} defined in Shader +# Input and Output Locations +# (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-RuntimeSpirv-Location-06272)