Skip to content

[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

Merged
merged 5 commits into from
May 3, 2023

Conversation

aelovikov-intel
Copy link
Contributor

No description provided.

@aelovikov-intel aelovikov-intel requested a review from a team as a code owner February 14, 2023 18:08
@aelovikov-intel
Copy link
Contributor Author

This won't be helpful before we migrate llvm-test-suite, so we can wait with merging it.
Another option would be to implement a similar change (with a follow-up cleanup of the tests) in the llvm-test-suite repo.

Comment on lines 185 to 191
#include <sycl/sycl.hpp>

int main() {
using namespace sycl;

auto all_devices = device::get_devices();
if (all_devices.size() == 0)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Comment on lines 227 to 228
cmd = (config.dpcpp_compiler+' -fsycl ' + device_features_file + ' ' +
('/Fe' if cl_options else '-o ') + ' device_features.exe')
Copy link
Contributor

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?

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 hope not, because the code above/below this new snippet is doing the same thign, basically.

Copy link
Contributor

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.

https://llvm.org/docs/CommandGuide/lit.html#test-suites

Copy link
Contributor Author

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

Copy link
Contributor

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.

@aelovikov-intel aelovikov-intel marked this pull request as draft February 14, 2023 22:29
@aelovikov-intel aelovikov-intel temporarily deployed to aws February 17, 2023 12:24 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws April 28, 2023 19:23 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws April 28, 2023 20:25 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws April 28, 2023 20:56 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws May 1, 2023 15:58 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel marked this pull request as ready for review May 1, 2023 16:57
@aelovikov-intel
Copy link
Contributor Author

Please ignore first commit in this PR - it will be merged in separately via #8433.

@aelovikov-intel aelovikov-intel temporarily deployed to aws May 1, 2023 23:01 — with GitHub Actions Inactive
Copy link
Contributor

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

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Great! 🥳

@aelovikov-intel aelovikov-intel temporarily deployed to aws May 2, 2023 17:52 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws May 2, 2023 19:51 — with GitHub Actions Inactive
@aelovikov-intel
Copy link
Contributor Author

aelovikov-intel commented May 2, 2023

SYCL :: Basic/vec_bool.cpp fails in another PR (#9135) and is unrelated. Also, possibly fixed by #9259.

Copy link
Contributor

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

@aelovikov-intel aelovikov-intel temporarily deployed to aws May 3, 2023 16:52 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws May 3, 2023 21:52 — with GitHub Actions Inactive
@againull againull merged commit 4b37a83 into intel:sycl May 3, 2023
@aelovikov-intel aelovikov-intel deleted the auto-detect-aspects branch May 10, 2023 22: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.

6 participants