-
Notifications
You must be signed in to change notification settings - Fork 751
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
[SYCL] Run the LIT tests using the selected backend #1288
Conversation
@@ -85,7 +85,8 @@ | |||
print("Adding path to opencl-aot tool to PATH") | |||
os.environ['PATH'] = os.path.pathsep.join((os.getenv('PATH'), config.sycl_tools_dir)) | |||
|
|||
backend=lit_config.params.get('SYCL_BE', "PI_OPENCL") | |||
backend = lit_config.params.get('SYCL_BE', "PI_OPENCL") | |||
config.environment['SYCL_BE'] = backend |
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 is a great idea!
Please remove gpu_run_on_linux_substitute += " SYCL_BE=PI_CUDA "
below.
I have a similar but less elegant PR in the works that I will adapt to your change.
It looks like |
It looks like setting both
While setting both
It kinds of make sense, and it's the same behaviour I get as when there are no OpenCL devices:
What do you think should be the behaviour in these cases ? |
sycl/test/CMakeLists.txt requests which backend to test by passing to the LIT configuration either PARAMS "SYCL_BE=PI_OPENCL" or PARAMS "SYCL_BE=PI_CUDA" This change passes the backend choice to the test throught its environment. Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
62913d1
to
f856948
Compare
Done, and rebased. |
@fwyzard, unfortunately, there are some unexpected failures in LIT tests with this patch. |
I think this functionality is covered by #1458. @vladimirlaz, could you confirm, please? |
Probably #1300 is also needed. |
This PR moves environment variables into I am still fond of the elegant approach here to build up an environment but wonder how we can make the environment visible when a LIT test case fails to understand how to run and debug it by hand? |
Mhm, yes, that's a very good point. |
how about writing all environment variables for test |
Very interesting idea! How many of these environments would we need? My guess is 4 envs correpsonding to:
My hope is that the file opening overhead would not show up in the test timings (which are dominated by compile times anyway). |
OK, let me see ... What does The tests that are not Should there be two set of tests, for CUDA and for OpenCL ?
From a quick test it seems to add 2-3 ms of overhead. |
These are the commands we use inside the LIT tests to run the build executables. They are set up in sycl/test/lit.cfg.py, e.g.: gpu_run_substitute = " env SYCL_DEVICE_TYPE=GPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=backend) ... and then set up like // RUN: %GPU_RUN_PLACEHOLDER %t.out
I am not sure what the difference between the Linux and non-Linux set up is - at the moment they seem to always match and I cannot find a single use of the Linux ones. Might just be an option to allow differentiation if required?
Looking at the different substitutions in sycl/test/lit.cfg.py we create the environments very dynamically. I wonder if we can catch that in an env file if we want to enable independent LIT runs for different cases at the same time to not affect each other (though I am not sure if that wouldn't be a problem with LIT anyway)? |
The latest definition of the tests works well enough, and passing the variables explicitly on the command line instead of implicitly via the environment makes it easier to re-run the tests by hand. |
sycl/test/CMakeLists.txt
requests which backend to test by passing to the LIT configuration eitheror
This change passes the backend choice to the test through its environment.