Skip to content

[Driver] Test ignored target-specific options for AMDGPU/NVPTX #79222

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clang/test/Driver/unsupported-option-gpu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// Some target-specific options are ignored for GPU, so %clang exits with code 0.
// DEFINE: %{check} = %clang -### -c -mcmodel=medium
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what exactly are we checking here? With -### CC1 sub-compilations do not run and, I think, that's where unsupported options were triggering warning/errors.

We're still only running the top-level driver. Weren't errors reported by cc1 compilation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably depends on the option we're testing. We could do both.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case, the changes we test (and the error messages) were originating in the driver, so we're OK with -###.

That said, we do have other options that we do need to suppress/ignore and some of that does happen on cc1 level.

We'll eventually need to add the tests for those here and then enable actual compilation, but it should not hold this patch back.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the error reporting is done in the driver and cc1 allows and ignores options that may be specific to other targets.

That said, we do have other options that we do need to suppress/ignore and some of that does happen on cc1 level.

Perhaps we should figure out them and check whether they should be moved to the driver


// RUN: %{check} -x cuda %s --cuda-path=%S/Inputs/CUDA/usr/local/cuda --offload-arch=sm_60 --no-cuda-version-check -fbasic-block-sections=all
// RUN: %{check} -x hip %s --rocm-path=%S/Inputs/rocm -nogpulib -nogpuinc