-
Notifications
You must be signed in to change notification settings - Fork 803
[SYCL][SPIR-V] Drop Unnecessary Matrix Use parameter #6923
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,11 +57,17 @@ void CodeGenTypes::addRecordTypeName(const RecordDecl *RD, | |
| if (auto TemplateDecl = dyn_cast<ClassTemplateSpecializationDecl>(RD)) { | ||
| ArrayRef<TemplateArgument> TemplateArgs = | ||
| TemplateDecl->getTemplateArgs().asArray(); | ||
| [[maybe_unused]] constexpr size_t MinMatrixParameter = 5; | ||
| constexpr size_t MaxMatrixParameter = 6; | ||
| const size_t TemplateArgsSize = TemplateArgs.size(); | ||
| assert((TemplateArgsSize >= MinMatrixParameter && | ||
| TemplateArgsSize <= MaxMatrixParameter) && | ||
| "Too many template parameters for JointMatrixINTEL type"); | ||
| OS << "spirv.JointMatrixINTEL."; | ||
| for (auto &TemplateArg : TemplateArgs) { | ||
| OS << "_"; | ||
| if (TemplateArg.getKind() == TemplateArgument::Type) { | ||
| llvm::Type *TTy = ConvertType(TemplateArg.getAsType()); | ||
| for (size_t I = 0; I != TemplateArgsSize; ++I) { | ||
| if (TemplateArgs[I].getKind() == TemplateArgument::Type) { | ||
| OS << "_"; | ||
| llvm::Type *TTy = ConvertType(TemplateArgs[I].getAsType()); | ||
| if (TTy->isIntegerTy()) { | ||
| switch (TTy->getIntegerBitWidth()) { | ||
| case 8: | ||
|
|
@@ -91,8 +97,14 @@ void CodeGenTypes::addRecordTypeName(const RecordDecl *RD, | |
| OS << LlvmTyName; | ||
| } else | ||
| TTy->print(OS, false, true); | ||
| } else if (TemplateArg.getKind() == TemplateArgument::Integral) | ||
| OS << TemplateArg.getAsIntegral(); | ||
| } else if (TemplateArgs[I].getKind() == TemplateArgument::Integral) { | ||
| const auto IntTemplateParam = TemplateArgs[I].getAsIntegral(); | ||
| // Last parameter 'Use' is optional in SPIR-V, but is not optional | ||
| // in DPCPP headers. If it has Unnecessary value - skip it | ||
| constexpr size_t Unnecessary = 3; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my understanding can you explain this? What is the significance of '3' here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
comment would be helpful. Thank you
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the comment
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still a little confused. My question was why is "3" = Unecessary. Is this defined by the spec? What are possible legal values for Use parameter?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, there is no While answering your question another idea came up in my mind, which might be cleaner. What if we declare
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this idea as long this does not break current SPIRV (use is still optional).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, there is quite a lot of things to change in the headers with a lot of code duplication to make it working. @elizabethandrews are we good to have the patch in clang or additional code commentary is required?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do something like: Also, I see that Unnecessary template parameter is a default value, why can't we just declare it? How it will be incompatible with the previous version of the extension? |
||
| if (!(I == MaxMatrixParameter && IntTemplateParam == Unnecessary)) | ||
| OS << "_" << IntTemplateParam; | ||
| } | ||
| } | ||
| Ty->setName(OS.str()); | ||
| return; | ||
|
|
||
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.
Is there a minimum matrix parameter we can also check at the same time?
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.
Added, 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.
Assert message should be updated right? Since you added a minimum requirement as well
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.
Well, actually, after some consideration I realized, that there is no max or min number of template parameters, it's just a fixed number of 6.