Running piglit tests with NIR_TEST_CLONE=true NIR_TEST_SERIALIZE=true, thousands of piglit tests crash:
NIR_TEST_CLONE=true NIR_TEST_SERIALIZE=true /tmp/build_root/m64/lib/piglit/bin/shader_runner /tmp/build_root/m64/lib/piglit/generated_tests/spec/arb_tessellation_shader/execution/built-in-functions/tcs-op-mult-float-mat4.shader_test -auto -fbo
piglit: debug: Requested an OpenGL 3.2 Core Context, and received a matching 4.5 context
d219521379626ebf2bff63e4a9c2f92725b3926a is the first bad commit
Author: Danylo Piliaiev <email@example.com>
Date: Wed Jul 11 15:29:00 2018 +0300
i965: Sweep NIR after linking phase to free held memory
After optimization passes and many trasfromations most of memory
NIR holds is a garbage which was being freed only after shader deletion.
Freeing it at the end of linking will save memory which would be useful
in case there are a lot of complex shaders being compiled.
The common case for this issue is 32bit game running under Wine.
The cost of the optimization is around ~3-5% of compilation speed
with complex shaders.
V2: by Jason Ekstrand
- Move nir_sweep up, right after the last change of NIR
Signed-off-by: Danylo Piliaiev <firstname.lastname@example.org>
Reviewed-by: Jason Ekstrand <email@example.com>
Fixed by the following commit in master:
commit f214baf72ff89ba03342067f89c38b4bc84e298b (public/master)
Author: Jason Ekstrand <firstname.lastname@example.org>
Date: Tue Jul 24 11:01:20 2018 -0700
nir/serialize: Alloc constants off the variable
nir_sweep assumes that constants area always allocated off the variable
to which they belong. Violating this assumption causes them to get
freed early and leads to use-after-free bugs.
Fixes: 120da00975541 "nir: add serialization and deserialization"
Reviewed-by: Lionel Landwerlin <email@example.com>
Tested-by: Mark Janes <firstname.lastname@example.org>