-
Notifications
You must be signed in to change notification settings - Fork 768
[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
Conversation
-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.
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. |
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.
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.
The *vast* majority of the changes are to to the tests.
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.
If -sycl-std is passed to the driver without -fsycl, then it is not passed to the -cc1 invocation.
0ea5a5b
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.
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. |
Two things:
|
5da2fed
0910ca9
@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 |
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.
It looks like this test is supposed to check LLVM IR emitted by the host compiler. Right?
- Should we remove
-fsycl
as well? Is there a better way to get the result of host-side compilation? - (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?
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.
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
.
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.
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.
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.
It looks like this test is supposed to check LLVM IR emitted by the host compiler. Right?
Exactly.
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.
By the way, what's the purpose of this file change?
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 agree. The test already had this flow, so it's better to address it separately.
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.
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).
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.
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.
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.
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.
Great thanks!
a4163d8
-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.