Skip to content

Port Local Accessor and Global Offset passes to the new PM #5987

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 7 commits into from
May 24, 2022

Conversation

jchlanda
Copy link
Contributor

@jchlanda jchlanda commented Apr 8, 2022

This patch ports Local Accessor and Global Offset passes to the new pass manager. As most of other passes in both AMDGPU and NVPTX backends are still running with the legacy PM, it provides a legacy struct that wraps around the new PM and lets the old interface be used.

Fixes: #5310

@jchlanda jchlanda requested review from a team and bader as code owners April 8, 2022 09:37
@jchlanda jchlanda requested a review from cperkinsintel April 8, 2022 09:37
@jchlanda jchlanda marked this pull request as draft April 8, 2022 09:38
@jchlanda jchlanda force-pushed the jakub/new_pm_port branch from 83416fe to 516adb9 Compare April 8, 2022 09:49
@jchlanda jchlanda force-pushed the jakub/new_pm_port branch from 516adb9 to 8b58ffb Compare May 6, 2022 07:01
@jchlanda jchlanda marked this pull request as ready for review May 6, 2022 07:14
@jchlanda jchlanda changed the title [WIP] Port Local Accessor and Global Offset passes to the new PM Port Local Accessor and Global Offset passes to the new PM May 6, 2022
@jchlanda jchlanda force-pushed the jakub/new_pm_port branch from 8b58ffb to 610f41d Compare May 13, 2022 08:51
@AerialMantis
Copy link
Contributor

@pvchupin now that #5855 is merged we have rebased this, so we're ready for it to be reviewed now.

@pvchupin
Copy link
Contributor

@bader, feel free to review as well.

Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

Please add/move documentation to the header where the declarations are. Other comments are optional.

ArrayType::get(Type::getInt32Ty(M.getContext()), 3);
ImplicitOffsetPtrType =
Type::getInt32Ty(M.getContext())->getPointerTo(TargetAS);
assert((!ImplicitOffsetIntrinsic ||
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this possible? Don't we early return at line 79?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeap, you are right, will simplify.

jchlanda and others added 3 commits May 17, 2022 11:01
Co-authored-by: aelovikov-intel <andrei.elovikov@intel.com>
Co-authored-by: aelovikov-intel <andrei.elovikov@intel.com>
@jchlanda jchlanda requested a review from aelovikov-intel May 18, 2022 09:29
@jchlanda
Copy link
Contributor Author

@aelovikov-intel I think I've addressed all your comments, please give me a shout if I've missed anything.

@pvchupin
Copy link
Contributor

ping @asudarsa

@asudarsa
Copy link
Contributor

ping @asudarsa

Looking at this review now. Thanks

class ModulePass;
class PassRegistry;

/// This pass operates on SYCL kernels. It looks for uses of the
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this comment be: This pass operates on SYCL kernels that target AMDGPU or NVVM.


private:
/// After the execution of this function, the module to which the kernel
/// `Func` belongs contains a clone of the original kernel with the signature
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please specify if the original kernel is deleted or not? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not, will expand the comment.


} // end anonymous namespace
DenseMap<Function *, MDNode *> GlobalOffsetPass::validateKernels(
Copy link
Contributor

Choose a reason for hiding this comment

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

This function does two tasks: 1. validate kernels and 2. extract all entry point metadata. For readability sake, it could be useful be split it into two separate functions, one for each of the above tasks. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that the naming might be a bit misleading, how about I rename it to generateKernelMDNodeMap and update the comments. Splitting the function to do essentially one operation over the same loop of kernels seems a bit wasteful.

virtual llvm::StringRef getPassName() const override {
return "SYCL Local Accessor to Shared Memory";
bool runOnModule(Module &M) override {
ModuleAnalysisManager DummyMAM;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This can just be called MAM

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. Thanks a lot for these changes.

@pvchupin pvchupin merged commit 231fa3f into intel:sycl May 24, 2022
yinyangsx pushed a commit to yinyangsx/llvm that referenced this pull request May 25, 2022
This patch ports Local Accessor and Global Offset passes to the new pass manager. As most of other passes in both AMDGPU and NVPTX backends are still running with the legacy PM, it provides a legacy struct that wraps around the new PM and lets the old interface be used.

Fixes: intel#5310
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.

[SYCL] Port LocalAccessorToSharedMemory and GlobalOffset to new PM
5 participants