crocus: PrusaSlicer 2.6.0 shader causes GPU hang on HD Graphics 2500 (IVB GT1)
I recently upgraded from PrusaSlicer 2.5.0 to PrusaSlicer 2.6.0. The PrusaSlicer GUI began freezing, and the app began crashing, whenever I tried to rotate a reasonably complex mode.
I logged this as a bug at https://github.com/prusa3d/PrusaSlicer/issues/10968 and began further investigation. It now appears that it's a problem in the Gallium crocus driver, affecting at least this older generation of integrated Intel GPU.
Presenting problem: after importing a model, selecting the model and entering R to rotate does not behave as it should.
Expected behavior: axis rotation circles and axis markers appear. Upon clicking on the rotation widget, it should be possible to smoothly rotate the model, with the axis markers and rotation circles and the model itself reflecting the rotation.
Actual behavior: axis rotation circles and axis markers do not appear, or appear only partially. All activity on the screen freezes for several seconds, followed (in the kernel logs) by a GPU loss-of-heartbeat and GPU reset. Consistently, after the third attempt to rotate the model (and a third freeze), the program aborts with no error message other than "aborted".
On investigation: the abort message appears to be coming from the abort() call in crocus_batch.c, apparently reflecting a batch which has been rejected by the GPU.
The PrusaSlicer change which appears to trigger the problem has been identified. This change enables the use of a more complex shader ("dashed_thick_lines") to draw certain GUI artifacts, such as the rotation controls. The older 2.5.0 PrusaSlicer uses a simpler "flat" shader. Modifying the code in PrusaSlicer to force the use of the "flat" shader eliminates the crashes.
Debugging:
- PrusaSlicer 2.6.0 works correctly on my old Dell laptop, and with different (e.g. AMDGPU) cards in the affected workstation.
- Another Prusa user has reproduced the 2.6.0 problem on a system using a slightly different CPU/GPU in the same family.
- The problem is not present if the use of the old i915 Mesa driver is forced, or if Mesa hardware acceleration is turned off completely.
INTEL_DEBUG features in crocus show the following effects:
- Enabling INTEL_DEBUG=stall (forcing the crocus code to wait for each batch to complete, before starting to work on the next one) does not affect the problem.
- Enabling INTEL_DEBUG=no8 or no16 or no32 (restricting use of certain sorts of shader instructions) doesn't affect the problem.
- Enabling INTEL_DEBUG=nofc (no fast clear) greatly reduces the severity of the problem. There are still occasional GPU hangs when rotating the STL model on the build plate, but they are much less frequency (maybe once a minute, rather than on every attempt) and I haven't yet seem them result in a crash.
- Finally, enabling INTEL_DEBUG=bat (print out an interpretation of the batches) seems to make the problem go away completely. Heisenbug!
INTEL_DEBUG=bat will certainly affect timing, and this might affect race conditions. However, diverting the debug output to /dev/null to minimize the timing alteration doesn't affect matters at all - the problem doesn't come back.
INTEL_DEBUG=bat also appears to disable the use of shadow copy. Perhaps this is the cause of the heisenbuggy behavior?
System:
Host: worker Kernel: 6.1.0-10-amd64 arch: x86_64 bits: 64 compiler: gcc
v: 12.2.0 Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 wm: xfwm dm: LightDM
Distro: Debian GNU/Linux 12 (bookworm)
CPU:
Info: quad core model: Intel Core i5-3470 bits: 64 type: MCP
arch: Ivy Bridge rev: 9 cache: L1: 256 KiB L2: 1024 KiB L3: 6 MiB
Speed (MHz): avg: 1598 high: 1600 min/max: 1600/3600 cores: 1: 1597
2: 1600 3: 1598 4: 1600 bogomips: 25541
Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
Device-1: Intel Xeon E3-1200 v2/3rd Gen Core processor Graphics
vendor: Hewlett-Packard driver: i915 v: kernel arch: Gen-7 ports:
active: HDMI-A-1 empty: DP-1,VGA-1 bus-ID: 00:02.0 chip-ID: 8086:0152
Device-2: AMD Lexa XT [Radeon PRO WX 2100] vendor: Dell driver: amdgpu
v: kernel arch: GCN-4 pcie: speed: 2.5 GT/s lanes: 8 ports: active: none
empty: DP-2,DP-3,DP-4 bus-ID: 01:00.0 chip-ID: 1002:6995 temp: 28.0 C
Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.18.0 driver:
X: loaded: amdgpu,modesetting unloaded: fbdev,vesa dri: crocus gpu: i915
display-ID: :0.0 screens: 1
Screen-1: 0 s-res: 1600x1200 s-dpi: 96
Monitor-1: HDMI-A-1 mapped: HDMI-1 model: Cintiq21UX res: 1600x1200
dpi: 94 diag: 550mm (21.7")
API: OpenGL v: 4.2 Mesa 22.3.6 renderer: Mesa Intel HD Graphics 2500 (IVB
GT1) direct-render: Yes