-
Notifications
You must be signed in to change notification settings - Fork 772
[SYCL][LIT] Auto-detect device aspects in sycl/test-e2e/lit.cfg.py #8344
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
This won't be helpful before we migrate llvm-test-suite, so we can wait with merging it. |
36904ea
to
171b124
Compare
sycl/test-e2e/lit.cfg.py
Outdated
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
using namespace sycl; | ||
|
||
auto all_devices = device::get_devices(); | ||
if (all_devices.size() == 0) |
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.
Can we put SYCL code to a separate file? I think it would easier to support.
Probably we can add a separate sycl tool for detecting device features.
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.
Probably we can add a separate sycl tool for detecting device features.
I don't want to do that because such a tool must not be part of the user installation, yet we need to run these LIT tests with such user-visible layout (internally).
Can we put SYCL code to a separate file? I think it would easier to support.
Maybe, as long as it is located under test-e2e
(see above reasoning) and isn't detected as a test by the LIT framework.
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 don't want to do that because such a tool must not be part of the user installation, yet we need to run these LIT tests with such user-visible layout (internally).
I don't see the problem. Can't we exclude this tool from user installation? We don't install neither LIT tool nor e2e tests and they also required running the test. Don't you think that maintaining SYCL sources in a separate file is simpler than within a string in a python script?
sycl/test-e2e/lit.cfg.py
Outdated
cmd = (config.dpcpp_compiler+' -fsycl ' + device_features_file + ' ' + | ||
('/Fe' if cl_options else '-o ') + ' device_features.exe') |
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.
Are all these commands executed for each test run?
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 hope not, because the code above/below this new snippet is doing the same thign, basically.
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.
Just from this code snippet, I don't see any optimizations caching the result of these commands. I assume we write the file, compile it and run the executable each time test is executed.
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.
From the link you've mentioned:
lit identifies test suites as directories containing lit.cfg or lit.site.cfg files
Once a test suite is discovered, its config file is loaded. Config files themselves are Python modules which will be executed.
In other words, it's done once per llvm-lit invocation. With extra print from this code I'm getting something like
$ llvm-lit -sv --param sycl_be=level_zero --param target_devices=gpu .
# The "device_features" check is executed here
...
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:293: note: Backend: ext_oneapi_level_zero
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:374: warning: CPU device not used
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:389: note: Test GPU device
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:432: warning: Accelerator device not used
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:467: note: Found llvm-spirv
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:467: note: Found llvm-link
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:483: note: Found pre-installed AOT device compiler ocloc
llvm-lit: <...>/llvm/sycl/test-e2e/lit.cfg.py:483: note: Found pre-installed AOT device compiler opencl-aot
-- Testing: 3 tests, 3 workers --
FAIL: SYCL :: TestSuiteMove/fail.cpp (1 of 3)
******************** TEST 'SYCL :: TestSuiteMove/fail.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1'; false
--
Exit Code: 1
Command Output (stdout):
--
$ ":" "RUN: at line 1"
note: command had no output on stdout or stderr
$ "false"
note: command had no output on stdout or stderr
error: command failed with exit status: 1
--
********************
-- Testing: 3 tests, 3 workers --
********************
Failed Tests (1):
SYCL :: TestSuiteMove/fail.cpp
Testing Time: 4.79s
Passed: 2
Failed: 1
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.
In other words, it's done once per llvm-lit invocation.
That's my understanding as well and it doesn't seem to be optimal.
171b124
to
e2e92fe
Compare
e2e92fe
to
27a46e1
Compare
Please ignore first commit in this PR - it will be merged in separately via #8433. |
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.
Changes to the kernel fusion tests look fine.
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! 🥳
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.
Ok for ESIMD.
I did not review all other tests, only some of them - those some are good too. Please rely on previous approval from SYCL RT if you did not do significant changes after that, or re-request Steffen's approval.
No description provided.