[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-12-05 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment. In D138862#3955581 , @tra wrote: > OK. So, we do need a flag, at least for now. I think we'll need a new one, > because `-freestanding` will likely do a lot of things we don't actually want > on the host side. > How about `--off

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. OK. So, we do need a flag, at least for now. I think we'll need a new one, because `-freestanding` will likely do a lot of things we don't actually want on the host side. How about `--offload-generic` or `--[no-]offload-runtime`. Repository: rG LLVM Github Monorepo CHA

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment. In D138862#3955502 , @tra wrote: > However, we probably need some sort of safeguards warning users if they > compile CUDA *kernels* or code w/ global variable in freestanding mode. The behavior of `-ffreestanding` isn't well do

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D138862#3955364 , @jhuber6 wrote: > So this patch was made because I'm trying to create a generic `libc` runtime > for the GPU. OK. That simplifies things. GPU-side non-kernel functions do not need anything from CUDA host runtim

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment. In D138862#3955461 , @JonChesterfield wrote: > Does this change the annotation on kernels compiled from C or C++ with > -ffreestanding? If so, probably want a test showing the change. I have a > vague idea that they pick up a d

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment. Does this change the annotation on kernels compiled from C or C++ with -ffreestanding? If so, probably want a test showing the change. I have a vague idea that they pick up a default of 'opencl' at present, where 'none' is probably better. Or perhaps this is onl

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment. In D138862#3955339 , @tra wrote: >> we should expect it to be handled externally. > > Can you give more details on how it will work? Something/somewhere would need > to generate the glue code to register kernels w/ CUDA runtime.

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. > we should expect it to be handled externally. Can you give more details on how it will work? Something/somewhere would need to generate the glue code to register kernels w/ CUDA runtime. Are you saying that we'll have some way to tell the final linking stage that all offl

[PATCH] D138862: [Clang] Do not set offload kind in a freestanding build

2022-11-28 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision. jhuber6 added reviewers: jdoerfert, JonChesterfield, tra, yaxunl, tianshilei1992, MaskRay. Herald added a subscriber: StephenFan. Herald added a project: All. jhuber6 requested review of this revision. Herald added subscribers: cfe-commits, sstefan1. Herald added a p