Skip to content
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

[SYCL] Move driver related __CUDA_ARCH__ test to Driver folder from Preprocessor #15521

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

GeorgeWeb
Copy link
Contributor

@GeorgeWeb GeorgeWeb commented Sep 26, 2024

This PR moves the driver invocation test that checks __CUDA_ARCH__ does not get defined and ensures that it doesn't require the libspirv-nvptx64-nvidia-cuda bitcode files by passing -fno-sycl-libspirv to the %clangxx command.
Link to the comment in related PR that reported this issue: #15441 (comment)
Additionally, an extra test is added to check that the -fcuda-is-device option is not supplied in the CC1 invocation targeting nvptx64-nvidia-cuda, which enables LangOptions.CudaIsDevice and was the cause of defining the __CUDA_ARCH__ macro.

@@ -0,0 +1,3 @@
// RUN: %clangxx %s -fsycl -nocudalib -fno-sycl-libspirv -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend --offload-arch=sm_80 -E -dM \
// RUN: | FileCheck --check-prefix=CHECK-CUDA-ARCH-MACRO %s
// CHECK-CUDA-ARCH-MACRO-NOT: #define __CUDA_ARCH__ {{[0-9]+}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the original nature of the driver change, one thing we should also verify is that -fcuda-is-device is not supplied with -fsycl -fsycl-targets=nvptx64-nvidia-cuda for the device compilation (-### check)

Copy link
Contributor Author

@GeorgeWeb GeorgeWeb Sep 27, 2024

Choose a reason for hiding this comment

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

@mdtoguchi Thanks for being rigorous here! That's definitely what the original change prevented, where the unwanted macro was a product of this. I've added the test and updated the PR description accordingly.
Let me know if you think something needs to be updated.

@@ -0,0 +1,11 @@
// Verify the __CUDA_ARCH__ macro has not been defined when offloading SYCL on NVPTX
Copy link
Contributor

Choose a reason for hiding this comment

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

Are AMDGPU targets covered by other tests? FYI: #15544

Copy link
Contributor Author

@GeorgeWeb GeorgeWeb Sep 30, 2024

Choose a reason for hiding this comment

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

Thanks for catching this. I had noticed the macro being defined in the HIP toolchain at the time of fixing the regression for the Cuda flow. It isn't tested correctly.

I made a draft PR (here #15443) for HIP-AMDGPU right after the Cuda one and I was planning to make it ready for review after this gets merged. Seems others caught it too in the meantime. I'll add a sycl clang driver for AMDGPU targets here as part of the said PR.

@bader
Copy link
Contributor

bader commented Oct 1, 2024

@intel/dpcpp-cfe-reviewers, @intel/dpcpp-clang-driver-reviewers, ping.

@srividya-sundaram
Copy link
Contributor

ensures that it doesn't require the libspirv-nvptx64-nvidia-cuda bitcode files

Since this is mentioned in the description, should this be tested as well?

@GeorgeWeb
Copy link
Contributor Author

ensures that it doesn't require the libspirv-nvptx64-nvidia-cuda bitcode files

Since this is mentioned in the description, should this be tested as well?

This is just so we can compile and run the tests without requiring an NVPTX target builds or having to specify manually the path to the libspirv libs. There isn't a behavioural change related to this to be tested. Maybe I can reword the description so it's less confusing as the changes here are just an update to a fix to the CUDA_ARCH macro from a previous PR.

Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

FE change LGTM

@bader bader merged commit 1f12cae into intel:sycl Oct 2, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants