SPIRV AMD Driver compiler memory leak/usage - 8Gb+ to compile single 41Kb SPIRV file, Ubuntu 21.04
Brief summary of the problem:
- this is NOT glslangValidator bug.
- this is NOT my application bug, my application does not have any Validation errors.
- this is NOT my shader bug/problem, shader code valid and works perfectly on every GPU
- this is NOT GPU hardware bug
- used Ubuntu 21.04 without changes
How to reproduce the issue:
-
Download amd_bug_linux_8gb.zip
-
SPIRV file with bug in the archive, is
/shaders/spv/buf3.frag.spv
. Archive includes my binary application to load this shadervk_launcher
. Or use your Vulkan application or Radeon™ GPU Analyzer as an example. -
Launch my
vk_launcher
or RGA(linked above) to load shader - and look on RAM usage. I have 8Gb+Ram usage just by the driver(SPIRV compiler) when I trying load this shader. On PC with just 8Gb RAM its completely freeze PC. (Ubuntu 21.04) -
Archive also include shader without bug
/shaders/spv/buf3_NOBUG.frag.spv
renamebuf3_NOBUG.frag.spv
tobuf3.frag.spv
and launch myvk_launcher
or load_NOBUG
file to RGA - everything will works.
Source code of buf3.frag.spv
is my original (human-written code).
Source code of buf3_NOBUG.frag.spv
is after using "optimizer"(to pre-unroll original code before compiling to SPIRV) on my original code, the logic of code not changed.
glslangValidator version used to compile this file:
Glslang Version: 10:10.15.3847
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 10.15.3847
GLSL Version: 4.60 glslang Khronos. 10.15.3847
SPIR-V Version 0x00010500, Revision 3
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 10
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100
This problem similar to the problem on Windows10 OS I already reported last year - Vulkan loading/compiling SPIRV in AMD Driver use too much RAM (linked there shader does not have this problem in the Linux)
Hardware description:
- CPU: AMD Ryzen 3 3200G with Radeon Vega Graphics
- GPU: Vega 8 (does not matter in this case)
- System Memory: 8Gb RAM
System information:
- Distro name and Version: Ubuntu 21.04
- Kernel version: Ubuntu 21.04 without changes
- AMD package version: Ubuntu 21.04 without changes
Attached files:
- PC frozen no logs, launch yourself to see. I dont have debug setup to debug it correctly.
- Download file with bug amd_bug_linux_8gb.zip