Skip to content

[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

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Sep 3, 2024

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.

@sarnex sarnex marked this pull request as ready for review September 3, 2024 20:07
@sarnex sarnex requested a review from a team as a code owner September 3, 2024 20:07
@sarnex sarnex requested a review from AlexeySachkov September 3, 2024 20:07
Copy link
Contributor

@maksimsab maksimsab left a 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.

@sarnex
Copy link
Contributor Author

sarnex commented Sep 5, 2024

@AlexeySachkov Do you mind reviewing this too? Thanks

@sarnex
Copy link
Contributor Author

sarnex commented Sep 9, 2024

@AlexeySachkov ping on this one when you get a sec

Copy link
Contributor

@AlexeySachkov AlexeySachkov left a 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

Comment on lines +153 to +156
auto *SpecConstsMD =
M.getNamedMetadata(SpecConstantsPass::SPEC_CONST_MD_STRING);
bool SpecConstsMet =
SpecConstsMD != nullptr && SpecConstsMD->getNumOperands() != 0;
Copy link
Contributor

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:

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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

@sarnex sarnex merged commit 594ae74 into intel:sycl Sep 10, 2024
13 checks passed
@sarnex
Copy link
Contributor Author

sarnex commented Sep 10, 2024

Follow-up PR #15346

sarnex added a commit that referenced this pull request Sep 11, 2024
Addressing review feedback from #15271

Signed-off-by: Sarnie, Nick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants