Skip to content

Commit 9266cd5

Browse files
jbrodmanbader
authored andcommitted
[SYCL][USM] Align malloc impl with Spec Proposal behavior (#559)
* Bring implemention in line with the spec proposal. Signed-off-by: James Brodman <james.brodman@intel.com>
1 parent a90938d commit 9266cd5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sycl/source/detail/usm/usm_impl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ void *alignedAlloc(size_t Alignment, size_t Size, const context &Ctxt,
4141
}
4242
}
4343

44-
PI_CHECK(Error);
44+
// Error is for debugging purposes.
45+
// The spec wants a nullptr returned, not an exception.
46+
if (Error != PI_SUCCESS) return nullptr;
4547

4648
return RetVal;
4749
}
@@ -74,7 +76,9 @@ void *alignedAlloc(size_t Alignment, size_t Size, const context &Ctxt,
7476
}
7577
}
7678

77-
PI_CHECK(Error);
79+
// Error is for debugging purposes.
80+
// The spec wants a nullptr returned, not an exception.
81+
if (Error != PI_SUCCESS) return nullptr;
7882

7983
return RetVal;
8084
}

0 commit comments

Comments
 (0)