[CUDA, NVPTX] accept/ignore any -mcmodel arguments.#70740
Conversation
Code model has no impact on NVPTX as we do not produce any object files, but we need to avoid erroring out on the -mcmodel argument passed to the top-level compilation and propagated to all sub-compilations.
|
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Artem Belevich (Artem-B) ChangesCode model has no impact on NVPTX as we do not produce any object files, but we need to avoid erroring out on the -mcmodel argument passed to the top-level compilation and propagated to all sub-compilations. Full diff: https://github.com/llvm/llvm-project/pull/70740.diff 1 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 43a92adbef64ba8..fb90fcd033b1ac3 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5743,6 +5743,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
} else if (Triple.getArch() == llvm::Triple::x86_64) {
Ok = llvm::is_contained({"small", "kernel", "medium", "large", "tiny"},
CM);
+ } else if (Triple.isNVPTX()) {
+ // NVPTX does not care about the code model and will accept whatever works
+ // for the host.
+ Ok = true;
}
if (Ok) {
CmdArgs.push_back(Args.MakeArgString("-mcmodel=" + CM));
|
|
The current filtering mechanism is gross. We have code that does the following error checking for a lot of options and there are more and more of them. It is nearly infeasible to enumerate them. When such an option is used in
https://reviews.llvm.org/D105226 introduced a special case to exclude NVPTX for I do not know whether we should use something similar to |
|
should this have had a test? I'm trying to do the same thing for edit: actually #77958 seems to have worked around this |
The code model doesn't affect the sub-compilation, so don't check it. Followup to llvm#70740.
The code model doesn't affect the sub-compilation, so don't check it. Followup to #70740.
The code model doesn't affect the sub-compilation, so don't check it. Followup to llvm#70740.
Code model has no impact on NVPTX as we do not produce any object files, but we need to avoid erroring out on the -mcmodel argument passed to the top-level compilation and propagated to all sub-compilations.