Skip to content

[NFC][SYCL] Minor stylistic changes in SYCLPropagateAspectsUsage.cpp #7049

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 5 commits into from
Oct 17, 2022

Conversation

aelovikov-intel
Copy link
Contributor

No description provided.

@aelovikov-intel
Copy link
Contributor Author

I also think that https://github.com/intel/llvm/pull/7049/files#diff-68d289383a30446b6ac4a16059d3b19708674ac2562fa5ddb8af87fb5158e9cdL273-L275 should be re-written using depth_first (or similar) iterators to avoid manual Visited set tracking. Should be another PR though.

@aelovikov-intel aelovikov-intel marked this pull request as draft October 13, 2022 17:01
@AlexeySachkov
Copy link
Contributor

I also think that https://github.com/intel/llvm/pull/7049/files#diff-68d289383a30446b6ac4a16059d3b19708674ac2562fa5ddb8af87fb5158e9cdL273-L275 should be re-written using depth_first (or similar) iterators to avoid manual Visited set tracking

Do I understand correctly that a suggestion here is to switch to some existing call graph handling data structure (perhaps llvm::CallGraph?), which will do Visited tracking for us under the hood, thus simplifying the pass code?

const Constant *C = CAM->getValue();
Aspects.insert(cast<ConstantInt>(C)->getSExtValue());
}
for (const MDOperand &Op : drop_begin(N->operands()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know that such helpers exist, thanks!

@aelovikov-intel
Copy link
Contributor Author

Do I understand correctly that a suggestion here is to switch to some existing call graph handling data structure (perhaps llvm::CallGraph?), which will do Visited tracking for us under the hood, thus simplifying the pass code?

I didn't have a deep look (and I still need to address CI failures for this version before starting any other refactoring), but I'd expect the answer is "not quite". I think we'd have the same data structure but the code traversing it would be different. Instead of the Visited set and manual recursion we'll create graph traits specialization and then use it to start llvm::depth_first traversal. It would look somewhat like this (pseudocode):

template <>
struct GraphTraits<CallGraphNode> {
// immediate children iterators.
};

CallGraph CG{...};
for (Function &F : depth_first(CG->getRootNode)) {
   // Process F.
}

Also add a comment why that was so.
@aelovikov-intel
Copy link
Contributor Author

The same ESIMD EMU failures:

Failed Tests (2):
SYCL :: dword_atomic_smoke.cpp
SYCL :: lsc/lsc_fence.cpp

are seen on another PR hence unrelated to this one.

@aelovikov-intel aelovikov-intel marked this pull request as ready for review October 14, 2022 18:42
Copy link
Contributor

@asudarsa asudarsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice change to showcase good coding practices. Thanks

@bader bader merged commit fe32777 into intel:sycl Oct 17, 2022
@aelovikov-intel aelovikov-intel deleted the aspects branch November 8, 2022 20:44
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.

5 participants