This is an archive of the discontinued LLVM Phabricator instance.

Partially revert "clang/HIP: Remove __llvm_amdgcn_* wrapper hacks"
ClosedPublic

Authored by arsenm on Jul 21 2023, 10:38 AM.

Details

Reviewers
yaxunl
Summary

Revert part of f407a7399575a6821940973c54754d42e72dd9ce.

Some of the HIP headers were using the f16 rcp inline, such that it
breaks compiling code against non-top-of-tree headers. Need to wait
for a few HIP releases to expire to fully remove these.

Fixes #63981

Diff Detail

Event Timeline

arsenm created this revision.Jul 21 2023, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 10:38 AM
arsenm requested review of this revision.Jul 21 2023, 10:38 AM
yaxunl added inline comments.Jul 21 2023, 10:43 AM
clang/lib/Headers/__clang_hip_libdevice_declares.h
322

Can we add the deprecated attribute to urge people not to use them?

327

same as above

arsenm added inline comments.Jul 21 2023, 10:44 AM
clang/lib/Headers/__clang_hip_libdevice_declares.h
322

I initially added those, but thought it was a bit aggressive to put in always included headers. Is there an established practice for deprecating builtin header functions?

arsenm added inline comments.Jul 21 2023, 10:46 AM
clang/lib/Headers/__clang_hip_libdevice_declares.h
322

Is there a hip header version macro I could guard this on?

yaxunl added inline comments.Jul 21 2023, 11:36 AM
clang/lib/Headers/__clang_hip_libdevice_declares.h
322

I initially added those, but thought it was a bit aggressive to put in always included headers. Is there an established practice for deprecating builtin header functions?

I saw it used by libstdc++ headers and pthread headers to deprecate APIs.

I think it is common practice to use deprecate attibute.

We'd also better mention it in clang release note and give a timeline to remove it, e.g. next clang major release.

322

Is there a hip header version macro I could guard this on?

Yes like https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/__clang_hip_runtime_wrapper.h#L80

arsenm updated this revision to Diff 543025.Jul 21 2023, 12:23 PM

Add versioned deprecated macro

yaxunl added inline comments.Jul 21 2023, 3:35 PM
clang/lib/Headers/__clang_hip_libdevice_declares.h
13–15

pls condition this with

#if !defined(__HIPCC_RTC__)
#endif

Since for hiprtc we concatenate header files linearly into one header file.

321

How about providing a replacement hint:

#define __DEPRECATED_SINCE_HIP_560(replacement) __attribute__((deprecated("replaced by clang builtin", #replacement)))
arsenm updated this revision to Diff 543111.Jul 21 2023, 4:15 PM
arsenm marked an inline comment as done.
arsenm marked an inline comment as done.
yaxunl accepted this revision.Jul 21 2023, 7:21 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Jul 21 2023, 7:21 PM