Skip to content

Conversation

schittir
Copy link
Contributor

@schittir schittir commented Aug 26, 2025

This patch fixes test failures caused by the upstream patch that adds sycl_external attribute and restricts emitting device code.

@schittir schittir changed the base branch from sycl to sycl-web August 27, 2025 15:43
@schittir schittir marked this pull request as ready for review August 27, 2025 17:48
@schittir schittir requested a review from a team as a code owner August 27, 2025 17:48
@@ -3,7 +3,7 @@
// RUN: %clang_cc1 -O1 -triple spirv32 -cl-std=CL3.0 -x cl %s -emit-llvm -o - | FileCheck %s

#ifdef __SYCL_DEVICE_ONLY__
Copy link
Contributor

Choose a reason for hiding this comment

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

Something seems off here. Why would __SYCL_DEVICE_ONLY__ be defined for the runs that don't include -fsycl-is-device? -x cl doesn't somehow imply SYCL, does it?

Copy link
Contributor

Choose a reason for hiding this comment

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

The very first line runs clang with -fsycl-is-device.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, and this makes sense for that RUN line. My question is about the other two RUN lines that pass -x cl and don't pass -fsycl-is-device. The code presumes that __SYCL_DEVICE_ONLY__ is defined for those RUN lines as well and I don't understand why that would be the case. I also find it odd that an attribute named sycl_device is expected to be used in a non-SYCL OpenCL compilation. I would expect an attribute named opencl_device or similar instead.

Copy link
Contributor

@tahonermann tahonermann left a comment

Choose a reason for hiding this comment

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

I think this looks good, but the latest changes should make it unnecessary to add __attribute__((sycl_device)). If that isn't the case, then I'm confused (again).

Comment on lines 6904 to 6907
!D->hasAttr<SYCLDeviceAttr>() &&
!(D->hasAttr<SYCLDeviceAttr>() || D->hasAttr<SYCLExternalAttr>()) &&
!SemaSYCL::isTypeDecoratedWithDeclAttribute<SYCLDeviceGlobalAttr>(
D->getType()))
return getLangOpts().GPURelocatableDeviceCode
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to do something similar to this in upstream as part of fixing emit of inline functions in device code.

@schittir schittir requested a review from tahonermann September 2, 2025 17:35
Copy link
Contributor

@tahonermann tahonermann left a comment

Choose a reason for hiding this comment

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

This looks perfect, thank you @schittir!

@schittir
Copy link
Contributor Author

schittir commented Sep 2, 2025

Thank you for reviewing this, @tahonermann @Fznamznon @premanandrao !

@schittir schittir merged commit 692287a into intel:sycl-web Sep 2, 2025
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.

4 participants