Skip to content

Commit dd15bfa

Browse files
committed
[Bindless][Exp] Add const-qualifier to Src param in urBindlessImagesImageCopyExp
Add const-qualifier to Src parameter in urBindlessImagesImageCopyExp.
1 parent 071bf54 commit dd15bfa

File tree

14 files changed

+32
-28
lines changed

14 files changed

+32
-28
lines changed

include/ur_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7697,7 +7697,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
76977697
urBindlessImagesImageCopyExp(
76987698
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
76997699
void *pDst, ///< [in] location the data will be copied to
7700-
void *pSrc, ///< [in] location the data will be copied from
7700+
const void *pSrc, ///< [in] location the data will be copied from
77017701
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
77027702
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
77037703
ur_exp_image_copy_flags_t imageCopyFlags, ///< [in] flags describing copy direction e.g. H2D or D2H
@@ -10945,7 +10945,7 @@ typedef struct ur_bindless_images_sampled_image_create_exp_params_t {
1094510945
typedef struct ur_bindless_images_image_copy_exp_params_t {
1094610946
ur_queue_handle_t *phQueue;
1094710947
void **ppDst;
10948-
void **ppSrc;
10948+
const void **ppSrc;
1094910949
const ur_image_format_t **ppImageFormat;
1095010950
const ur_image_desc_t **ppImageDesc;
1095110951
ur_exp_image_copy_flags_t *pimageCopyFlags;

include/ur_ddi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageCreateExp_t)(
15671567
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageCopyExp_t)(
15681568
ur_queue_handle_t,
15691569
void *,
1570-
void *,
1570+
const void *,
15711571
const ur_image_format_t *,
15721572
const ur_image_desc_t *,
15731573
ur_exp_image_copy_flags_t,

scripts/core/exp-bindless-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ params:
501501
- type: void*
502502
name: pDst
503503
desc: "[in] location the data will be copied to"
504-
- type: void*
504+
- type: const void*
505505
name: pSrc
506506
desc: "[in] location the data will be copied from"
507507
- type: "const $x_image_format_t*"

source/adapters/cuda/image.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
626626
}
627627

628628
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
629-
ur_queue_handle_t hQueue, void *pDst, void *pSrc,
629+
ur_queue_handle_t hQueue, void *pDst, const void *pSrc,
630630
const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc,
631631
ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset,
632632
ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent,
@@ -668,18 +668,21 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
668668
(CUdeviceptr)pDst) != CUDA_SUCCESS;
669669

670670
size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width;
671-
char *SrcWithOffset = (char *)pSrc + (srcOffset.x * PixelSizeBytes);
671+
const char *SrcWithOffset =
672+
static_cast<const char *>(pSrc) + (srcOffset.x * PixelSizeBytes);
672673

673674
if (isCudaArray) {
674-
UR_CHECK_ERROR(cuMemcpyHtoAAsync(
675-
(CUarray)pDst, dstOffset.x * PixelSizeBytes,
676-
(void *)SrcWithOffset, CopyExtentBytes, Stream));
675+
UR_CHECK_ERROR(
676+
cuMemcpyHtoAAsync((CUarray)pDst, dstOffset.x * PixelSizeBytes,
677+
static_cast<const void *>(SrcWithOffset),
678+
CopyExtentBytes, Stream));
677679
} else if (memType == CU_MEMORYTYPE_DEVICE) {
678-
void *DstWithOffset =
679-
(void *)((char *)pDst + (PixelSizeBytes * dstOffset.x));
680-
UR_CHECK_ERROR(cuMemcpyHtoDAsync((CUdeviceptr)DstWithOffset,
681-
(void *)SrcWithOffset,
682-
CopyExtentBytes, Stream));
680+
void *DstWithOffset = static_cast<void *>(
681+
static_cast<char *>(pDst) + (PixelSizeBytes * dstOffset.x));
682+
UR_CHECK_ERROR(
683+
cuMemcpyHtoDAsync((CUdeviceptr)DstWithOffset,
684+
static_cast<const void *>(SrcWithOffset),
685+
CopyExtentBytes, Stream));
683686
} else {
684687
// This should be unreachable.
685688
return UR_RESULT_ERROR_INVALID_VALUE;
@@ -755,15 +758,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
755758
(CUdeviceptr)pSrc) != CUDA_SUCCESS;
756759

757760
size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width;
758-
void *DstWithOffset =
759-
(void *)((char *)pDst + (PixelSizeBytes * dstOffset.x));
761+
void *DstWithOffset = static_cast<void *>(
762+
static_cast<char *>(pDst) + (PixelSizeBytes * dstOffset.x));
760763

761764
if (isCudaArray) {
762765
UR_CHECK_ERROR(cuMemcpyAtoHAsync(DstWithOffset, (CUarray)pSrc,
763766
PixelSizeBytes * srcOffset.x,
764767
CopyExtentBytes, Stream));
765768
} else if (memType == CU_MEMORYTYPE_DEVICE) {
766-
char *SrcWithOffset = (char *)pSrc + (srcOffset.x * PixelSizeBytes);
769+
const char *SrcWithOffset =
770+
static_cast<const char *>(pSrc) + (srcOffset.x * PixelSizeBytes);
767771
UR_CHECK_ERROR(cuMemcpyDtoHAsync(DstWithOffset,
768772
(CUdeviceptr)SrcWithOffset,
769773
CopyExtentBytes, Stream));

source/adapters/hip/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
7676

7777
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
7878
[[maybe_unused]] ur_queue_handle_t hQueue, [[maybe_unused]] void *pDst,
79-
[[maybe_unused]] void *pSrc,
79+
[[maybe_unused]] const void *pSrc,
8080
[[maybe_unused]] const ur_image_format_t *pImageFormat,
8181
[[maybe_unused]] const ur_image_desc_t *pImageDesc,
8282
[[maybe_unused]] ur_exp_image_copy_flags_t imageCopyFlags,

source/adapters/level_zero/image.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
753753
}
754754

755755
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
756-
ur_queue_handle_t hQueue, void *pDst, void *pSrc,
756+
ur_queue_handle_t hQueue, void *pDst, const void *pSrc,
757757
const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc,
758758
ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset,
759759
ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent,
@@ -838,7 +838,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
838838
ze_image_region_t SrcRegion;
839839
UR_CALL(getImageRegionHelper(ZeImageDesc, &srcOffset, &copyExtent,
840840
SrcRegion));
841-
auto *UrImage = static_cast<_ur_image *>(pSrc);
841+
auto *UrImage = static_cast<const _ur_image *>(pSrc);
842842
ZE2UR_CALL(zeCommandListAppendImageCopyToMemory,
843843
(ZeCommandList, pDst, UrImage->ZeImage, &SrcRegion, ZeEvent,
844844
WaitList.Length, WaitList.ZeEventList));

source/adapters/native_cpu/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
7676

7777
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
7878
[[maybe_unused]] ur_queue_handle_t hQueue, [[maybe_unused]] void *pDst,
79-
[[maybe_unused]] void *pSrc,
79+
[[maybe_unused]] const void *pSrc,
8080
[[maybe_unused]] const ur_image_format_t *pImageFormat,
8181
[[maybe_unused]] const ur_image_desc_t *pImageDesc,
8282
[[maybe_unused]] ur_exp_image_copy_flags_t imageCopyFlags,

source/adapters/null/ur_nullddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4388,7 +4388,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
43884388
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
43894389
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
43904390
void *pDst, ///< [in] location the data will be copied to
4391-
void *pSrc, ///< [in] location the data will be copied from
4391+
const void *pSrc, ///< [in] location the data will be copied from
43924392
const ur_image_format_t
43934393
*pImageFormat, ///< [in] pointer to image format specification
43944394
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/adapters/opencl/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
7676

7777
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
7878
[[maybe_unused]] ur_queue_handle_t hQueue, [[maybe_unused]] void *pDst,
79-
[[maybe_unused]] void *pSrc,
79+
[[maybe_unused]] const void *pSrc,
8080
[[maybe_unused]] const ur_image_format_t *pImageFormat,
8181
[[maybe_unused]] const ur_image_desc_t *pImageDesc,
8282
[[maybe_unused]] ur_exp_image_copy_flags_t imageCopyFlags,

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5698,7 +5698,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
56985698
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
56995699
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
57005700
void *pDst, ///< [in] location the data will be copied to
5701-
void *pSrc, ///< [in] location the data will be copied from
5701+
const void *pSrc, ///< [in] location the data will be copied from
57025702
const ur_image_format_t
57035703
*pImageFormat, ///< [in] pointer to image format specification
57045704
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7164,7 +7164,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
71647164
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
71657165
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
71667166
void *pDst, ///< [in] location the data will be copied to
7167-
void *pSrc, ///< [in] location the data will be copied from
7167+
const void *pSrc, ///< [in] location the data will be copied from
71687168
const ur_image_format_t
71697169
*pImageFormat, ///< [in] pointer to image format specification
71707170
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/loader/ur_ldrddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6064,7 +6064,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
60646064
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
60656065
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
60666066
void *pDst, ///< [in] location the data will be copied to
6067-
void *pSrc, ///< [in] location the data will be copied from
6067+
const void *pSrc, ///< [in] location the data will be copied from
60686068
const ur_image_format_t
60696069
*pImageFormat, ///< [in] pointer to image format specification
60706070
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/loader/ur_libapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6788,7 +6788,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
67886788
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
67896789
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
67906790
void *pDst, ///< [in] location the data will be copied to
6791-
void *pSrc, ///< [in] location the data will be copied from
6791+
const void *pSrc, ///< [in] location the data will be copied from
67926792
const ur_image_format_t
67936793
*pImageFormat, ///< [in] pointer to image format specification
67946794
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/ur_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5794,7 +5794,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
57945794
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
57955795
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
57965796
void *pDst, ///< [in] location the data will be copied to
5797-
void *pSrc, ///< [in] location the data will be copied from
5797+
const void *pSrc, ///< [in] location the data will be copied from
57985798
const ur_image_format_t
57995799
*pImageFormat, ///< [in] pointer to image format specification
58005800
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

0 commit comments

Comments
 (0)