Skip to content

Commit 204a2ec

Browse files
committed
Rename checkUSMImplAlignment to isPointerAlignedTo. Change func to take single *pointer and deference at calls sites where double** was being passed.
1 parent 35706ea commit 204a2ec

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t,
144144
return Err;
145145
}
146146

147-
assert(checkUSMImplAlignment(Alignment, ResultPtr));
147+
assert(isPointerAlignedTo(Alignment, *ResultPtr));
148148
return UR_RESULT_SUCCESS;
149149
}
150150

@@ -160,7 +160,7 @@ ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t,
160160
return Err;
161161
}
162162

163-
assert(checkUSMImplAlignment(Alignment, ResultPtr));
163+
assert(isPointerAlignedTo(Alignment, *ResultPtr));
164164
return UR_RESULT_SUCCESS;
165165
}
166166

@@ -174,7 +174,7 @@ ur_result_t USMHostAllocImpl(void **ResultPtr,
174174
return Err;
175175
}
176176

177-
assert(checkUSMImplAlignment(Alignment, ResultPtr));
177+
assert(isPointerAlignedTo(Alignment, *ResultPtr));
178178
return UR_RESULT_SUCCESS;
179179
}
180180

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
270270
cl_context CLContext = hQueue->Context->CLContext;
271271

272272
if (patternSize <= 128 && isPowerOf2(patternSize) &&
273-
checkUSMImplAlignment(patternSize, &ptr)) {
273+
isPointerAlignedTo(patternSize, &ptr)) {
274274
clEnqueueMemFillINTEL_fn EnqueueMemFill = nullptr;
275275
UR_RETURN_ON_FAILURE(
276276
cl_ext::getExtFuncFromContext<clEnqueueMemFillINTEL_fn>(

unified-runtime/source/common/ur_util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,9 @@ static inline std::string groupDigits(Numeric numeric) {
548548

549549
template <typename T> Spinlock<Rc<T>> AtomicSingleton<T>::instance;
550550

551-
inline bool checkUSMImplAlignment(uint32_t Alignment, void **ResultPtr) {
551+
inline bool isPointerAlignedTo(uint32_t Alignment, void *Ptr) {
552552
return Alignment == 0 ||
553-
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0;
553+
reinterpret_cast<std::uintptr_t>(Ptr) % Alignment == 0;
554554
}
555555

556556
#endif /* UR_UTIL_H */

0 commit comments

Comments
 (0)