Skip to content

Conversation

hchilama
Copy link
Contributor

No description provided.

@hchilama hchilama requested review from a team as code owners February 16, 2022 19:40
mdtoguchi
mdtoguchi previously approved these changes Feb 17, 2022
Copy link
Contributor

@mdtoguchi mdtoguchi left a 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">;
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

@hchilama hchilama Feb 18, 2022

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.

Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Contributor

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!

Copy link
Contributor Author

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.

@smanna12 smanna12 requested a review from erichkeane February 17, 2022 00:41
@@ -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">;
Copy link
Contributor

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>;
Copy link
Contributor

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?

Copy link
Contributor

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:

Suggested change
"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">;
Copy link
Contributor

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 hchilama requested a review from smanna12 February 23, 2022 19:14
@smanna12
Copy link
Contributor

@hchilama, you have conflicts. could you please resolve that? Thanks

premanandrao
premanandrao previously approved these changes Feb 23, 2022
Copy link
Contributor

@premanandrao premanandrao left a 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.

smanna12
smanna12 previously approved these changes Feb 23, 2022
@@ -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">;
Copy link
Contributor

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">

Copy link
Contributor Author

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.

@hchilama hchilama dismissed stale reviews from smanna12 and premanandrao via a5fb10f February 23, 2022 22:27
@bader bader changed the title [Driver][Sycl]Needs warning before converting 'c' input to 'c++' when using -fsycl [Driver][SYCL] Issue a warning for converting 'c' input to 'c++' in SYCL mode Feb 24, 2022
@bader bader merged commit 5b62ee0 into intel:sycl Feb 24, 2022
@hchilama hchilama deleted the warn_c_to_c++_conversion_with_fsycl branch February 24, 2022 23:25
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.

7 participants