Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Test queue::ext_oneapi_empty() API #1427

Merged
merged 3 commits into from
Dec 13, 2022

Conversation

againull
Copy link

@againull againull commented Dec 1, 2022

Tests for PR: intel/llvm#7583

ext_oneapi_empty() is supposed to return true if all submitted commands in the queue are completed, false is returned otherwise.

@againull
Copy link
Author

againull commented Dec 6, 2022

@KseniyaTikhomirova Friendly ping.

@KseniyaTikhomirova
Copy link

KseniyaTikhomirova commented Dec 6, 2022

@againull hello, it has failed tests, will you fix or they are not related?

@againull
Copy link
Author

againull commented Dec 6, 2022

@againull hello, it has failed tests, will you fix or they are not related?

Those testing results were expected to fail because at that moment intel/llvm PR was not merged.
I've restarted testing to be sure that testing is clean now. P.S. Associated testing (running new tests with compiler changes) was triggered in intel/llvm PR and it was clean.

}

// Wait a bit to give a chance for tasks to complete.
std::this_thread::sleep_for(std::chrono::milliseconds(500));
Copy link

@KseniyaTikhomirova KseniyaTikhomirova Dec 6, 2022

Choose a reason for hiding this comment

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

could we try to avoid sleeps in tests? we could not rely on such approach.
what if to add host_task as the last task that would signal cv, atomic or lock/unlock mutex and simply wait for it instead of sleep, will it help?

Copy link
Author

Choose a reason for hiding this comment

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

what if to add host_task as the last task that would signal cv, atomic or lock/unlock mutex and simply wait for it instead of sleep, will it help?

Unfortunately, as far as I know SYCL doesn't guarantee that such waiting will ever complete. User must perform synchronization to guarantee completion. I mean it is not guaranteed that queue will be flushed and we may just wait forever.

Copy link
Author

Choose a reason for hiding this comment

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

@KseniyaTikhomirova, unfortunately, I don't have good ideas how to get rid of sleep right now for the reasons I described above. I can probably replace it with some loop - try several times to see if queue is empty and give up if it is not empty - but I'm not sure whether it is better or not.

Choose a reason for hiding this comment

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

ok, unfortunately I also do not have better ideas about how to get rid of sleep call. If we want to check that the right value could be returned even without wait call - may be it could be done with unittest. Although I do not want to block you here.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! Unittest may be a good idea.

} catch (sycl::exception &E) {
std::cout << E.what() << std::endl;
// Feature is not supported for OpenCL.
assert(Q2.get_device().get_backend() == backend::opencl);

Choose a reason for hiding this comment

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

I am a bit concerned about this check. It allows to check that "if exception happens - it happens with device on opencl backend" but it doesn't check that "if device is on opencl backend - exception happens". Not sure if I explain the difference properly but I want to suggest to add condition that if device is on opencl backend - exception must be observed and fail test otherwise.

Copy link
Author

Choose a reason for hiding this comment

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

Good call, fixed.

Copy link

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Choose a reason for hiding this comment

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

LGTM

@againull againull merged commit 33a63e7 into intel:intel Dec 13, 2022
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Mar 22, 2023
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Mar 22, 2023
…tus_tests

[SYCL] Test queue::ext_oneapi_empty() API (intel#1427)
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants