KhronosGroup / SPIRV-Tools

Apache License 2.0
1.08k stars 555 forks source link

Build errors due to spv::Op #5438

Closed meerfrau closed 11 months ago

meerfrau commented 1 year ago

I'm trying to build against mesa-master with gcc 13.2.0:

[10/327] Building CXX object source/CMakeFiles/SPIRV-Tools-shared.dir/assembly_grammar.cpp.o
FAILED: source/CMakeFiles/SPIRV-Tools-shared.dir/assembly_grammar.cpp.o 
/usr/lib/ccache/bin/c++ -DSPIRV_COLOR_TERMINAL -DSPIRV_LINUX -DSPIRV_TIMER_ENABLED -DSPIRV_TOOLS_IMPLEMENTATION -DSPIRV_TOOLS_SHAREDLIB -DSPIRV_Tools_shared_EXPORTS -I./SPIRV-Tools -I./SPIRV-Tools/include -I./SPIRV-Tools/build -march=native -mtune=native -O2         -pipe -fno-plt -fexceptions -Wformat         -w -Wno-deprecated-declarations         -fno-sanitize=vptr -Wp,-D_GLIBCXX_ASSERTIONS -fpermissive -Wzero-as-null-pointer-constant -std=c++17 -fPIC -fvisibility=hidden -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion -fno-exceptions -MD -MT source/CMakeFiles/SPIRV-Tools-shared.dir/assembly_grammar.cpp.o -MF source/CMakeFiles/SPIRV-Tools-shared.dir/assembly_grammar.cpp.o.d -o source/CMakeFiles/SPIRV-Tools-shared.dir/assembly_grammar.cpp.o -c ./SPIRV-Tools/source/assembly_grammar.cpp
./SPIRV-Tools/source/assembly_grammar.cpp:91:31: error: 'OpCooperativeMatrixLengthKHR' is not a member of 'spv::Op'; did you mean 'OpCooperativeMatrixLengthNV'?
   91 | #define CASE(NAME) { spv::Op::Op##NAME, #NAME }
      |                               ^~
./SPIRV-Tools/source/assembly_grammar.cpp:159:5: note: in expansion of macro 'CASE'
  159 |     CASE(CooperativeMatrixLengthKHR)
      |     ^~~~
./SPIRV-Tools/source/assembly_grammar.cpp:163:18: error: static assertion failed: OpSpecConstantOp opcode table is incomplete
  163 | static_assert(61 == sizeof(kOpSpecConstantOpcodes)/sizeof(kOpSpecConstantOpcodes[0]),
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./SPIRV-Tools/source/assembly_grammar.cpp:163:18: note: the comparison reduces to '(61 == 1)'
[12/327] Building CXX object source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_arithmetics.cpp.o
FAILED: source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_arithmetics.cpp.o 
/usr/lib/ccache/bin/c++ -DSPIRV_COLOR_TERMINAL -DSPIRV_LINUX -DSPIRV_TIMER_ENABLED -DSPIRV_TOOLS_IMPLEMENTATION -DSPIRV_TOOLS_SHAREDLIB -DSPIRV_Tools_shared_EXPORTS -I./SPIRV-Tools -I./SPIRV-Tools/include -I./SPIRV-Tools/build -march=native -mtune=native -O2         -pipe -fno-plt -fexceptions -Wformat         -w -Wno-deprecated-declarations         -fno-sanitize=vptr -Wp,-D_GLIBCXX_ASSERTIONS -fpermissive -Wzero-as-null-pointer-constant -std=c++17 -fPIC -fvisibility=hidden -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion -fno-exceptions -MD -MT source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_arithmetics.cpp.o -MF source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_arithmetics.cpp.o.d -o source/CMakeFiles/SPIRV-Tools-shared.dir/val/validate_arithmetics.cpp.o -c ./SPIRV-Tools/source/val/validate_arithmetics.cpp
./SPIRV-Tools/source/val/validate_arithmetics.cpp: In function 'spv_result_t spvtools::val::ArithmeticsPass(ValidationState_t&, const Instruction*)':
./SPIRV-Tools/source/val/validate_arithmetics.cpp:589:19: error: 'OpCooperativeMatrixMulAddKHR' is not a member of 'spv::Op'; did you mean 'OpCooperativeMatrixMulAddNV'?
  589 |     case spv::Op::OpCooperativeMatrixMulAddKHR: {
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   OpCooperativeMatrixMulAddNV

Is this the same as https://github.com/KhronosGroup/SPIRV-Tools/issues/5014 ?

s-perron commented 1 year ago

Which version of spirv-headers are you using? If you are not using the latest, please update spirv-headers, and try again.

meerfrau commented 1 year ago

Because ArchLinux is outdated I've packaged 1.3.261.1

s-perron commented 1 year ago

Okay, you might need to check that the build is picking up the correct copy of spirv-headers.

I just checked. If I use the latest version of spirv-tools with sdk-1.3.250.1 for spirv-header, I see the errors you mentioned above. However, if I use sdk-1.3.261.1, it builds correctly.