[libc-commits] [PATCH] D146256: [libc] Enable integration tests targeting the GPU

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Mar 17 11:40:16 PDT 2023


sivachandra added a comment.

In D146256#4202873 <https://reviews.llvm.org/D146256#4202873>, @JonChesterfield wrote:

> Libc could walk the ctors array before main and the dtors after, as normal function pointers. We might even be able to persuade hip or openmp to lower their ctor/dtors as function pointers in the same arrays, where they happen to launch a special kernel that walks at least one of them.

On linux/ELF platforms, the libc already runs through the function pointers in `.init_array and `.fini_arry`: https://github.com/llvm/llvm-project/blob/main/libc/startup/linux/x86_64/start.cpp#L111

If the GPU side of things can follow the same pattern, then it should be straight forward to extend the Linux ways to GPUs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146256/new/

https://reviews.llvm.org/D146256



More information about the libc-commits mailing list