Skip to content
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] add device_type to SYCL_PI_TRACE and device_selector exception #6896

Merged
merged 2 commits into from
Sep 29, 2022

Conversation

mkrainiuk
Copy link
Contributor

@mkrainiuk mkrainiuk commented Sep 28, 2022

Device selector exception message and SYCL_PI_TRACE are extended with device type info for better debuggability in case of missed device in application that works with multiple devices.

Current exception message:

 No device of requested type available. -1 (PI_ERROR_DEVICE_NOT_FOUND) # in case of any device selector

Example of the current output from SYCL_PI_TRACE:

SYCL_PI_TRACE[all]: Selected device: -> final score = 1000
SYCL_PI_TRACE[all]:   platform: Intel(R) OpenCL
SYCL_PI_TRACE[all]:   device: Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz

New exception message:

No device of requested type available. -1 (PI_ERROR_DEVICE_NOT_FOUND)                                  # in case of custom/default selector
No device of requested type 'info::device_type::gpu' available. -1 (PI_ERROR_DEVICE_NOT_FOUND)         # in case of gpu selector
No device of requested type 'info::device_type::cpu' available. -1 (PI_ERROR_DEVICE_NOT_FOUND)         # in case of cpu selector
No device of requested type 'info::device_type::accelerator' available. -1 (PI_ERROR_DEVICE_NOT_FOUND) # in case of accelerator selector

Example of SYCL_PI_TRACE output with extra line about requested device_type:

SYCL_PI_TRACE[all]: Requested device_type: info::device_type::cpu
SYCL_PI_TRACE[all]: Selected device: -> final score = 1000
SYCL_PI_TRACE[all]:   platform: Intel(R) OpenCL
SYCL_PI_TRACE[all]:   device: Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz

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.

Looks good to me. Thank you!
I have only few minor comments.

bool ShouldTrace = false;
ShouldTrace = detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_BASIC);
if (ShouldTrace) {
std::cout << "SYCL_PI_TRACE[all]: Requested device_type: " << DeviceType << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

If you query for PI_TRACE_BASIC in L159, shouldn't this message start with "SYCL_PI_TRACE[basic]"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case it's not aligned with other device selector information that started with SYCL_PI_TRACE[all] but it is also printed as basic information in case of successful device initialization. So I did it in the same style for better readability.

SYCL_PI_TRACE[all]: Selected device: -> final score = 1000
SYCL_PI_TRACE[all]:   platform: Intel(R) OpenCL
SYCL_PI_TRACE[all]:   device: Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz

sycl/source/device_selector.cpp Outdated Show resolved Hide resolved
sycl/source/device_selector.cpp Outdated Show resolved Hide resolved
@v-klochkov
Copy link
Contributor

The test "SYCL/Config/select_device.cpp" failed in some CIs, which was expected.
It was updated in corresponding llvm-test-suite PR: intel/llvm-test-suite#1295
and the updated test gave pass with the updated compiler: http://llvm-ci2.intel.com:8080/job/SYCL_CI/job/intel/job/LLVM_Test_Suite_Associate_CI/341/display/redirect

Proceeding to merge now.

@v-klochkov v-klochkov merged commit 6b83ad7 into intel:sycl Sep 29, 2022
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Oct 3, 2022
steffenlarsen pushed a commit that referenced this pull request Oct 4, 2022
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Oct 11, 2022
We build the whole project with -fno-semantic-interposition by default
and it gets miscompiled by clang after intel#6896.

It's not yet clear if this would be a permanent fix or if there is a bug
in clang. The issue is being tracked at llvm/llvm-project#58295.
AlexeySachkov pushed a commit that referenced this pull request Oct 13, 2022
We build the whole project with `-fno-semantic-interposition` by default
and it gets miscompiled by clang after #6896.

It's not yet clear if this would be a permanent fix or if there is a bug
in clang. The issue is being tracked at llvm/llvm-project#58295.
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.

None yet

2 participants