Skip to content

[SYCL] Rework the way we handle SYCL -cc1 arguments. #3259

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

Merged
merged 19 commits into from
Mar 10, 2021

Conversation

AaronBallman
Copy link
Contributor

-fsycl-is-device and -fsycl-is-host are mutually exclusive options that
now imply -fsycl mode. So passing -fsycl-is-device will now set both
the SYCL and SYCLIsDevice language options.

This introduces driver errors if the user attempts to pass both host
and device mode on the command line. Further, it disallows you from
specifying the -sycl-std= option unless in device or host mode.

There is some testing fallout from these changes because some tests
were passing -fsycl-is-device and not passing -fsycl which meant that
SYCL mode was never enabled for those tests.

-fsycl-is-device and -fsycl-is-host are mutually exclusive options that
now imply -fsycl mode. So passing -fsycl-is-device will now set both
the SYCL and SYCLIsDevice language options.

This introduces driver errors if the user attempts to pass both host
and device mode on the command line. Further, it disallows you from
specifying the -sycl-std= option unless in device or host mode.

There is some testing fallout from these changes because some tests
were passing -fsycl-is-device and not passing -fsycl which meant that
SYCL mode was never enabled for those tests.
@AaronBallman
Copy link
Contributor Author

I wanted to get some early feedback on the approach I'm taking, but I believe this work should actually be landed upstream and then pulled in from there.

I believe there is one failing test case for clang/CodeGenSYCL/loop_unroll.cpp that I will likely need some help figuring out. The test was not actually testing in SYCL mode and so it was likely an invalid test to begin with.

Copy link
Contributor

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

1 comment that likely requires driver work, but I don't want fsycl to work in cc1 at all. I think it should mean "do the 3 invocations thing" to the driver, and nothing to the cc1 invocation.

@AGindinson AGindinson requested a review from bader February 24, 2021 18:12
The *vast* majority of the changes are to to the tests.
@premanandrao
Copy link
Contributor

I believe there is one failing test case for clang/CodeGenSYCL/loop_unroll.cpp that I will likely need some help figuring out. The test was not actually testing in SYCL mode and so it was likely an invalid test to begin with.

My quick thought is that you should modify the test (which was invalid to begin with) to accept the new behavior with your change.

Adds back -fno-sycl as a noop.
Removes the diagnostic about passing -sycl-std= but not
-fsycl-is-device or -fsycl-is-host.
Fixes several tests, but not all of them yet.
premanandrao
premanandrao previously approved these changes Feb 24, 2021
If -sycl-std is passed to the driver without -fsycl, then it is not
passed to the -cc1 invocation.
mdtoguchi
mdtoguchi previously approved these changes Feb 24, 2021
premanandrao
premanandrao previously approved these changes Feb 24, 2021
@AaronBallman AaronBallman dismissed stale reviews from premanandrao and mdtoguchi via 0ea5a5b February 25, 2021 15:21
It doesn't make sense to pass -fsycl -Xclang -fsycl-is-host because
that makes an invalid device compilation pass that has -fsycl-is-host
and -fsycl-is-device at the same time.
@AaronBallman
Copy link
Contributor Author

Now that it looks like I've gotten everything to pass for us, I think the next steps are to figure out how to land this. I think these changes need to go upstream, so my intention is to spin up a community review for these changes. However, once this lands here through a pulldown, we'll have a lot of broken tests. My plan is to leave this PR languish as a Draft until pulldown breaks things, then resurrect it to fix the test failures. If anyone has suggestions on how to make it less painful for us, I'm all ears.

@AaronBallman
Copy link
Contributor Author

Two things:

  1. I have no idea what's going on with the Jenkins failures. The log files manage to contain both too much and too little information at the same time. Where do these tests live in the source tree? From the logs, I see Cloning repository https://github.com/otcshare/llvm_ci.git and yet... I can't seem to clone that repo.
  2. When I started doing the upstreaming work, I found out that community has SYCL and SYCLIsDevice, but not SYCLIsHost. That makes upstreaming this... awkward, to say the least. I'm not certain how to proceed on the community side of things.

mdtoguchi
mdtoguchi previously approved these changes Mar 4, 2021
@AaronBallman AaronBallman dismissed stale reviews from mdtoguchi and elizabethandrews via 5da2fed March 5, 2021 13:09
mdtoguchi
mdtoguchi previously approved these changes Mar 5, 2021
premanandrao
premanandrao previously approved these changes Mar 8, 2021
@bader
Copy link
Contributor

bader commented Mar 9, 2021

@intel/llvm-reviewers-runtime, ping.

@bader
Copy link
Contributor

bader commented Mar 9, 2021

@intel/llvm-reviewers-runtime, ping.

There is only one line of changes for you to review: sycl/test/check_device_code/id_queries_fit_int.cpp. :)

@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -Xclang -fsycl-is-host -fsycl-id-queries-fit-in-int -O0 -c -S -emit-llvm -o %t.ll %s
// RUN: %clangxx -fsycl -fsycl-id-queries-fit-in-int -O0 -c -S -emit-llvm -o %t.ll %s
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this test is supposed to check LLVM IR emitted by the host compiler. Right?

  1. Should we remove -fsycl as well? Is there a better way to get the result of host-side compilation?
  2. (not relevant to this PR) Should it be located in sycl/test/check_device_code/ directory, if it doesn't check device code at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was unclear what this test was trying to accomplish with that RUN line. -fsycl kicks off a device and a host build, so it wasn't obvious what was intended when running in host-and-device-at-the-same-time mode (which isn't supported).

If the test is only interested in host mode functionality, it should remove -fsycl and pass -Xclang -fsycl-is-host.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the test is only interested in host mode functionality, it should remove -fsycl and pass -Xclang -fsycl-is-host.

I think so. There is no device code in the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this test is supposed to check LLVM IR emitted by the host compiler. Right?

Exactly.

Copy link
Contributor

@s-kanaev s-kanaev Mar 9, 2021

Choose a reason for hiding this comment

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

By the way, what's the purpose of this file change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. The test already had this flow, so it's better to address it separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that passing the path was insufficient to correct the test. Given that the test is already in a broken state, I'd prefer if someone with more domain knowledge handled correcting the test deficiencies in a separate PR (so I would back to the original changes to the test, which were originally passing).

Copy link
Contributor

Choose a reason for hiding this comment

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

To validate what @s-kanaev says is intended we need to re-write the code to make it device code instead.

Then, there must be an issue for us to not forget about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@s-kanaev -- I filed #3335 to track this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great thanks!

mdtoguchi
mdtoguchi previously approved these changes Mar 9, 2021
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.

8 participants