In preparation for allowing other offloading kinds to use the new driver
a new opt-in flag -foffload-new-driver is added. This is distinct from
the existing -fopenmp-new-driver because OpenMP will soon use the new
driver by default while the others should not.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Driver/Driver.cpp | ||
---|---|---|
3979–3982 | If OPT_fopenmp_new_driver is on by default, then OPT_foffload_new_driver will have no effect. Is this intended? Should OPT_fopenmp_new_driver be conditioned for OpenMP offloading only? |
clang/lib/Driver/Driver.cpp | ||
---|---|---|
3979–3982 | Yeah, I need to rework the logic here once OpenMP moves to the new driver by default. I can probably require something like. (C.isOffloadingHostKind(Action::OFK_OpenMP) && !Args.hasArg(options::OPT_fno_offload_new_driver) || Args.hasArg(options::OPT_fopenmp_new_driver); Currently working on the patch to make this default for OpenMP so I'll be able to update this after that. |
should we have a test to show the effect of -foffload-new-driver on -ccc-print-phases for CUDA/HIP?
We probably should, it's tested w/ OpenMP but we should check the bound architectures and such. I can add one.
I decided to add the test in D120272 because this file only adds support for the option.
clang/include/clang/Driver/Options.td | ||
---|---|---|
2535–2538 | Nit: Can we combine that into a BoolFOption instead of using Flag ? Also, considering that it's an option which controls the driver's behavior, not just tweaks code generation, perhaps it should be just --[no]offload-new-driver. |
clang/include/clang/Driver/Options.td | ||
---|---|---|
2535–2538 | The -fopenmp variant was in LLVM-14 so that should stay at least. I could change it to be --offload (Although this does tweak code generation in a later patch to make the offloading entries). I most just used -f because all the other OpenMP options use -f. I could definitely use BoolFOption but I don't think it saves too much in this situation. |
clang/include/clang/Driver/Options.td | ||
---|---|---|
2535–2538 | Naming is hard. :-) Real world things don't want to fit into neat categories. I think --offload* would fit the general pattern of transitioning niche features (be it CUDA,HIP, OpenMP) into something more general (offload, GPU). |
clang/include/clang/Driver/Options.td | ||
---|---|---|
2535–2538 | Sure, I'll change it to just be offload. |
Nit: Can we combine that into a BoolFOption instead of using Flag ?
Also, considering that it's an option which controls the driver's behavior, not just tweaks code generation, perhaps it should be just --[no]offload-new-driver.