This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add an option to disable manual ctor / dtor lowering
ClosedPublic

Authored by jhuber6 on May 15 2023, 6:04 AM.

Details

Summary

Currently AMDGPU offers extra ctor / dtor lowering by emitting a kernel
that can be called. It's possible to handle ctors and dtors using the
standard method as shown in D149340's commit message. In which case we
on't need these extra kernels as they won't be called. This patch simply
adds a way to conditionally turn off this handling if we do not want to
get extra kernels in the output.

Unrelated, but we could convert this handling to an ODR function that simply
calls the code in D149340 constructed via LLVM-IR. That would handle priority
correctly and would then be correct if not run in LTO mode.

Diff Detail

Event Timeline

jhuber6 created this revision.May 15 2023, 6:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 6:04 AM
jhuber6 requested review of this revision.May 15 2023, 6:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 6:04 AM

Typo "on't" in commit message.

What's the long term plan here? I'd prefer to move towards something that acts like a consistent platform rather than sometimes lowering these based on a debug flag. What would be setting this?

Typo "on't" in commit message.

What's the long term plan here? I'd prefer to move towards something that acts like a consistent platform rather than sometimes lowering these based on a debug flag. What would be setting this?

I'm currently working on a patch to make this more common at least so we simply traverse the init / fini sections inside this kernel call. The reason for this patch is simply that this method of construction requires a kernel call while the libc project I'm working on chooses to perform this step manually. So I would simply like the idea to optionally disable the extra handling if it's not needed.

yaxunl accepted this revision.May 23 2023, 6:45 AM

LGTM

This revision is now accepted and ready to land.May 23 2023, 6:45 AM
This revision was landed with ongoing or failed builds.May 23 2023, 7:03 AM
This revision was automatically updated to reflect the committed changes.