Skip to content

Commit c4d20a7

Browse files
authored
[SYCL][Bindless][Doc] Add 'addressing_mode::ext_oneapi_clamp_to_border' to replace 'addressing_mode::clamp' (#15524)
'addressing_mode::clamp' is not descriptive enough and neither does it align with what is commonly used in other graphics APIs. It is proposed to use 'addressing_mode::ext_oneapi_clamp_to_border' instead.
1 parent 314fcb4 commit c4d20a7

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,13 @@ semantics. The value for the addressing mode, `addressing_mode::none`,
713713
represents the backend's default addressing mode. On CUDA this is `Wrap`, i.e.
714714
`addressing_mode::repeat`.
715715

716+
We propose renaming `addressing_mode::clamp` to
717+
`addressing_mode::clamp_to_border`. This name aligns better with terms used in
718+
other APIs and is more descriptive as to what the addressing mode does. Note
719+
that in this extension, the addressing mode will be named
720+
`addressing_mode::ext_oneapi_clamp_to_border` as to comply with extension naming
721+
guidelines.
722+
716723
`addressing[3]` defines the addressing mode per texture dimension. A
717724
`bindless_image_sampler` can be constructed with a singular
718725
`sycl::addressing_mode`, where this parameter will define all dimensions.
@@ -2894,4 +2901,6 @@ These features still need to be handled:
28942901
|6 |2024-08-05 | - Collated all changes since revision 5.
28952902
- Bumped SYCL_EXT_ONEAPI_BINDLESS_IMAGES to number 6.
28962903
|6.1|2024-09-09| - Update for image-array sub-region copy support.
2904+
|6.2|2024-09-26| - Added addressing mode `ext_oneapi_clamp_to_border` value,
2905+
equivalent to `clamp`, to match with external APIs.
28972906
|======================

sycl/include/sycl/sampler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ enum class addressing_mode : unsigned int {
2525
repeat = 0x1133, // Value of CL_ADDRESS_REPEAT
2626
clamp_to_edge = 0x1131, // Value of CL_ADDRESS_CLAMP_TO_EDGE
2727
clamp = 0x1132, // Value of CL_ADDRESS_CLAMP
28-
none = 0x1130 // Value of CL_ADDRESS_NONE
28+
ext_oneapi_clamp_to_border = clamp,
29+
none = 0x1130 // Value of CL_ADDRESS_NONE
2930
};
3031

3132
enum class filtering_mode : unsigned int {

sycl/test-e2e/bindless_images/helpers/sampling.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ printTestInfo(sycl::ext::oneapi::experimental::bindless_image_sampler &samp,
136136
case sycl::addressing_mode::clamp_to_edge:
137137
std::cout << "clamp_to_edge\n";
138138
break;
139-
case sycl::addressing_mode::clamp:
140-
std::cout << "clamp\n";
139+
case sycl::addressing_mode::ext_oneapi_clamp_to_border:
140+
std::cout << "ext_oneapi_clamp_to_border\n";
141141
break;
142142
case sycl::addressing_mode::none:
143143
std::cout << "none\n";
@@ -581,7 +581,7 @@ read(sycl::range<2> globalSize, sycl::vec<float, 2> coords, float offset,
581581
if (SampFiltMode == sycl::filtering_mode::nearest) {
582582

583583
sycl::addressing_mode SampAddrMode = samp.addressing[0];
584-
if (SampAddrMode == sycl::addressing_mode::clamp) {
584+
if (SampAddrMode == sycl::addressing_mode::ext_oneapi_clamp_to_border) {
585585
return clampNearest<VecType>(coords, globalSize, inputImage);
586586
}
587587

@@ -623,7 +623,7 @@ read(sycl::range<2> globalSize, sycl::vec<float, 2> coords, float offset,
623623

624624
} else { // linear
625625
sycl::addressing_mode SampAddrMode = samp.addressing[0];
626-
if (SampAddrMode == sycl::addressing_mode::clamp) {
626+
if (SampAddrMode == sycl::addressing_mode::ext_oneapi_clamp_to_border) {
627627
return clampLinear<DType, NChannels>(coords, globalSize, inputImage);
628628
}
629629
if (SampAddrMode == sycl::addressing_mode::clamp_to_edge) {

sycl/test-e2e/bindless_images/read_sampled.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ bool runTests(sycl::range<1> dims, sycl::range<1> localSize, float offset,
284284
// normalized and unnormalized coords.
285285
sycl::addressing_mode addrModes[4] = {
286286
sycl::addressing_mode::repeat, sycl::addressing_mode::mirrored_repeat,
287-
sycl::addressing_mode::clamp_to_edge, sycl::addressing_mode::clamp};
287+
sycl::addressing_mode::clamp_to_edge,
288+
sycl::addressing_mode::ext_oneapi_clamp_to_border};
288289

289290
sycl::filtering_mode filtModes[2] = {sycl::filtering_mode::nearest,
290291
sycl::filtering_mode::linear};
@@ -440,7 +441,8 @@ bool runTests(sycl::range<2> dims, sycl::range<2> localSize, float offset,
440441
// normalized and unnormalized coords.
441442
sycl::addressing_mode addrModes[4] = {
442443
sycl::addressing_mode::repeat, sycl::addressing_mode::mirrored_repeat,
443-
sycl::addressing_mode::clamp_to_edge, sycl::addressing_mode::clamp};
444+
sycl::addressing_mode::clamp_to_edge,
445+
sycl::addressing_mode::ext_oneapi_clamp_to_border};
444446

445447
sycl::filtering_mode filtModes[2] = {sycl::filtering_mode::nearest,
446448
sycl::filtering_mode::linear};

0 commit comments

Comments
 (0)