[PATCH] D150965: [HIP] Allow std::malloc in device function

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 19 07:31:59 PDT 2023


yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a project: All.
yaxunl requested review of this revision.

D106463 <https://reviews.llvm.org/D106463> caused a regression that prevents std::malloc to be
called in the device function, which is allowed with nvcc.

Basically the standard C++ header introducing malloc in
std namespace by `using ::malloc`. The device ::malloc
function needs to be declared before `using ::malloc`
to be introduced into std namespace.

Revert D106463 <https://reviews.llvm.org/D106463> and add a test.


https://reviews.llvm.org/D150965

Files:
  clang/lib/Headers/__clang_hip_runtime_wrapper.h
  clang/test/Headers/Inputs/include/cstdlib
  clang/test/Headers/Inputs/include/math.h
  clang/test/Headers/Inputs/include/sstream
  clang/test/Headers/Inputs/include/stdexcept
  clang/test/Headers/hip-header.hip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150965.523762.patch
Type: text/x-patch
Size: 8466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230519/db1adb5d/attachment-0001.bin>


More information about the cfe-commits mailing list