Skip to content

Commit 4954850

Browse files
authored
Merge pull request #906 from 0x12CC/l0_usm_error_checking
[UR][L0] Propagate errors from `USMAllocationMakeResident`
2 parents 0677296 + e5d6a91 commit 4954850

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

source/adapters/level_zero/usm.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ static ur_result_t USMDeviceAllocImpl(void **ResultPtr,
192192
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0,
193193
UR_RESULT_ERROR_INVALID_VALUE);
194194

195-
USMAllocationMakeResident(USMDeviceAllocationForceResidency, Context, Device,
196-
*ResultPtr, Size);
197-
return UR_RESULT_SUCCESS;
195+
return USMAllocationMakeResident(USMDeviceAllocationForceResidency, Context,
196+
Device, *ResultPtr, Size);
198197
}
199198

200199
static ur_result_t USMSharedAllocImpl(void **ResultPtr,
@@ -225,11 +224,9 @@ static ur_result_t USMSharedAllocImpl(void **ResultPtr,
225224
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0,
226225
UR_RESULT_ERROR_INVALID_VALUE);
227226

228-
USMAllocationMakeResident(USMSharedAllocationForceResidency, Context, Device,
229-
*ResultPtr, Size);
230-
231227
// TODO: Handle PI_MEM_ALLOC_DEVICE_READ_ONLY.
232-
return UR_RESULT_SUCCESS;
228+
return USMAllocationMakeResident(USMSharedAllocationForceResidency, Context,
229+
Device, *ResultPtr, Size);
233230
}
234231

235232
static ur_result_t USMHostAllocImpl(void **ResultPtr,
@@ -247,9 +244,8 @@ static ur_result_t USMHostAllocImpl(void **ResultPtr,
247244
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0,
248245
UR_RESULT_ERROR_INVALID_VALUE);
249246

250-
USMAllocationMakeResident(USMHostAllocationForceResidency, Context, nullptr,
251-
*ResultPtr, Size);
252-
return UR_RESULT_SUCCESS;
247+
return USMAllocationMakeResident(USMHostAllocationForceResidency, Context,
248+
nullptr, *ResultPtr, Size);
253249
}
254250

255251
UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc(

0 commit comments

Comments
 (0)