This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][nfc] Move non-freestanding headers out of common
ClosedPublic

Authored by JonChesterfield on Mar 30 2020, 9:23 AM.

Details

Summary

[libomptarget][nfc] Move non-freestanding headers out of common

Lowers the bar for building deviceRTL.
Drops math.h entirely as it wasn't used and libm is a big dependency.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2020, 9:23 AM
JonChesterfield marked an inline comment as done.Mar 30 2020, 9:25 AM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
21

No stdio in amdgcn's target_impl as the only function used from it is printf, declared at the end of this header.

Can reduce amdgcn to wholly ffreestanding by providing an implementation of assert and two macros from inttypes, which may be a good idea as I think HIP is currently using the glibc versions of these headers for the device code.

jdoerfert added inline comments.Mar 30 2020, 4:08 PM
openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
21

I think this seems reasonable, depending on the macros.

JonChesterfield marked an inline comment as done.Mar 30 2020, 5:44 PM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
21

The macros are PRId64 and PRIu64 iirc, which expand to "ld"/"lu". Pretty minor. For a later patch anyway.

This reduces the requirements on common code to freestanding, target_impl functions, printf, assert, two print format macros. It's still quite a lot, but much less than stdlib + math suggests.

jdoerfert accepted this revision.Mar 30 2020, 7:38 PM

LGTM. Let's look at freestanding later.

This revision is now accepted and ready to land.Mar 30 2020, 7:38 PM
This revision was automatically updated to reflect the committed changes.