Skip to content

Commit 709d3bc

Browse files
committed
[Bindless][Exp] Add const-qualifier to Src param in urBindlessImagesImageCopyExp
Add const-qualifier to Src parameter in urBindlessImagesImageCopyExp.
1 parent 33eb5ea commit 709d3bc

File tree

14 files changed

+32
-28
lines changed

14 files changed

+32
-28
lines changed

include/ur_api.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7703,7 +7703,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
77037703
urBindlessImagesImageCopyExp(
77047704
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
77057705
void *pDst, ///< [in] location the data will be copied to
7706-
void *pSrc, ///< [in] location the data will be copied from
7706+
const void *pSrc, ///< [in] location the data will be copied from
77077707
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
77087708
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
77097709
ur_exp_image_copy_flags_t imageCopyFlags, ///< [in] flags describing copy direction e.g. H2D or D2H
@@ -10952,7 +10952,7 @@ typedef struct ur_bindless_images_sampled_image_create_exp_params_t {
1095210952
typedef struct ur_bindless_images_image_copy_exp_params_t {
1095310953
ur_queue_handle_t *phQueue;
1095410954
void **ppDst;
10955-
void **ppSrc;
10955+
const void **ppSrc;
1095610956
const ur_image_format_t **ppImageFormat;
1095710957
const ur_image_desc_t **ppImageDesc;
1095810958
ur_exp_image_copy_flags_t *pimageCopyFlags;

include/ur_ddi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageCreateExp_t)(
15681568
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageCopyExp_t)(
15691569
ur_queue_handle_t,
15701570
void *,
1571-
void *,
1571+
const void *,
15721572
const ur_image_format_t *,
15731573
const ur_image_desc_t *,
15741574
ur_exp_image_copy_flags_t,

scripts/core/exp-bindless-images.yml

+1-1
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

+17-13
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

+1-1
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

+2-2
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

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4390,7 +4390,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
43904390
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
43914391
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
43924392
void *pDst, ///< [in] location the data will be copied to
4393-
void *pSrc, ///< [in] location the data will be copied from
4393+
const void *pSrc, ///< [in] location the data will be copied from
43944394
const ur_image_format_t
43954395
*pImageFormat, ///< [in] pointer to image format specification
43964396
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/adapters/opencl/image.cpp

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5700,7 +5700,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
57005700
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
57015701
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
57025702
void *pDst, ///< [in] location the data will be copied to
5703-
void *pSrc, ///< [in] location the data will be copied from
5703+
const void *pSrc, ///< [in] location the data will be copied from
57045704
const ur_image_format_t
57055705
*pImageFormat, ///< [in] pointer to image format specification
57065706
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/loader/layers/validation/ur_valddi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7175,7 +7175,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
71757175
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
71767176
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
71777177
void *pDst, ///< [in] location the data will be copied to
7178-
void *pSrc, ///< [in] location the data will be copied from
7178+
const void *pSrc, ///< [in] location the data will be copied from
71797179
const ur_image_format_t
71807180
*pImageFormat, ///< [in] pointer to image format specification
71817181
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/loader/ur_ldrddi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6063,7 +6063,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
60636063
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
60646064
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
60656065
void *pDst, ///< [in] location the data will be copied to
6066-
void *pSrc, ///< [in] location the data will be copied from
6066+
const void *pSrc, ///< [in] location the data will be copied from
60676067
const ur_image_format_t
60686068
*pImageFormat, ///< [in] pointer to image format specification
60696069
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/loader/ur_libapi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6793,7 +6793,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
67936793
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
67946794
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
67956795
void *pDst, ///< [in] location the data will be copied to
6796-
void *pSrc, ///< [in] location the data will be copied from
6796+
const void *pSrc, ///< [in] location the data will be copied from
67976797
const ur_image_format_t
67986798
*pImageFormat, ///< [in] pointer to image format specification
67996799
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

source/ur_api.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5798,7 +5798,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
57985798
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
57995799
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
58005800
void *pDst, ///< [in] location the data will be copied to
5801-
void *pSrc, ///< [in] location the data will be copied from
5801+
const void *pSrc, ///< [in] location the data will be copied from
58025802
const ur_image_format_t
58035803
*pImageFormat, ///< [in] pointer to image format specification
58045804
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

0 commit comments

Comments
 (0)