Skip to content

Commit

Permalink
Merge pull request #2020 from ldrumm/zero-align
Browse files Browse the repository at this point in the history
Fix unspecified alignment
  • Loading branch information
aarongreig authored Oct 16, 2024
2 parents a31bfd1 + 60c9791 commit 2631b1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/adapters/native_cpu/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ur_result_t getProviderNativeError(const char *, int32_t) {
static ur_result_t alloc_helper(ur_context_handle_t hContext,
const ur_usm_desc_t *pUSMDesc, size_t size,
void **ppMem, ur_usm_type_t type) {
auto alignment = pUSMDesc ? pUSMDesc->align : 1u;
UR_ASSERT((alignment & (alignment - 1)) == 0, UR_RESULT_ERROR_INVALID_VALUE);
auto alignment = (pUSMDesc && pUSMDesc->align) ? pUSMDesc->align : 1u;
UR_ASSERT(isPowerOf2(alignment), UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT);
UR_ASSERT(ppMem, UR_RESULT_ERROR_INVALID_NULL_POINTER);
// TODO: Check Max size when UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE is implemented
UR_ASSERT(size > 0, UR_RESULT_ERROR_INVALID_USM_SIZE);
Expand Down

0 comments on commit 2631b1f

Please sign in to comment.