Skip to content

[SYCL] Throw exceptions while creating sub buffer #822

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions sycl/include/CL/sycl/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ class buffer {
if (b.is_sub_buffer())
throw cl::sycl::invalid_object_error(
"Cannot create sub buffer from sub buffer.");
// TODO: SYCL CTS are failed because not appropriate offset and range
// are passed to this constructor which causes a throw of exception.
// Some changes need to be done there.
// if (isOutOfBounds(baseIndex, subRange, b.Range))
// throw cl::sycl::invalid_object_error("Out-of-bounds size");
// if (!isContiguousRegion(baseIndex, subRange, b.Range))
// throw cl::sycl::invalid_object_error("Non-contiguous region");
if (isOutOfBounds(baseIndex, subRange, b.Range))
throw cl::sycl::invalid_object_error(
"Requested sub-buffer size exceeds the size of the parent buffer");
if (!isContiguousRegion(baseIndex, subRange, b.Range))
throw cl::sycl::invalid_object_error(
"Requested sub-buffer region is not contiguous");
}

template <int N = dimensions, typename = EnableIfOneDimension<N>>
Expand Down
3 changes: 1 addition & 2 deletions sycl/test/basic_tests/buffer/subbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ int main() {
cl::sycl::queue q;
check1DSubBuffer(q);
checkHostAccessor(q);
// TODO! Uncomment once SYCL-CTS are fixed
// checkExceptions();
checkExceptions();
return 0;
}