Skip to content

Improve argument filtering for CUDA sub-compilations targeting NVPTX #70745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Artem-B opened this issue Oct 30, 2023 · 2 comments
Open

Improve argument filtering for CUDA sub-compilations targeting NVPTX #70745

Artem-B opened this issue Oct 30, 2023 · 2 comments
Assignees
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' cuda

Comments

@Artem-B
Copy link
Member

Artem-B commented Oct 30, 2023

From #70740 (comment)

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.

if (!Triple.isXXX()) { err_unsupported_opt_for_target } else handle
When such an option is used in clang++ --cuda-path=/usr/local/cuda -x cu /dev/null -c -nocudainc -nocudalib $option, we will get an error for NVPTX.

-mcmodel= turned out to be an issue just because we add this option globally.

https://reviews.llvm.org/D105226 introduced a special case to exclude NVPTX for -fbasic-block-sections=, so this has a precedent, but we should figure out a way to handle the target-specific options in a more elegant way.

I do not know whether we should use something similar to -fembed-bitcode's list.

@Artem-B Artem-B self-assigned this Oct 30, 2023
@Artem-B Artem-B added cuda clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Oct 30, 2023
@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2023

@llvm/issue-subscribers-clang-driver

Author: Artem Belevich (Artem-B)

From https://github.com//pull/70740#issuecomment-1786180822

>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.
>
> if (!Triple.isXXX()) { err_unsupported_opt_for_target } else handle
When such an option is used in clang++ --cuda-path=/usr/local/cuda -x cu /dev/null -c -nocudainc -nocudalib $option, we will get an error for NVPTX.
>
> -mcmodel= turned out to be an issue just because we add this option globally.
>
> https://reviews.llvm.org/D105226 introduced a special case to exclude NVPTX for -fbasic-block-sections=, so this has a precedent, but we should figure out a way to handle the target-specific options in a more elegant way.
>
> I do not know whether we should use something similar to -fembed-bitcode's list.

@Artem-B
Copy link
Member Author

Artem-B commented Oct 31, 2023

Stack protector options: #70799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' cuda
Projects
None yet
Development

No branches or pull requests

3 participants