This is an archive of the discontinued LLVM Phabricator instance.

[NFC] [libomptarget] Move option.h into target_impl.h, name a magic number
AbandonedPublic

Authored by JonChesterfield on Oct 24 2019, 10:58 PM.

Details

Summary

[NFC] [libomptarget] Move option.h into target_impl.h, name a magic number

Essentially everything under option.h is target dependent. This change moves the
existing code and names a mask that depends on the warp/wavefront size.

The macros could be changed to enums / functions / deleted subsequently.

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2019, 10:58 PM
ABataev added inline comments.Oct 25 2019, 6:51 AM
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
57–62

Is this a platform-dependent thing?

JonChesterfield marked 2 inline comments as done.Oct 25 2019, 8:27 AM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
133

Note that this change from 0x1F to a function of warp size means the mask is 0x3F on 64 wide systems.

openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
57–62

The inline/noinline macros are different for cuda and hip. Possibly also different for opencl, though I haven't checked.

True/false macros are things that happened to be in option.h. True is unused, false has a few uses related to debug printing. I'd like to remove those subsequently.

ABataev added inline comments.Oct 25 2019, 8:39 AM
openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
133

Maybe it would be better to add 2 new functions, like getWarpId() and getThreadIdInWarp() or something like this and make them platform-dependent?

openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
57–62

My question was not about inine/noinline, just about true/false stuff. They do not look like the platform dependent stuff. If you say that you can remove them, just remove them, no need to move it to the platform-specific header.

  • Remove TRUE/FALSE macros
  • add platform dependent functions to wrap warp size dependency
JonChesterfield added a comment.EditedOct 25 2019, 9:23 AM

Not totally sure on __kmpcImplGetWarpId vs __kmpv_impl_get_warp_id, but suspect we should start to prefer the former.

JonChesterfield marked 2 inline comments as done.Oct 25 2019, 9:23 AM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/nvptx/src/debug.h
133

Like it, thanks.

openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
57–62

Also good, done.

If everybody else is fine with the naming of the functions, the patch is good to go, I think.

If everybody else is fine with the naming of the functions, the patch is good to go, I think.

Sticking with the local convention is probably less contentious, I think I'll swap it over. At some point we can run a find & replace across the rtl to change to the llvm style.

  • use local convention for naming, clang-format changed functions
ABataev added inline comments.Oct 25 2019, 9:59 AM
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
135–141

Maybe, split this patch into 2 and introduce these functions and new processing of check functions in the new patch?

JonChesterfield marked an inline comment as done.Oct 25 2019, 10:13 AM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
135–141

I'm not sure we gain much by dividing this patch. If you like I could split it into something like:

  • delete macros
  • move constants into target_impl
  • introduce & use one function
  • introduce & use the other function

I don't have time to do that just now but will be able to later

ABataev added inline comments.Oct 25 2019, 10:18 AM
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
135–141

2 last can be merged into 1. All other steps look good.

JonChesterfield abandoned this revision.Oct 25 2019, 10:29 AM
JonChesterfield marked an inline comment as done.
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
135–141

Cool. Will do so later today / early tomorrow. Cheers

openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h