Closed pvelesko closed 9 months ago
... Assertion SourceArgs.size() == OperandCount && "Invalid number of operands"' failed.
Looks like a llvm-spirv bug that manifests in some of its branches. The buggy assertion can be found in for example in the LLVM-16 branch which it expects all OpExtInst ... DebugSource ...
instructions to have two operands (OperandCount
). This does not seem right respect to the debug info spec which states the DebugSource instructions take one operand at minimum (counted after the OpExtInst’s instruction operand). The assertion and the operand count seems to be corrected in other branches like llvm_release_150 and llvm_release_170.
It could be that the assertion gets triggered because the SPIR-V is generated with a llvm-spirv version that produces OpExtInst … DebugSource
instructions with single operand. At least the latest llvm-spirv from llvm_release_170 branch does this.
I built using LLVM-14 provided by apt. According to intel-compute-runtime build instructions, LLVM-14 is the supported version and LLVV-SPIRV-Translator should match versions. Perhaps the revision from apt is just a bit behind. So overall, not related to igc
Found out by chance that the -gdwarf-4
option has an effect on the debug info generated for device. This option is set on in debug builds of the chipStar and it appears in the compilation of HIP samples.
On LLVM-17, -gdwarf-4
generates OptExtInst … DebugSources
instructions with a single operand which triggers the buggy assertion. On the other hand, -g
generates OptExtInst … DebugSources
instructions with two operands.
So we might dodge the assertion by avoiding using the -gdwarf-#
option in the chipStar.
This option was originally introduced because without it there was some issue using gdb. Perhaps it's no longer necessary
Ran into another issue in IGC https://github.com/intel/intel-graphics-compiler/issues/310
but overall, this is resolved for us.
I use the following script for building and installing the latest intel-compute-runtime: https://github.com/pvelesko/intel-compute-runtime-build
After installing it:
Going back to using old IGC resolves the issue