Skip to content

Commit e1af8f8

Browse files
committed
[Bindless][Exp] Add const-qualifier to Src param in urBindlessImagesImageCopyExp
Add const-qualifier to Src parameter in urBindlessImagesImageCopyExp.
1 parent 642e343 commit e1af8f8

19 files changed

+41
-36
lines changed

include/ur_api.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7749,7 +7749,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
77497749
urBindlessImagesImageCopyExp(
77507750
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
77517751
void *pDst, ///< [in] location the data will be copied to
7752-
void *pSrc, ///< [in] location the data will be copied from
7752+
const void *pSrc, ///< [in] location the data will be copied from
77537753
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
77547754
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
77557755
ur_exp_image_copy_flags_t imageCopyFlags, ///< [in] flags describing copy direction e.g. H2D or D2H
@@ -11106,7 +11106,7 @@ typedef struct ur_bindless_images_sampled_image_create_exp_params_t {
1110611106
typedef struct ur_bindless_images_image_copy_exp_params_t {
1110711107
ur_queue_handle_t *phQueue;
1110811108
void **ppDst;
11109-
void **ppSrc;
11109+
const void **ppSrc;
1111011110
const ur_image_format_t **ppImageFormat;
1111111111
const ur_image_desc_t **ppImageDesc;
1111211112
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
@@ -527,7 +527,7 @@ params:
527527
- type: void*
528528
name: pDst
529529
desc: "[in] location the data will be copied to"
530-
- type: void*
530+
- type: const void*
531531
name: pSrc
532532
desc: "[in] location the data will be copied from"
533533
- type: "const $x_image_format_t*"

source/adapters/cuda/image.cpp

+17-13
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
634634
}
635635

636636
UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
637-
ur_queue_handle_t hQueue, void *pDst, void *pSrc,
637+
ur_queue_handle_t hQueue, void *pDst, const void *pSrc,
638638
const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc,
639639
ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset,
640640
ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent,
@@ -676,18 +676,21 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
676676
(CUdeviceptr)pDst) != CUDA_SUCCESS;
677677

678678
size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width;
679-
char *SrcWithOffset = (char *)pSrc + (srcOffset.x * PixelSizeBytes);
679+
const char *SrcWithOffset =
680+
static_cast<const char *>(pSrc) + (srcOffset.x * PixelSizeBytes);
680681

681682
if (isCudaArray) {
682-
UR_CHECK_ERROR(cuMemcpyHtoAAsync(
683-
(CUarray)pDst, dstOffset.x * PixelSizeBytes,
684-
(void *)SrcWithOffset, CopyExtentBytes, Stream));
683+
UR_CHECK_ERROR(
684+
cuMemcpyHtoAAsync((CUarray)pDst, dstOffset.x * PixelSizeBytes,
685+
static_cast<const void *>(SrcWithOffset),
686+
CopyExtentBytes, Stream));
685687
} else if (memType == CU_MEMORYTYPE_DEVICE) {
686-
void *DstWithOffset =
687-
(void *)((char *)pDst + (PixelSizeBytes * dstOffset.x));
688-
UR_CHECK_ERROR(cuMemcpyHtoDAsync((CUdeviceptr)DstWithOffset,
689-
(void *)SrcWithOffset,
690-
CopyExtentBytes, Stream));
688+
void *DstWithOffset = static_cast<void *>(
689+
static_cast<char *>(pDst) + (PixelSizeBytes * dstOffset.x));
690+
UR_CHECK_ERROR(
691+
cuMemcpyHtoDAsync((CUdeviceptr)DstWithOffset,
692+
static_cast<const void *>(SrcWithOffset),
693+
CopyExtentBytes, Stream));
691694
} else {
692695
// This should be unreachable.
693696
return UR_RESULT_ERROR_INVALID_VALUE;
@@ -763,15 +766,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
763766
(CUdeviceptr)pSrc) != CUDA_SUCCESS;
764767

765768
size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width;
766-
void *DstWithOffset =
767-
(void *)((char *)pDst + (PixelSizeBytes * dstOffset.x));
769+
void *DstWithOffset = static_cast<void *>(
770+
static_cast<char *>(pDst) + (PixelSizeBytes * dstOffset.x));
768771

769772
if (isCudaArray) {
770773
UR_CHECK_ERROR(cuMemcpyAtoHAsync(DstWithOffset, (CUarray)pSrc,
771774
PixelSizeBytes * srcOffset.x,
772775
CopyExtentBytes, Stream));
773776
} else if (memType == CU_MEMORYTYPE_DEVICE) {
774-
char *SrcWithOffset = (char *)pSrc + (srcOffset.x * PixelSizeBytes);
777+
const char *SrcWithOffset =
778+
static_cast<const char *>(pSrc) + (srcOffset.x * PixelSizeBytes);
775779
UR_CHECK_ERROR(cuMemcpyDtoHAsync(DstWithOffset,
776780
(CUdeviceptr)SrcWithOffset,
777781
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
@@ -751,7 +751,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
751751
}
752752

753753
ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
754-
void *pDst, void *pSrc, const ur_image_format_t *pImageFormat,
754+
void *pDst, const void *pSrc, const ur_image_format_t *pImageFormat,
755755
const ur_image_desc_t *pImageDesc, ur_exp_image_copy_flags_t imageCopyFlags,
756756
ur_rect_offset_t srcOffset, ur_rect_offset_t dstOffset,
757757
ur_rect_region_t copyExtent, ur_rect_region_t hostExtent,
@@ -813,8 +813,9 @@ ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
813813
UR_CALL(getImageRegionHelper(ZeImageDesc, &dstOffset, &copyExtent,
814814
DstRegion));
815815
auto *UrImage = static_cast<_ur_image *>(pDst);
816-
char *SrcPtr = static_cast<char *>(pSrc) + srcOffset.z * SrcSlicePitch +
817-
srcOffset.y * SrcRowPitch + srcOffset.x * PixelSizeInBytes;
816+
const char *SrcPtr =
817+
static_cast<const char *>(pSrc) + srcOffset.z * SrcSlicePitch +
818+
srcOffset.y * SrcRowPitch + srcOffset.x * PixelSizeInBytes;
818819
ZE2UR_CALL(zeCommandListAppendImageCopyFromMemoryExt,
819820
(ZeCommandList, UrImage->ZeImage, SrcPtr, &DstRegion,
820821
SrcRowPitch, SrcSlicePitch, ZeEvent, WaitList.Length,
@@ -844,7 +845,7 @@ ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
844845
ze_image_region_t SrcRegion;
845846
UR_CALL(getImageRegionHelper(ZeImageDesc, &srcOffset, &copyExtent,
846847
SrcRegion));
847-
auto *UrImage = static_cast<_ur_image *>(pSrc);
848+
auto *UrImage = static_cast<const _ur_image *>(pSrc);
848849
char *DstPtr = static_cast<char *>(pDst) + dstOffset.z * DstSlicePitch +
849850
dstOffset.y * DstRowPitch + dstOffset.x * PixelSizeInBytes;
850851
ZE2UR_CALL(zeCommandListAppendImageCopyToMemoryExt,
@@ -876,7 +877,7 @@ ur_result_t ur_queue_handle_legacy_t_::bindlessImagesImageCopyExp(
876877
UR_CALL(
877878
getImageRegionHelper(ZeImageDesc, &srcOffset, &copyExtent, SrcRegion));
878879
auto *UrImageDst = static_cast<_ur_image *>(pDst);
879-
auto *UrImageSrc = static_cast<_ur_image *>(pSrc);
880+
auto *UrImageSrc = static_cast<const _ur_image *>(pSrc);
880881
ZE2UR_CALL(zeCommandListAppendImageCopyRegion,
881882
(ZeCommandList, UrImageDst->ZeImage, UrImageSrc->ZeImage,
882883
&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
@@ -4402,7 +4402,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
44024402
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
44034403
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
44044404
void *pDst, ///< [in] location the data will be copied to
4405-
void *pSrc, ///< [in] location the data will be copied from
4405+
const void *pSrc, ///< [in] location the data will be copied from
44064406
const ur_image_format_t
44074407
*pImageFormat, ///< [in] pointer to image format specification
44084408
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
@@ -5710,7 +5710,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
57105710
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
57115711
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
57125712
void *pDst, ///< [in] location the data will be copied to
5713-
void *pSrc, ///< [in] location the data will be copied from
5713+
const void *pSrc, ///< [in] location the data will be copied from
57145714
const ur_image_format_t
57155715
*pImageFormat, ///< [in] pointer to image format specification
57165716
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
@@ -7173,7 +7173,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
71737173
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
71747174
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
71757175
void *pDst, ///< [in] location the data will be copied to
7176-
void *pSrc, ///< [in] location the data will be copied from
7176+
const void *pSrc, ///< [in] location the data will be copied from
71777177
const ur_image_format_t
71787178
*pImageFormat, ///< [in] pointer to image format specification
71797179
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
@@ -6029,7 +6029,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
60296029
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
60306030
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
60316031
void *pDst, ///< [in] location the data will be copied to
6032-
void *pSrc, ///< [in] location the data will be copied from
6032+
const void *pSrc, ///< [in] location the data will be copied from
60336033
const ur_image_format_t
60346034
*pImageFormat, ///< [in] pointer to image format specification
60356035
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
@@ -6815,7 +6815,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
68156815
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
68166816
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
68176817
void *pDst, ///< [in] location the data will be copied to
6818-
void *pSrc, ///< [in] location the data will be copied from
6818+
const void *pSrc, ///< [in] location the data will be copied from
68196819
const ur_image_format_t
68206820
*pImageFormat, ///< [in] pointer to image format specification
68216821
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
@@ -5817,7 +5817,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
58175817
ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
58185818
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
58195819
void *pDst, ///< [in] location the data will be copied to
5820-
void *pSrc, ///< [in] location the data will be copied from
5820+
const void *pSrc, ///< [in] location the data will be copied from
58215821
const ur_image_format_t
58225822
*pImageFormat, ///< [in] pointer to image format specification
58235823
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description

0 commit comments

Comments
 (0)