-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Always warn when -fno-sycl-libspirv opt used. #7378
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
Conversation
Signed-off-by: JackAKirk <[email protected]>
Signed-off-by: JackAKirk <[email protected]>
"when using the '%0' triple">, | ||
InGroup<NoLibspirvHipCuda>; | ||
def warn_flag_no_sycl_libspirv_has_no_effect | ||
: Warning<"no-sycl-libspirv option has no effect when compiled with the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about - ignoring option 'fno-sycl-libspirv' for triple "%0"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe generalize even more for possible usage in the future: ignoring option '%0' for triple '%1'
.
We have an existing warn_drv_unsupported_option_for_target
but the verbiage may not match what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense to me. I'll make this change.
@@ -1316,6 +1316,9 @@ def CudaUnknownVersion: DiagGroup<"unknown-cuda-version">; | |||
// ignored by CUDA. | |||
def HIPOnly : DiagGroup<"hip-only">; | |||
|
|||
// A warning used when compiling for HIP or CUDA without linking LIBSPIRV. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A warning generated when compiling SYCL applications for HIP or CUDA backends without linking LIBSPIRV
"when using the '%0' triple">, | ||
InGroup<NoLibspirvHipCuda>; | ||
def warn_flag_no_sycl_libspirv_has_no_effect | ||
: Warning<"no-sycl-libspirv option has no effect when compiled with the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe generalize even more for possible usage in the future: ignoring option '%0' for triple '%1'
.
We have an existing warn_drv_unsupported_option_for_target
but the verbiage may not match what we want.
@@ -96,6 +96,15 @@ def err_drv_cuda_host_arch : Error< | |||
def err_drv_no_sycl_libspirv : Error< | |||
"cannot find '%0'; provide path to libspirv library via '-fsycl-libspirv-path', or " | |||
"pass '-fno-sycl-libspirv' to build without linking with libspirv">; | |||
def warn_flag_no_sycl_libspirv | |||
: Warning<"no-sycl-libspirv option is not meant for regular application " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: Warning<"no-sycl-libspirv option is not meant for regular application " | |
: Warning<"`-fno-sycl-libspirv` is not meant for regular application " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. I think warn_drv_unsupported_option_for_target actually is appropriate so I have used it here.
clang/lib/Driver/Driver.cpp
Outdated
@@ -1230,6 +1230,17 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C, | |||
addSYCLDefaultTriple(C, UniqueSYCLTriplesVec); | |||
} | |||
} | |||
// -fno_sycl_libspirv flag is reserved for very unusual cases where the libspirv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// -fno_sycl_libspirv flag is reserved for very unusual cases where the libspirv | |
// -fno-sycl-libspirv flag is reserved for very unusual cases where the libspirv |
clang/lib/Driver/Driver.cpp
Outdated
Diag(diag::warn_flag_no_sycl_libspirv_has_no_effect) << TT.getTriple(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be indented a step in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes thanks I've corrected this now.
Signed-off-by: JackAKirk <[email protected]>
Thanks for the reviews, I've applied the suggested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This PR addresses #7238
The -fno-sycl-libspirv flag only has an effect when using nvptx64-nvidia-cuda or amdgcn-amd-amdhsa triples.
The effect is to not link the libspirv libraries built by libclc that are only used by CUDA/HIP backends.
This flag is never recommended for normal DPC++ use because both CUDA and HIP backends require linking with libspirv for lots of the basic functionality.
However the option is there in case someone for whatever reason doesn't want to link libspirv, so this PR adds (triple dependent) warnings whenever the -fno-sycl-libspirv option is used.
If used with CUDA/HIP the warning is:
"warning: no-sycl-libspirv option is not meant for regular application development and severely limits the correct behavior of DPC++ when using the 'triple' triple"
For other triples the warning is:
"warning: no-sycl-libspirv option has no effect when compiled with the 'triple' triple"