Closed andfau-amd closed 2 months ago
Found the bug:
diff --git a/source/disassemble.cpp b/source/disassemble.cpp
index aa20fab6..c9719062 100644
--- a/source/disassemble.cpp
+++ b/source/disassemble.cpp
@@ -650,7 +650,7 @@ void InstructionDisassembler::EmitHeaderVersion(uint32_t version) {
void InstructionDisassembler::EmitHeaderGenerator(uint32_t generator) {
const char* generator_tool =
- spvGeneratorStr(SPV_GENERATOR_TOOL_PART(generator));
+ spvGeneratorStr(generator);
stream_ << "; Generator: " << generator_tool;
// For unknown tools, print the numeric tool value.
if (0 == strcmp("Unknown", generator_tool)) {
I won't submit a patch for this. If anyone else is interested, please steal it. It's low-hanging fruit.
Huh, this code seems like it hasn't changed in eight years, was this always broken or am I missing something? I could have sworn this used to work.
Are you sure that the tool generated the "generator" word correctly? Part of the word is in two part. One part is the id for the tool, and the other is a version number. This looks like the spir-v has 0 for the generator, and 22 for the version. That is the way it is being dumped by spirv-dis.
When I test using thing generated by DXC, it works correctly.
I just did a hexdump of the spirv file you provided. The generator word is "16 00 00 00". This should be "00 00 16 00" Spirv generated by DXC has "00 00 0E 00".
I see, thanks for correcting my mistake.
spirv-dis
on matmul.spv.zip outputs text beginning like this for me:The
Generator:
line is very strange. Why doesn't it know what the generator is? 22 is a registered ID:https://github.com/KhronosGroup/SPIRV-Headers/blob/2acb319af38d43be3ea76bfabf3998e5281d8d12/include/spirv/spir-v.xml#L75
I wondered if maybe SPIRV-Tools wasn't actually generating its lookup table from the xml, but no, I found the generated file in the build:
And it does contain the relevant line:
So I'm not sure what's going on. Code bug? Build system issue?
Reproduction steps
I'm using Ubuntu 22.04 LTS in WSL2 on Windows 11, if that helps.