This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][amdgcn] Drop use of inttypes.h, moving closer to freestanding
ClosedPublic

Authored by JonChesterfield on Mar 12 2021, 3:47 PM.

Details

Summary

[libomptarget][amdgcn] Drop use of inttypes.h, moving closer to freestanding

The glibc headers are a periodic source of problems compiling the devicertl.
This patch resolves the following error run into while building llvm on a slightly
different linux system.

In file included from .../lib/clang/13.0.0/include/inttypes.h:21:
In file included from /usr/include/inttypes.h:25:
/usr/include/features.h:461:12: fatal error: 'sys/cdefs.h' file not found
#  include <sys/cdefs.h>
           ^~~~~~~~~~~~~

As a second patch, removing assert.h from shuffle will let amdgcn build as
-ffreestanding, at which point only the headers that clang itself provides are
used and interactions with the host glibc are eliminated. Doing the same for
nvptx is complicated by printf handling but also seems worthwhile.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Mar 12 2021, 3:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 3:47 PM
JonChesterfield edited the summary of this revision. (Show Details)Mar 12 2021, 3:48 PM
openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
24

Could equally remove the handful of uses of these macros, but this seems fine. The target_impl header is internal to the library.

openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h
19

This didn't use stuff from inttypes specifically, stdint suffices

This revision is now accepted and ready to land.Mar 13 2021, 6:41 PM
This revision was landed with ongoing or failed builds.Mar 15 2021, 9:55 AM
This revision was automatically updated to reflect the committed changes.