-
Notifications
You must be signed in to change notification settings - Fork 798
[Driver][SYCL] Issue a warning for converting 'c' input to 'c++' in SYCL mode #5598
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
[Driver][SYCL] Issue a warning for converting 'c' input to 'c++' in SYCL mode #5598
Conversation
…ncompatibility Using err_drv_option_conflict instead of err_drv_opt_incompatible_opt Signed-off-by: Harini Chilamantula <harini.chilamantula@intel.com>
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.
Driver looks OK - but would like to see opinions on the diagnostic option name from the CFE folks.
@@ -1239,6 +1239,7 @@ def Sycl2020Compat : DiagGroup<"sycl-2020-compat">; | |||
def SyclStrict : DiagGroup<"sycl-strict", [ Sycl2017Compat, Sycl2020Compat]>; | |||
def SyclTarget : DiagGroup<"sycl-target">; | |||
def SyclFPGAMismatch : DiagGroup<"sycl-fpga-mismatch">; | |||
def SyclCompat : DiagGroup<"sycl-compat">; |
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.
I'm on the fence on the naming of the -W
option here.
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.
Not up to me, but I agree here. I don't think this warning group fits well here. I'd suggest the CFE/driver reviewers see if we can bikeshed this better
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.
I did quick search to see if I can find a better Warning group and I saw 2 other diagnostics which look related -
def err_drv_fsycl_with_c_type : Error<
"'%0' must not be used in conjunction with '-fsycl', which expects C++ source">;
def warn_drv_treating_input_as_cxx : Warning<
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
InGroup<Deprecated>;
I assume the latter is used for non-sycl programs but would you know what the former is used for now?
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.
I'm not sure what the group should be named here. InvalidSourceFile
/UnsupportedFileType
/LanguageMismatch
? I don't really like any of these. @premanandrao do you have a suggestion?
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.
I did quick search to see if I can find a better Warning group and I saw 2 other diagnostics which look related -
def err_drv_fsycl_with_c_type : Error< "'%0' must not be used in conjunction with '-fsycl', which expects C++ source">; def warn_drv_treating_input_as_cxx : Warning< "treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">, InGroup<Deprecated>;
I assume the latter is used for non-sycl programs but would you know what the former is used for now?
Hi @elizabethandrews , In above 2 defs "err_drv_fsycl_with_c_type" can only be used for error message. so I can't use it for a warning. And the other one "warn_drv_treating_input_as_cxx" I tried using it but @mdtoguchi said "The warning is not accurate for -fsycl". So I have created new one.
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.
This error only emits when 'c' compilation is forced in -fsycl mode.
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.
Sorry for not being clear. My question was - when is
err_drv_fsycl_with_c_type
thrown ? I was curious about warning vs error functionality here.
That error seems to get issued when compiling as a C file is forced. Ex: clang -c -fsycl -x c foo.c
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.
I'm not sure what the group should be named here.
InvalidSourceFile
/UnsupportedFileType
/LanguageMismatch
? I don't really like any of these. @premanandrao do you have a suggestion?
I don't have any great suggestions here: does ExpectedFileType
work?
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.
@hchilama I'm ok with InvalidSourceFile
or ExpectedFileType
. If you agree, please change the group name. Thanks!
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.
Sure thanks @elizabethandrews, I will update the group name.
@@ -1239,6 +1239,7 @@ def Sycl2020Compat : DiagGroup<"sycl-2020-compat">; | |||
def SyclStrict : DiagGroup<"sycl-strict", [ Sycl2017Compat, Sycl2020Compat]>; | |||
def SyclTarget : DiagGroup<"sycl-target">; | |||
def SyclFPGAMismatch : DiagGroup<"sycl-fpga-mismatch">; | |||
def SyclCompat : DiagGroup<"sycl-compat">; |
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.
I did quick search to see if I can find a better Warning group and I saw 2 other diagnostics which look related -
def err_drv_fsycl_with_c_type : Error<
"'%0' must not be used in conjunction with '-fsycl', which expects C++ source">;
def warn_drv_treating_input_as_cxx : Warning<
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
InGroup<Deprecated>;
I assume the latter is used for non-sycl programs but would you know what the former is used for now?
@@ -669,4 +669,6 @@ def err_drv_cuda_offload_only_emit_bc : Error< | |||
def warn_drv_jmc_requires_debuginfo : Warning< | |||
"/JMC requires debug info. Use '/Zi', '/Z7' or other debug options; option ignored">, | |||
InGroup<OptionIgnored>; | |||
def warn_drv_fsycl_with_c_type : Warning< | |||
"treating '%0' input as '%1' when -fsycl is used">, InGroup<SyclCompat>; |
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.
I'm not sure if we need to mention when -fsycl is used
here. @premanandrao WDYT?
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.
I think there is some value is saying why the input type was changed. Suggest quotes around -fsycl though:
"treating '%0' input as '%1' when -fsycl is used">, InGroup<SyclCompat>; | |
"treating '%0' input as '%1' when '-fsycl' is used">, InGroup<SyclCompat>; |
I see this existing driver diagnostic as something that has a similar format:
warn_drv_treating_input_as_cxx : Warning<
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
InGroup<Deprecated>;
@@ -1239,6 +1239,7 @@ def Sycl2020Compat : DiagGroup<"sycl-2020-compat">; | |||
def SyclStrict : DiagGroup<"sycl-strict", [ Sycl2017Compat, Sycl2020Compat]>; | |||
def SyclTarget : DiagGroup<"sycl-target">; | |||
def SyclFPGAMismatch : DiagGroup<"sycl-fpga-mismatch">; | |||
def SyclCompat : DiagGroup<"sycl-compat">; |
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.
I'm not sure what the group should be named here. InvalidSourceFile
/UnsupportedFileType
/LanguageMismatch
? I don't really like any of these. @premanandrao do you have a suggestion?
@hchilama, you have conflicts. could you please resolve that? Thanks |
…ersion_with_fsycl
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.
I am okay with the changes.
@@ -275,6 +275,9 @@ def CPre2xCompat : DiagGroup<"pre-c2x-compat">; | |||
def CPre2xCompatPedantic : DiagGroup<"pre-c2x-compat-pedantic", | |||
[CPre2xCompat]>; | |||
|
|||
// Warning for treating C input as C++ input. | |||
def ExpectedFileType : DiagGroup<"ExpectedFileType">; |
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.
The name of the diagnostic when used as an option probably should be something like: DiagGroup<"expected-file-type">
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, I have verified the other group naming. I will update this.
No description provided.