-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Simplify arguments to computeModuleProperties #15271
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
Conversation
Signed-off-by: Sarnie, Nick <[email protected]>
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 to me.
@AlexeySachkov Do you mind reviewing this too? Thanks |
@AlexeySachkov ping on this one when you get a sec |
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 don't think that my comments are blocking, but to me they seem as a good cleanup which we can do
auto *SpecConstsMD = | ||
M.getNamedMetadata(SpecConstantsPass::SPEC_CONST_MD_STRING); | ||
bool SpecConstsMet = | ||
SpecConstsMD != nullptr && SpecConstsMD->getNumOperands() != 0; |
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.
Both collectSpecConstantMetadata
and collectSpecConstantDefaultValuesMetadata
perform this metadata check:
llvm/llvm/lib/SYCLLowerIR/SpecConstants.cpp
Lines 1035 to 1039 in 9723157
bool SpecConstantsPass::collectSpecConstantMetadata(const Module &M, | |
SpecIDMapTy &IDMap) { | |
NamedMDNode *MD = M.getNamedMetadata(SPEC_CONST_MD_STRING); | |
if (!MD) | |
return false; |
Therefore, I wonder if we just need to omit it all together and instead put PropSet.add
under condition that TmpSpecIDMap
is not empty.
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, ill try this and make a follow-up PR if it works
@@ -1029,6 +1026,9 @@ PreservedAnalyses SpecConstantsPass::run(Module &M, | |||
for (const auto &P : DefaultsMetadata) | |||
MDDefaults->addOperand(P); | |||
|
|||
if (Mode == HandlingMode::default_values) |
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.
Conceptually, HandlingMode
is both set outside of the pass and read outside of the pass (that property to indicate that a device image was produced with default values of spec constants), so it seems to me that that metadata is better to be set somewhere outside the pass.
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.
yeah i debated this, let me try putting it somewhere when we do the default split, will do in follow-up pr thx
Follow-up PR #15346 |
Addressing review feedback from #15271 Signed-off-by: Sarnie, Nick <[email protected]>
Computing information about spec consts is difficult for callers when module properties generation and splitting are separate. Simplify it by storing information in module we can use invisibly to the caller.
This will be used for thinLTO, where we split early and compute module properties later.
This should be basically NFC.