Skip to content

Commit 2fbe4d4

Browse files
Seanst98ProGTX
authored andcommitted
[Bindless][Exp] Add const-qualifier to Src param in urBindlessImagesImageCopyExp
Add const-qualifier to Src parameter in urBindlessImagesImageCopyExp.
1 parent 731376d commit 2fbe4d4

19 files changed

+41
-36
lines changed

include/ur_api.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7748,7 +7748,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
77487748
urBindlessImagesImageCopyExp(
77497749
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
77507750
void *pDst, ///< [in] location the data will be copied to
7751-
void *pSrc, ///< [in] location the data will be copied from
7751+
const void *pSrc, ///< [in] location the data will be copied from
77527752
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
77537753
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
77547754
ur_exp_image_copy_flags_t imageCopyFlags, ///< [in] flags describing copy direction e.g. H2D or D2H
@@ -11103,7 +11103,7 @@ typedef struct ur_bindless_images_sampled_image_create_exp_params_t {
1110311103
typedef struct ur_bindless_images_image_copy_exp_params_t {
1110411104
ur_queue_handle_t *phQueue;
1110511105
void **ppDst;
11106-
void **ppSrc;
11106+
const void **ppSrc;
1110711107
const ur_image_format_t **ppImageFormat;
1110811108
const ur_image_desc_t **ppImageDesc;
1110911109
ur_exp_image_copy_flags_t *pimageCopyFlags;

include/ur_ddi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageCreateExp_t)(
15821582
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageCopyExp_t)(
15831583
ur_queue_handle_t,
15841584
void *,
1585-
void *,
1585+
const void *,
15861586
const ur_image_format_t *,
15871587
const ur_image_desc_t *,
15881588
ur_exp_image_copy_flags_t,

scripts/core/exp-bindless-images.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ params:
525525
- type: void*
526526
name: pDst
527527
desc: "[in] location the data will be copied to"
528-
- type: void*
528+
- type: const void*
529529
name: pSrc
530530
desc: "[in] location the data will be copied from"
531531
- 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

+6-5
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
749749
}
750750

751751
ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
752-
void *pDst, void *pSrc, const ur_image_format_t *pImageFormat,
752+
void *pDst, const void *pSrc, const ur_image_format_t *pImageFormat,
753753
const ur_image_desc_t *pImageDesc, ur_exp_image_copy_flags_t imageCopyFlags,
754754
ur_rect_offset_t srcOffset, ur_rect_offset_t dstOffset,
755755
ur_rect_region_t copyExtent, ur_rect_region_t hostExtent,
@@ -811,8 +811,9 @@ ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
811811
UR_CALL(getImageRegionHelper(ZeImageDesc, &dstOffset, &copyExtent,
812812
DstRegion));
813813
auto *UrImage = static_cast<_ur_image *>(pDst);
814-
char *SrcPtr = static_cast<char *>(pSrc) + srcOffset.z * SrcSlicePitch +
815-
srcOffset.y * SrcRowPitch + srcOffset.x * PixelSizeInBytes;
814+
auto *SrcPtr = static_cast<const char *>(pSrc) +
815+
srcOffset.z * SrcSlicePitch + srcOffset.y * SrcRowPitch +
816+
srcOffset.x * PixelSizeInBytes;
816817
ZE2UR_CALL(zeCommandListAppendImageCopyFromMemoryExt,
817818
(ZeCommandList, UrImage->ZeImage, SrcPtr, &DstRegion,
818819
SrcRowPitch, SrcSlicePitch, ZeEvent, WaitList.Length,
@@ -842,7 +843,7 @@ ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
842843
ze_image_region_t SrcRegion;
843844
UR_CALL(getImageRegionHelper(ZeImageDesc, &srcOffset, &copyExtent,
844845
SrcRegion));
845-
auto *UrImage = static_cast<_ur_image *>(pSrc);
846+
auto *UrImage = static_cast<const _ur_image *>(pSrc);
846847
char *DstPtr = static_cast<char *>(pDst) + dstOffset.z * DstSlicePitch +
847848
dstOffset.y * DstRowPitch + dstOffset.x * PixelSizeInBytes;
848849
ZE2UR_CALL(zeCommandListAppendImageCopyToMemoryExt,
@@ -874,7 +875,7 @@ ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
874875
UR_CALL(
875876
getImageRegionHelper(ZeImageDesc, &srcOffset, &copyExtent, SrcRegion));
876877
auto *UrImageDst = static_cast<_ur_image *>(pDst);
877-
auto *UrImageSrc = static_cast<_ur_image *>(pSrc);
878+
auto *UrImageSrc = static_cast<const _ur_image *>(pSrc);
878879
ZE2UR_CALL(zeCommandListAppendImageCopyRegion,
879880
(ZeCommandList, UrImageDst->ZeImage, UrImageSrc->ZeImage,
880881
&DstRegion, &SrcRegion, ZeEvent, WaitList.Length,

source/adapters/level_zero/queue.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ struct ur_queue_handle_legacy_t_ : _ur_object, public ur_queue_handle_t_ {
381381
const ur_event_handle_t *phEventWaitList,
382382
ur_event_handle_t *phEvent) override;
383383
ur_result_t bindlessImagesImageCopyExp(
384-
void *pDst, void *pSrc, const ur_image_format_t *pImageFormat,
384+
void *pDst, const void *pSrc, const ur_image_format_t *pImageFormat,
385385
const ur_image_desc_t *pImageDesc,
386386
ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset,
387387
ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent,

source/adapters/level_zero/queue_api.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueWriteHostPipe(
255255
phEventWaitList, phEvent);
256256
}
257257
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
258-
ur_queue_handle_t hQueue, void *pDst, void *pSrc,
258+
ur_queue_handle_t hQueue, void *pDst, const void *pSrc,
259259
const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc,
260260
ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset,
261261
ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent,

source/adapters/level_zero/queue_api.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct ur_queue_handle_t_ {
123123
const ur_event_handle_t *,
124124
ur_event_handle_t *) = 0;
125125
virtual ur_result_t bindlessImagesImageCopyExp(
126-
void *, void *, const ur_image_format_t *, const ur_image_desc_t *,
126+
void *, const void *, const ur_image_format_t *, const ur_image_desc_t *,
127127
ur_exp_image_copy_flags_t, ur_rect_offset_t, ur_rect_offset_t,
128128
ur_rect_region_t, ur_rect_region_t, uint32_t, const ur_event_handle_t *,
129129
ur_event_handle_t *) = 0;

source/adapters/level_zero/v2/queue_immediate_in_order.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ ur_result_t ur_queue_immediate_in_order_t::enqueueWriteHostPipe(
435435
}
436436

437437
ur_result_t ur_queue_immediate_in_order_t::bindlessImagesImageCopyExp(
438-
void *pDst, void *pSrc, const ur_image_format_t *pImageFormat,
438+
void *pDst, const void *pSrc, const ur_image_format_t *pImageFormat,
439439
const ur_image_desc_t *pImageDesc, ur_exp_image_copy_flags_t imageCopyFlags,
440440
ur_rect_offset_t srcOffset, ur_rect_offset_t dstOffset,
441441
ur_rect_region_t copyExtent, ur_rect_region_t hostExtent,

source/adapters/level_zero/v2/queue_immediate_in_order.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct ur_queue_immediate_in_order_t : _ur_object, public ur_queue_handle_t_ {
162162
const ur_event_handle_t *phEventWaitList,
163163
ur_event_handle_t *phEvent) override;
164164
ur_result_t bindlessImagesImageCopyExp(
165-
void *pDst, void *pSrc, const ur_image_format_t *pImageFormat,
165+
void *pDst, const void *pSrc, const ur_image_format_t *pImageFormat,
166166
const ur_image_desc_t *pImageDesc,
167167
ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset,
168168
ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent,

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
@@ -4397,7 +4397,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
43974397
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
43984398
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
43994399
void *pDst, ///< [in] location the data will be copied to
4400-
void *pSrc, ///< [in] location the data will be copied from
4400+
const void *pSrc, ///< [in] location the data will be copied from
44014401
const ur_image_format_t
44024402
*pImageFormat, ///< [in] pointer to image format specification
44034403
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
@@ -5707,7 +5707,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
57075707
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
57085708
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
57095709
void *pDst, ///< [in] location the data will be copied to
5710-
void *pSrc, ///< [in] location the data will be copied from
5710+
const void *pSrc, ///< [in] location the data will be copied from
57115711
const ur_image_format_t
57125712
*pImageFormat, ///< [in] pointer to image format specification
57135713
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
@@ -7194,7 +7194,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
71947194
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
71957195
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
71967196
void *pDst, ///< [in] location the data will be copied to
7197-
void *pSrc, ///< [in] location the data will be copied from
7197+
const void *pSrc, ///< [in] location the data will be copied from
71987198
const ur_image_format_t
71997199
*pImageFormat, ///< [in] pointer to image format specification
72007200
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
@@ -6072,7 +6072,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
60726072
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
60736073
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
60746074
void *pDst, ///< [in] location the data will be copied to
6075-
void *pSrc, ///< [in] location the data will be copied from
6075+
const void *pSrc, ///< [in] location the data will be copied from
60766076
const ur_image_format_t
60776077
*pImageFormat, ///< [in] pointer to image format specification
60786078
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
@@ -6811,7 +6811,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
68116811
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
68126812
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
68136813
void *pDst, ///< [in] location the data will be copied to
6814-
void *pSrc, ///< [in] location the data will be copied from
6814+
const void *pSrc, ///< [in] location the data will be copied from
68156815
const ur_image_format_t
68166816
*pImageFormat, ///< [in] pointer to image format specification
68176817
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
@@ -5816,7 +5816,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
58165816
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
58175817
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
58185818
void *pDst, ///< [in] location the data will be copied to
5819-
void *pSrc, ///< [in] location the data will be copied from
5819+
const void *pSrc, ///< [in] location the data will be copied from
58205820
const ur_image_format_t
58215821
*pImageFormat, ///< [in] pointer to image format specification
58225822
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

0 commit comments

Comments
 (0)