-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into KHRGA-70_DA_Accessors_BC
- Loading branch information
Showing
22 changed files
with
1,263 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// SPDX-FileCopyrightText: 2023 The Khronos Group Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
|
||
// Create 2-d buffer with 8x8 ints | ||
sycl::buffer<int, 2> parent_buffer{sycl::range<2>{8, 8}}; | ||
|
||
try { | ||
// OK: Contiguous region from middle of buffer | ||
sycl::buffer<int, 2> sub_buf1{parent_buffer, | ||
/*offset*/ sycl::range<2>{2, 0}, | ||
/*size*/ sycl::range<2>{2, 8}}; | ||
|
||
std::cout << "sub_buf1 created successfully" << std::endl; | ||
} catch (const sycl::exception &e) { | ||
std::cerr << "Exception while creating sub_buf1: " << e.what() << std::endl; | ||
} | ||
|
||
try { | ||
// invalid exception: Non-contiguous regions of 2-d buffer | ||
sycl::buffer<int, 2> sub_buf2{parent_buffer, | ||
/*offset*/ sycl::range<2>{2, 0}, | ||
/*size*/ sycl::range<2>{2, 2}}; | ||
|
||
std::cout << "sub_buf2 created successfully" << std::endl; | ||
} catch (const sycl::exception &e) { | ||
std::cerr << "Exception while creating sub_buf2: " << e.what() << std::endl; | ||
} | ||
|
||
try { | ||
// invalid exception: Non-contiguous regions of 2-d buffer | ||
sycl::buffer<int, 2> sub_buf3{parent_buffer, | ||
/*offset*/ sycl::range<2>{2, 2}, | ||
/*size*/ sycl::range<2>{2, 6}}; | ||
|
||
std::cout << "sub_buf3 created successfully" << std::endl; | ||
} catch (const sycl::exception &e) { | ||
std::cerr << "Exception while creating sub_buf3: " << e.what() << std::endl; | ||
} | ||
|
||
try { | ||
// invalid exception: Out-of-bounds size | ||
sycl::buffer<int, 2> sub_buf4{parent_buffer, | ||
/*offset*/ sycl::range<2>{2, 2}, | ||
/*size*/ sycl::range<2>{2, 8}}; | ||
|
||
std::cout << "sub_buf4 created successfully" << std::endl; | ||
} catch (const sycl::exception &e) { | ||
std::cerr << "Exception while creating sub_buf4: " << e.what() << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-FileCopyrightText: 2020 The Khronos Group Inc. | ||
# | ||
# SPDX-License-Identifier: CC-BY-4.0 | ||
|
||
sub_buf1 created successfully | ||
Exception while creating sub_buf2: Requested sub-buffer region is not contiguous -30 (PI_ERROR_INVALID_VALUE) | ||
Exception while creating sub_buf3: Requested sub-buffer region is not contiguous -30 (PI_ERROR_INVALID_VALUE) | ||
Exception while creating sub_buf4: Requested sub-buffer size exceeds the size of the parent buffer -30 (PI_ERROR_INVALID_VALUE) |
Oops, something went wrong.