[RADV/ACO] ACO build error about SMEM operands
Description
When building the shader below in the repro steps I get an error from aco:
ACO ERROR:
In file ../src/amd/compiler/aco_validate.cpp:87
SMEM operands must be sgpr: s4: %4307 = s_load_dwordx4 %558, 0 storage: semantics: scope:invocation
program: ../src/amd/compiler/aco_interface.cpp:52: void validate(aco::Program*): Assertion `is_valid' failed.
Running with RADV_DEBUG=llvm
seems to work correctly and compile the shader without problems (i.e. the shader produces the output I expect).
Repro steps
I tried to make a vkrunner script but it crashed elsewhere. It looked like vkrunner didn't set up an appropriate descriptor set layout and I couldn't see a way to manually specify it. You can build this program: aco_smem.cpp with g++ aco_smem.cpp $(pkg-config --cflags --libs sdl2) -ldl -o program
. It will run and print the error with ACO, and run and exit successfully with llvm.
In case it's helpful here's the GLSL separately: aco_smem.frag. The shader itself is a massive switch statement to test renderdoc's shader debugging, so probably the actual problem is quite small. I didn't bisect further than this shader since I wasn't sure if that would be useful.
System Information
System: Host: lupino Kernel: 5.4.0-47-generic x86_64 bits: 64 compiler: gcc v: 9.3.0
Desktop: Fluxbox 1.3.5 dm: GDM3 Distro: Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: Topology: 8-Core model: AMD Ryzen 7 1700X bits: 64 type: MT MCP arch: Zen rev: 1
L2 cache: 4096 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 108794
Speed: 1893 MHz min/max: 2200/3400 MHz Core speeds (MHz): 1: 1889 2: 1891 3: 1887 4: 1899
5: 1911 6: 2025 7: 1886 8: 1888 9: 1886 10: 1895 11: 1890 12: 1894 13: 1890 14: 1894
15: 1887 16: 1895
Graphics: Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] vendor: PC Partner Limited
driver: amdgpu v: kernel bus ID: 24:00.0 chip ID: 1002:67df
Device-2: NVIDIA TU102 [GeForce RTX 2080 Ti Rev. A] driver: N/A bus ID: 25:00.0
chip ID: 10de:1e07
Display: x11 server: X.Org 1.20.8 driver: ati,modesetting unloaded: fbdev,radeon,vesa
resolution: 1920x1080~60Hz
OpenGL:
renderer: AMD Radeon RX 480 Graphics (POLARIS10 DRM 3.35.0 5.4.0-47-generic LLVM 10.0.1)
v: 4.6 Mesa 20.3.0-devel (git-cf3b638f47) direct render: Yes