Bug 108957 - VkRunner tests assert when run with nir test environment variables
Summary: VkRunner tests assert when run with nir test environment variables
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-05 20:49 UTC by Mark Janes
Modified: 2019-06-05 20:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Janes 2018-12-05 20:49:12 UTC
Mesa i965 CI runs tests in a mode designed to detect problems with our use of NIR.  The following environment variables are set:

NIR_TEST_CLONE=true NIR_TEST_SERIALIZE=true

With the addition of VkRunner tests to piglit, the following tests began to fail in this mode:

piglit.vulkan.glsl450.face-forward-double
piglit.vulkan.glsl450.frexp-double
piglit.vulkan.glsl450.isinf-double
piglit.vulkan.glsl450.reflect-double
piglit.vulkan.glsl450.refract-double
piglit.vulkan.shaders.fs-large-local-array
piglit.vulkan.shaders.fs-large-local-array-vec2
piglit.vulkan.shaders.fs-large-local-array-vec3
piglit.vulkan.shaders.fs-large-local-array-vec4
piglit.vulkan.shaders.fs-multiple-large-local-array

stderr:
/tmp/vkrunner-1E4K6k
vkrunner: ../src/intel/vulkan/anv_pipeline.c:193: anv_shader_compile_to_nir: Assertion `exec_list_length(&nir->functions) == 1' failed.
Comment 1 Jason Ekstrand 2018-12-05 20:59:54 UTC
This is entirely due to the way we handle hanging onto the entrypoint we get out of SPIR-V.  The spirv_to_nir pass returns a nir_function_impl instead of a nir_shader and we hang on to it while we do a couple of passes such as function inlining.  We then go to delete all but the main entrypoint assuming that the nir_function_impl pointer we're hanging on to is still valid.  If NIR_TEST_CLONE is set, it won't be valid because it will have been cloned out from under us.  This isn't an actual issue in production, but we should probably sort out what to do about it one of these days.
Comment 2 Caio Marcelo de Oliveira Filho 2019-05-19 07:44:54 UTC
There's a MR to attempt to fix this one

https://gitlab.freedesktop.org/mesa/mesa/merge_requests/912
Comment 3 Caio Marcelo de Oliveira Filho 2019-06-05 16:07:31 UTC
That MR was replaced with

https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1012
Comment 4 Jason Ekstrand 2019-06-05 20:10:46 UTC
Fixed by the following two commits in master:

commit fe2fc30cb559f7ef99c07bd219c057b011242cb4
Author: Jason Ekstrand <jason@jlekstrand.net>
Date:   Tue Jun 4 17:50:22 2019 -0500

    nir: Don't replace the nir_shader when NIR_TEST_SERIALIZE=1
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108957
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Rob Clark <robdclark@chromium.org>

commit 9eba6d9a880558c89a72cbafd873d4fe1247928d
Author: Jason Ekstrand <jason@jlekstrand.net>
Date:   Tue Jun 4 17:48:33 2019 -0500

    nir: Don't replace the nir_shader when NIR_TEST_CLONE=1
    
    Instead, we add a new helper which stomps one nir_shader and replaces it
    with another.  The new helper effectively just changes which pointer
    gets used for the base nir_shader.  It should be 99% as good at testing
    cloning but without requiring that everything handle having the shader
    swapped out from under it constantly.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108957
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Rob Clark <robdclark@chromium.org>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.