Skip to content

Commit 3d8550c

Browse files
authored
[UR][CUDA][HIP] Remove duplicated parameter checking (#17984)
Most of the parameter checking is done in the UR validation layer, so we don't need to re-do it in the adapters. The adapters should only do parameter checking that can't be done in the validation layer.
1 parent df87c03 commit 3d8550c

File tree

13 files changed

+21
-172
lines changed

13 files changed

+21
-172
lines changed

unified-runtime/source/adapters/cuda/image.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp(
269269
std::ignore = pUSMDesc;
270270
std::ignore = pool;
271271

272-
UR_ASSERT((widthInBytes > 0), UR_RESULT_ERROR_INVALID_VALUE);
273272
UR_ASSERT((height > 0), UR_RESULT_ERROR_INVALID_VALUE);
274273
UR_ASSERT((elementSizeBytes > 0), UR_RESULT_ERROR_INVALID_VALUE);
275274

unified-runtime/source/adapters/cuda/kernel.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(
473473
UR_RESULT_ERROR_INVALID_KERNEL);
474474
UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
475475
UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
476-
UR_ASSERT(pSuggestedLocalWorkSize != nullptr,
477-
UR_RESULT_ERROR_INVALID_NULL_POINTER);
478476

479477
ur_device_handle_t Device = hQueue->Device;
480478
ur_result_t Result = UR_RESULT_SUCCESS;

unified-runtime/source/adapters/cuda/memory.cpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@
2424
UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate(
2525
ur_context_handle_t hContext, ur_mem_flags_t flags, size_t size,
2626
const ur_buffer_properties_t *pProperties, ur_mem_handle_t *phBuffer) {
27-
// Validate flags
28-
if (flags &
29-
(UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) {
30-
UR_ASSERT(pProperties && pProperties->pHost,
31-
UR_RESULT_ERROR_INVALID_HOST_PTR);
32-
}
33-
UR_ASSERT(size != 0, UR_RESULT_ERROR_INVALID_BUFFER_SIZE);
34-
3527
// Currently, USE_HOST_PTR is not implemented using host register
3628
// since this triggers a weird segfault after program ends.
3729
// Setting this constant to true enables testing that behavior.
@@ -201,19 +193,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate(
201193
ur_context_handle_t hContext, ur_mem_flags_t flags,
202194
const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc,
203195
void *pHost, ur_mem_handle_t *phMem) {
204-
if (flags &
205-
(UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER | UR_MEM_FLAG_USE_HOST_POINTER)) {
206-
UR_ASSERT(pHost, UR_RESULT_ERROR_INVALID_HOST_PTR);
207-
}
208196
const bool PerformInitialCopy =
209197
(flags & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) ||
210198
((flags & UR_MEM_FLAG_USE_HOST_POINTER));
211199

212-
UR_ASSERT(pImageDesc->stype == UR_STRUCTURE_TYPE_IMAGE_DESC,
213-
UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR);
214-
UR_ASSERT(pImageDesc->type <= UR_MEM_TYPE_IMAGE1D_ARRAY,
215-
UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR);
216-
217200
// We only support RBGA channel order
218201
// TODO: check SYCL CTS and spec. May also have to support BGRA
219202
UR_ASSERT(pImageFormat->channelOrder == UR_IMAGE_CHANNEL_ORDER_RGBA,
@@ -360,12 +343,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory,
360343
/// A buffer partition (or a sub-buffer, in OpenCL terms) is simply implemented
361344
/// as an offset over an existing CUDA allocation.
362345
UR_APIEXPORT ur_result_t UR_APICALL urMemBufferPartition(
363-
ur_mem_handle_t hBuffer, ur_mem_flags_t flags,
364-
ur_buffer_create_type_t bufferCreateType, const ur_buffer_region_t *pRegion,
365-
ur_mem_handle_t *phMem) {
366-
UR_ASSERT(hBuffer, UR_RESULT_ERROR_INVALID_NULL_HANDLE);
367-
UR_ASSERT((flags & UR_MEM_FLAGS_MASK) == 0,
368-
UR_RESULT_ERROR_INVALID_ENUMERATION);
346+
ur_mem_handle_t hBuffer, ur_mem_flags_t flags, ur_buffer_create_type_t,
347+
const ur_buffer_region_t *pRegion, ur_mem_handle_t *phMem) {
369348
UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_MEM_OBJECT);
370349
UR_ASSERT(!hBuffer->isSubBuffer(), UR_RESULT_ERROR_INVALID_MEM_OBJECT);
371350

@@ -387,13 +366,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferPartition(
387366
UR_RESULT_ERROR_INVALID_VALUE);
388367
}
389368

390-
UR_ASSERT(bufferCreateType == UR_BUFFER_CREATE_TYPE_REGION,
391-
UR_RESULT_ERROR_INVALID_ENUMERATION);
392-
UR_ASSERT(pRegion != nullptr, UR_RESULT_ERROR_INVALID_NULL_POINTER);
393-
UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER);
394-
395-
UR_ASSERT(pRegion->size != 0u, UR_RESULT_ERROR_INVALID_BUFFER_SIZE);
396-
397369
auto &BufferImpl = std::get<BufferMem>(hBuffer->Mem);
398370
UR_ASSERT(((pRegion->origin + pRegion->size) <= BufferImpl.getSize()),
399371
UR_RESULT_ERROR_INVALID_BUFFER_SIZE);

unified-runtime/source/adapters/cuda/platform.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ CreateDeviceMemoryProvidersPools(ur_platform_handle_t_ *Platform) {
7575
return UR_RESULT_SUCCESS;
7676
}
7777

78-
UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetInfo(
79-
ur_platform_handle_t hPlatform, ur_platform_info_t PlatformInfoType,
80-
size_t Size, void *pPlatformInfo, size_t *pSizeRet) {
81-
82-
UR_ASSERT(hPlatform, UR_RESULT_ERROR_INVALID_NULL_HANDLE);
78+
UR_APIEXPORT ur_result_t UR_APICALL
79+
urPlatformGetInfo(ur_platform_handle_t, ur_platform_info_t PlatformInfoType,
80+
size_t Size, void *pPlatformInfo, size_t *pSizeRet) {
8381
UrReturnHelper ReturnValue(Size, pPlatformInfo, pSizeRet);
8482

8583
switch (PlatformInfoType) {
@@ -114,15 +112,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetInfo(
114112
/// Triggers the CUDA Driver initialization (cuInit) the first time, so this
115113
/// must be the first PI API called.
116114
UR_APIEXPORT ur_result_t UR_APICALL
117-
urPlatformGet(ur_adapter_handle_t, uint32_t NumEntries,
118-
ur_platform_handle_t *phPlatforms, uint32_t *pNumPlatforms) {
115+
urPlatformGet(ur_adapter_handle_t, uint32_t, ur_platform_handle_t *phPlatforms,
116+
uint32_t *pNumPlatforms) {
119117
try {
120118
static std::once_flag InitFlag;
121119
static uint32_t NumPlatforms = 1;
122120

123-
UR_ASSERT(phPlatforms || pNumPlatforms, UR_RESULT_ERROR_INVALID_VALUE);
124-
UR_ASSERT(!phPlatforms || NumEntries > 0, UR_RESULT_ERROR_INVALID_SIZE);
125-
126121
ur_result_t Result = UR_RESULT_SUCCESS;
127122

128123
std::call_once(

unified-runtime/source/adapters/cuda/usm.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,14 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem,
269269
return Result;
270270
}
271271

272-
UR_APIEXPORT ur_result_t UR_APICALL urUSMImportExp(ur_context_handle_t Context,
273-
void *HostPtr, size_t Size) {
274-
UR_ASSERT(Context, UR_RESULT_ERROR_INVALID_CONTEXT);
275-
UR_ASSERT(!HostPtr, UR_RESULT_ERROR_INVALID_VALUE);
272+
UR_APIEXPORT ur_result_t UR_APICALL urUSMImportExp(ur_context_handle_t, void *,
273+
size_t Size) {
276274
UR_ASSERT(Size > 0, UR_RESULT_ERROR_INVALID_VALUE);
277275
return UR_RESULT_SUCCESS;
278276
}
279277

280-
UR_APIEXPORT ur_result_t UR_APICALL urUSMReleaseExp(ur_context_handle_t Context,
281-
void *HostPtr) {
282-
UR_ASSERT(Context, UR_RESULT_ERROR_INVALID_CONTEXT);
283-
UR_ASSERT(!HostPtr, UR_RESULT_ERROR_INVALID_VALUE);
278+
UR_APIEXPORT ur_result_t UR_APICALL urUSMReleaseExp(ur_context_handle_t,
279+
void *) {
284280
return UR_RESULT_SUCCESS;
285281
}
286282

unified-runtime/source/adapters/hip/command_buffer.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
298298
UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
299299
UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
300300

301-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
302-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
303-
304301
for (uint32_t i = 0; i < numKernelAlternatives; ++i) {
305302
UR_ASSERT(phKernelAlternatives[i] != hKernel,
306303
UR_RESULT_ERROR_INVALID_VALUE);
@@ -393,9 +390,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp(
393390
hipGraphNode_t GraphNode;
394391
std::vector<hipGraphNode_t> DepsList;
395392

396-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
397-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
398-
399393
try {
400394
UR_CHECK_ERROR(getNodesFromSyncPoints(
401395
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -429,8 +423,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp(
429423
hipGraphNode_t GraphNode;
430424
std::vector<hipGraphNode_t> DepsList;
431425

432-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
433-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
434426
UR_ASSERT(size + dstOffset <= std::get<BufferMem>(hDstMem->Mem).getSize(),
435427
UR_RESULT_ERROR_INVALID_SIZE);
436428
UR_ASSERT(size + srcOffset <= std::get<BufferMem>(hSrcMem->Mem).getSize(),
@@ -477,9 +469,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp(
477469
hipGraphNode_t GraphNode;
478470
std::vector<hipGraphNode_t> DepsList;
479471

480-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
481-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
482-
483472
try {
484473
UR_CHECK_ERROR(getNodesFromSyncPoints(
485474
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -525,9 +514,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp(
525514
hipGraphNode_t GraphNode;
526515
std::vector<hipGraphNode_t> DepsList;
527516

528-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
529-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
530-
531517
try {
532518
UR_CHECK_ERROR(getNodesFromSyncPoints(
533519
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -565,9 +551,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp(
565551
hipGraphNode_t GraphNode;
566552
std::vector<hipGraphNode_t> DepsList;
567553

568-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
569-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
570-
571554
try {
572555
UR_CHECK_ERROR(getNodesFromSyncPoints(
573556
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -608,9 +591,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp(
608591
hipGraphNode_t GraphNode;
609592
std::vector<hipGraphNode_t> DepsList;
610593

611-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
612-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
613-
614594
try {
615595
UR_CHECK_ERROR(getNodesFromSyncPoints(
616596
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -656,9 +636,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp(
656636
hipGraphNode_t GraphNode;
657637
std::vector<hipGraphNode_t> DepsList;
658638

659-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
660-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
661-
662639
try {
663640
UR_CHECK_ERROR(getNodesFromSyncPoints(
664641
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -703,9 +680,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp(
703680
hipGraphNode_t GraphNode;
704681
std::vector<hipGraphNode_t> DepsList;
705682

706-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
707-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
708-
709683
try {
710684
UR_CHECK_ERROR(getNodesFromSyncPoints(
711685
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -742,9 +716,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
742716
hipGraphNode_t GraphNode;
743717
std::vector<hipGraphNode_t> DepsList;
744718

745-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
746-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
747-
748719
try {
749720
UR_CHECK_ERROR(getNodesFromSyncPoints(
750721
hCommandBuffer, numSyncPointsInWaitList, pSyncPointWaitList, DepsList));
@@ -786,8 +757,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp(
786757
UR_ASSERT(ArgsAreMultiplesOfPatternSize && PatternIsValid &&
787758
PatternSizeIsValid,
788759
UR_RESULT_ERROR_INVALID_SIZE);
789-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
790-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
791760

792761
auto DstDevice = std::get<BufferMem>(hBuffer->Mem)
793762
.getPtrWithOffset(hCommandBuffer->Device, offset);
@@ -815,8 +784,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp(
815784
auto PatternSizeIsValid = ((patternSize & (patternSize - 1)) == 0) &&
816785
(patternSize > 0); // is a positive power of two
817786

818-
UR_ASSERT(!(pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0),
819-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
820787
UR_ASSERT(PatternIsValid && PatternSizeIsValid, UR_RESULT_ERROR_INVALID_SIZE);
821788
return enqueueCommandBufferFillHelper(
822789
hCommandBuffer, pPtr, hipMemoryTypeUnified, pPattern, patternSize, size,

unified-runtime/source/adapters/hip/device.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform,
11291129
size_t NumDevices = ReturnDevices ? hPlatform->Devices.size() : 0;
11301130

11311131
try {
1132-
UR_ASSERT(pNumDevices || phDevices, UR_RESULT_ERROR_INVALID_VALUE);
1133-
11341132
if (pNumDevices) {
11351133
*pNumDevices = NumDevices;
11361134
}
@@ -1211,9 +1209,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(
12111209
UR_APIEXPORT ur_result_t UR_APICALL
12121210
urDeviceSelectBinary(ur_device_handle_t, const ur_device_binary_t *pBinaries,
12131211
uint32_t NumBinaries, uint32_t *pSelectedBinary) {
1214-
// Ignore unused parameter
1215-
UR_ASSERT(NumBinaries > 0, UR_RESULT_ERROR_INVALID_ARGUMENT);
1216-
12171212
// Look for an image for the HIP target, and return the first one that is
12181213
// found
12191214
#if defined(__HIP_PLATFORM_AMD__)

unified-runtime/source/adapters/hip/enqueue.cpp

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite(
151151
ur_queue_handle_t hQueue, ur_mem_handle_t hBuffer, bool blockingWrite,
152152
size_t offset, size_t size, const void *pSrc, uint32_t numEventsInWaitList,
153153
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
154-
UR_ASSERT(!(phEventWaitList == NULL && numEventsInWaitList > 0),
155-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
156-
UR_ASSERT(!(phEventWaitList != NULL && numEventsInWaitList == 0),
157-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
158-
UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
154+
UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_MEM_OBJECT);
159155

160156
std::unique_ptr<ur_event_handle_t_> RetImplEvent{nullptr};
161157
hBuffer->setLastQueueWritingToMemObj(hQueue);
@@ -199,11 +195,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead(
199195
ur_queue_handle_t hQueue, ur_mem_handle_t hBuffer, bool blockingRead,
200196
size_t offset, size_t size, void *pDst, uint32_t numEventsInWaitList,
201197
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
202-
UR_ASSERT(!(phEventWaitList == NULL && numEventsInWaitList > 0),
203-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
204-
UR_ASSERT(!(phEventWaitList != NULL && numEventsInWaitList == 0),
205-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
206-
UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
198+
UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_MEM_OBJECT);
207199

208200
std::unique_ptr<ur_event_handle_t_> RetImplEvent{nullptr};
209201

@@ -367,10 +359,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWait(
367359
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
368360
ur_queue_handle_t hQueue, uint32_t numEventsInWaitList,
369361
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
370-
UR_ASSERT(!(phEventWaitList == NULL && numEventsInWaitList > 0),
371-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST)
372-
UR_ASSERT(!(phEventWaitList != NULL && numEventsInWaitList == 0),
373-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST)
374362

375363
try {
376364
ScopedDevice Active(hQueue->getDevice());
@@ -503,27 +491,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect(
503491
size_t hostRowPitch, size_t hostSlicePitch, void *pDst,
504492
uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList,
505493
ur_event_handle_t *phEvent) {
506-
UR_ASSERT(!(phEventWaitList == NULL && numEventsInWaitList > 0),
507-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
508-
UR_ASSERT(!(phEventWaitList != NULL && numEventsInWaitList == 0),
509-
UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST);
510-
UR_ASSERT(!(region.width == 0 || region.height == 0 || region.width == 0),
511-
UR_RESULT_ERROR_INVALID_SIZE);
512-
UR_ASSERT(!(bufferRowPitch != 0 && bufferRowPitch < region.width),
513-
UR_RESULT_ERROR_INVALID_SIZE);
514-
UR_ASSERT(!(hostRowPitch != 0 && hostRowPitch < region.width),
515-
UR_RESULT_ERROR_INVALID_SIZE);
516-
UR_ASSERT(!(bufferSlicePitch != 0 &&
517-
bufferSlicePitch < region.height * bufferRowPitch),
518-
UR_RESULT_ERROR_INVALID_SIZE);
519-
UR_ASSERT(!(bufferSlicePitch != 0 && bufferSlicePitch % bufferRowPitch != 0),
520-
UR_RESULT_ERROR_INVALID_SIZE);
521-
UR_ASSERT(
522-
!(hostSlicePitch != 0 && hostSlicePitch < region.height * hostRowPitch),
523-
UR_RESULT_ERROR_INVALID_SIZE);
524-
UR_ASSERT(!(hostSlicePitch != 0 && hostSlicePitch % hostRowPitch != 0),
525-
UR_RESULT_ERROR_INVALID_SIZE);
526-
527494
std::unique_ptr<ur_event_handle_t_> RetImplEvent{nullptr};
528495

529496
try {
@@ -1441,7 +1408,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
14411408
UR_APIEXPORT ur_result_t UR_APICALL
14421409
urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size,
14431410
ur_usm_advice_flags_t advice, ur_event_handle_t *phEvent) {
1444-
UR_ASSERT(pMem && size > 0, UR_RESULT_ERROR_INVALID_VALUE);
14451411
void *HIPDevicePtr = const_cast<void *>(pMem);
14461412
ur_device_handle_t Device = hQueue->getDevice();
14471413

unified-runtime/source/adapters/hip/image.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp(
260260
std::ignore = pUSMDesc;
261261
std::ignore = pool;
262262

263-
UR_ASSERT((widthInBytes > 0), UR_RESULT_ERROR_INVALID_VALUE);
264263
UR_ASSERT((height > 0), UR_RESULT_ERROR_INVALID_VALUE);
265264
UR_ASSERT((elementSizeBytes > 0), UR_RESULT_ERROR_INVALID_VALUE);
266265

unified-runtime/source/adapters/hip/kernel.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(
385385
UR_RESULT_ERROR_INVALID_QUEUE);
386386
UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
387387
UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION);
388-
UR_ASSERT(pSuggestedLocalWorkSize != nullptr,
389-
UR_RESULT_ERROR_INVALID_NULL_POINTER);
390388

391389
size_t MaxThreadsPerBlock[3];
392390
size_t ThreadsPerBlock[3] = {32u, 1u, 1u};

0 commit comments

Comments
 (0)