This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Reword unknown extension pragma diagnostic
ClosedPublic

Authored by svenvh on May 30 2022, 8:34 AM.

Details

Summary

For newer OpenCL extensions that do not require a pragma, such as
cl_khr_subgroup_shuffle, a user could still accidentally attempt to
use a pragma. This would result in a warning

"unknown OpenCL extension 'cl_khr_subgroup_shuffle' - ignoring"

which could be mistakenly interpreted as "Clang does not support this
extension at all" instead of "Clang does not require any pragma for
this extension".

Diff Detail

Event Timeline

svenvh created this revision.May 30 2022, 8:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2022, 8:34 AM
svenvh requested review of this revision.May 30 2022, 8:34 AM
Anastasia accepted this revision.Jun 1 2022, 8:32 AM

Ok, makes sense! Thanks!

Btw I was thinking we should provide some way for developers to know what extensions are being supported either through documentation or by querying clang somehow? I am guessing documentation would be easier to implement but harder to keep in sync?

This revision is now accepted and ready to land.Jun 1 2022, 8:32 AM
svenvh added a comment.Jun 1 2022, 8:42 AM

Ok, makes sense! Thanks!

Btw I was thinking we should provide some way for developers to know what extensions are being supported either through documentation or by querying clang somehow? I am guessing documentation would be easier to implement but harder to keep in sync?

I agree that would be nice to have. That would also enable us to distinguish valid pragmaless extensions from garbage (e.g. mistyped extensions), and would also help -cl-ext parsing/diagnosing for example. But that would require us to maintain a list of extensions inside Clang, which I believe is what we wanted to move away from (especially for extensions that only add library-like functionality)?

This revision was automatically updated to reflect the committed changes.