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

[SYCL] Adds regression test for buffer allocation for failed SYCL streams #467

Conversation

steffenlarsen
Copy link

SYCL streams that throws an exception during construction would still create buffers and accessors. This adds a test to ensure that no device memory is allocated for streams if they fail during construction.

This test passes with intel/llvm#4594.

…eams

SYCL streams that throws an exception during construction would still
create buffers and accessors. This adds a test to ensure that no device
memory is allocated for streams if they fail during construction.

Signed-off-by: Steffen Larsen <[email protected]>
sycl::queue q;
q.submit([&](sycl::handler &cgh) {
try {
// Try to create stream with invalid workItemBufferSize parameter.

Choose a reason for hiding this comment

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

Can we have a test in intel/llvm sycl/unittests instead?

Copy link
Author

Choose a reason for hiding this comment

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

I was considering it, but it was simpler to have single_task try and manifest the memory.

One way to do it in the unittests would be to check that StreamBufferPool remains empty, but since it it private to the scheduler I would need to use the mock scheduler. Do you reckon that would work?

Choose a reason for hiding this comment

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

You can have the same code + PIImages mocks + redefine call of piMemBufferCreate to a function which sets global flag if it is called. Then is "main" check that the flag is not set. Will it work?

Copy link
Author

Choose a reason for hiding this comment

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

You are absolutely right, that works. I have moved this to a unittest in intel/llvm#4594 and will close this.

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