-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headers support for two Intel extensions #356
Conversation
777e108
to
94e6cb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. My only concern is that it doesn't remove any of the legacy implementations for these decorations. I can't seem to find any reference to them either, so I am a bit confused.
@artemrad legacy implementation was done in SPIRV-LLVM Translator only according to https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_global_variable_decorations.asciidoc spec. |
@@ -11880,6 +11880,32 @@ | |||
} | |||
] | |||
}, | |||
{ | |||
"category" : "ValueEnum", | |||
"kind" : "HostAccessQualifier", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new enums for HostAccessQualifier
and the enums for InitializationModeQualifier
aren't getting added to the headers because the generation scripts don't know about them. Are we OK with that?
Actually, I'm a little surprised the header generation script ran correctly because it has checks for unhandled "operand kinds":
if (type == OperandNone) {
std::cerr << "Unhandled operand kind found: " << operandKind << std::endl;
exit(1);
}
Did the generation script run correctly or were other changes needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at this in a bit more detail because all of the automated checks are passing. It turns out that this error is certainly occurring, though it isn't causing the CI jobs to fail for some reason. We should fix this.
Run cd tools/buildHeaders
dos2unix: converting file DebugInfo.h to Unix format...
dos2unix: converting file OpenCLDebugInfo100.h to Unix format...
dos2unix: converting file AMD_gcn_shader.h to Unix format...
dos2unix: converting file AMD_shader_ballot.h to Unix format...
dos2unix: converting file AMD_shader_explicit_vertex_parameter.h to Unix format...
dos2unix: converting file AMD_shader_trinary_minmax.h to Unix format...
dos2unix: converting file NonSemanticDebugPrintf.h to Unix format...
dos2unix: converting file NonSemanticClspvReflection.h to Unix format...
dos2unix: converting file NonSemanticDebugBreak.h to Unix format...
Unhandled operand kind found: InitializationModeQualifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bashbaug thanks for review and investigation! What do you think, should I add these enums to the generation script or to add them somewhere in different place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I add these enums to the generation script
Yes please. This shouldn't be too bad. You can have a look at the recent cooperative matrix PR #355 as an example since it also added a few new types (see the changes in tools/buildHeaders).
Once this is done I would also recommend checking that a basic test case disassembles and assembles properly since updates may be needed to SPIRV-Tools also.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bashbaug! I've updated the headers generation. However I'm not sure how to test SPIR-V tools, because we don't have implementation for these headers in llvm-spirv yet. The CI checks are passing, could it be enough? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please check that SPIRV-Tools builds with these changes? That would probably be the minimum to check, since the interaction between SPIRV-Headers and SPIRV-Tools is not checked via CI.
I'd recommend doing a light touch-test to see if a SPIR-V module using the new decorations assembles, disassembles, and validates properly also, though if this is broken it'll only affect the users of these extensions but not everyone using SPIR-V. You could do this manually, say by adding the decoration to a small existing SPIR-V ASM file, if the tooling to generate SPIR-V modules using these extensions is not implemented yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried building SPIRV-Tools with these header changes just to see if it'd work and I hit build errors. In case it's helpful:
In file included from /home/bashbaug/git/spirv-tools/source/operand.cpp:36:
/home/bashbaug/git/spirv-tools/build/operand.kinds-unified1.inc:871:99: error: ‘SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER’ was not declared in this scope; did you mean ‘SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER’?
871 | {"InitModeINTEL", 6147, 1, pygen_variable_caps_GlobalVariableFPGADecorationsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER}, 0xffffffffu, 0xffffffffu},
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER
/home/bashbaug/git/spirv-tools/build/operand.kinds-unified1.inc:873:96: error: ‘SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER’ was not declared in this scope; did you mean ‘SPV_OPERAND_TYPE_ACCESS_QUALIFIER’?
873 | {"HostAccessINTEL", 6168, 1, pygen_variable_caps_GlobalVariableHostAccessINTEL, 0, nullptr, {SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER, SPV_OPERAND_TYPE_LITERAL_STRING}, 0xffffffffu, 0xffffffffu},
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SPV_OPERAND_TYPE_ACCESS_QUALIFIER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Ben! I've also reproduced it locally, and just forgot to upload my fixes to the Tools - you can see the PR in the reference now :)
Now tools are buildable, local ctests pass, and the "basic" spirv with added capability and extension are going without problems through spirv-val, spirv-as and spirv-dis.
* SPV_INTEL_global_variable_fpga_decorations Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc * SPV_INTEL_global_variable_host_access Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc This change follows headers change: KhronosGroup/SPIRV-Headers#356
* SPV_INTEL_global_variable_fpga_decorations Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc * SPV_INTEL_global_variable_host_access Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc This change follows headers change: KhronosGroup/SPIRV-Headers#356
@alan-baker can you please confirm it's OK to merge this? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems ok
* SPV_INTEL_global_variable_fpga_decorations Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc * SPV_INTEL_global_variable_host_access Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc This change follows headers change: KhronosGroup/SPIRV-Headers#356
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging as discussed in the August 16th teleconference.
Add SPV_INTEL_global_variable_fpga_decorations
Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc
Add SPV_INTEL_global_variable_host_access
Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc