Skip to content

Commit 3bf0108

Browse files
authored
Merge pull request #2020 from ldrumm/zero-align
Fix unspecified alignment
2 parents f6d24e9 + b5901e4 commit 3bf0108

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/adapters/native_cpu/usm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ ur_result_t getProviderNativeError(const char *, int32_t) {
2424
static ur_result_t alloc_helper(ur_context_handle_t hContext,
2525
const ur_usm_desc_t *pUSMDesc, size_t size,
2626
void **ppMem, ur_usm_type_t type) {
27-
auto alignment = pUSMDesc ? pUSMDesc->align : 1u;
28-
UR_ASSERT((alignment & (alignment - 1)) == 0, UR_RESULT_ERROR_INVALID_VALUE);
27+
auto alignment = (pUSMDesc && pUSMDesc->align) ? pUSMDesc->align : 1u;
28+
UR_ASSERT(isPowerOf2(alignment), UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT);
2929
UR_ASSERT(ppMem, UR_RESULT_ERROR_INVALID_NULL_POINTER);
3030
// TODO: Check Max size when UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE is implemented
3131
UR_ASSERT(size > 0, UR_RESULT_ERROR_INVALID_USM_SIZE);

0 commit comments

Comments
 (0)