Skip to content

[SYCL][L0][CUDA][HIP] Allow empty properties in backends #6225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,8 @@ pi_result cuda_piMemBufferCreate(pi_context context, pi_mem_flags flags,
const pi_mem_properties *properties) {
// Need input memory object
assert(ret_mem != nullptr);
assert(properties == nullptr && "no mem properties goes to cuda RT yet");
assert((properties == nullptr || *properties == 0) &&
"no mem properties goes to cuda RT yet");
// Currently, USE_HOST_PTR is not implemented using host register
// since this triggers a weird segfault after program ends.
// Setting this constant to true enables testing that behavior.
Expand Down Expand Up @@ -4661,7 +4662,7 @@ pi_result cuda_piextUSMHostAlloc(void **result_ptr, pi_context context,
pi_uint32 alignment) {
assert(result_ptr != nullptr);
assert(context != nullptr);
assert(properties == nullptr);
assert(properties == nullptr || *properties == 0);
pi_result result = PI_SUCCESS;
try {
ScopedContext active(context);
Expand All @@ -4685,7 +4686,7 @@ pi_result cuda_piextUSMDeviceAlloc(void **result_ptr, pi_context context,
assert(result_ptr != nullptr);
assert(context != nullptr);
assert(device != nullptr);
assert(properties == nullptr);
assert(properties == nullptr || *properties == 0);
pi_result result = PI_SUCCESS;
try {
ScopedContext active(context);
Expand All @@ -4709,7 +4710,7 @@ pi_result cuda_piextUSMSharedAlloc(void **result_ptr, pi_context context,
assert(result_ptr != nullptr);
assert(context != nullptr);
assert(device != nullptr);
assert(properties == nullptr);
assert(properties == nullptr || *properties == 0);
pi_result result = PI_SUCCESS;
try {
ScopedContext active(context);
Expand Down
9 changes: 5 additions & 4 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,8 @@ pi_result hip_piMemBufferCreate(pi_context context, pi_mem_flags flags,
const pi_mem_properties *properties) {
// Need input memory object
assert(ret_mem != nullptr);
assert(properties == nullptr && "no mem properties goes to HIP RT yet");
assert((properties == nullptr || *properties == 0) &&
"no mem properties goes to HIP RT yet");
// Currently, USE_HOST_PTR is not implemented using host register
// since this triggers a weird segfault after program ends.
// Setting this constant to true enables testing that behavior.
Expand Down Expand Up @@ -4568,7 +4569,7 @@ pi_result hip_piextUSMHostAlloc(void **result_ptr, pi_context context,
pi_uint32 alignment) {
assert(result_ptr != nullptr);
assert(context != nullptr);
assert(properties == nullptr);
assert(properties == nullptr || *properties == 0);
pi_result result = PI_SUCCESS;
try {
ScopedContext active(context);
Expand All @@ -4592,7 +4593,7 @@ pi_result hip_piextUSMDeviceAlloc(void **result_ptr, pi_context context,
assert(result_ptr != nullptr);
assert(context != nullptr);
assert(device != nullptr);
assert(properties == nullptr);
assert(properties == nullptr || *properties == 0);
pi_result result = PI_SUCCESS;
try {
ScopedContext active(context);
Expand All @@ -4616,7 +4617,7 @@ pi_result hip_piextUSMSharedAlloc(void **result_ptr, pi_context context,
assert(result_ptr != nullptr);
assert(context != nullptr);
assert(device != nullptr);
assert(properties == nullptr);
assert(properties == nullptr || *properties == 0);
pi_result result = PI_SUCCESS;
try {
ScopedContext active(context);
Expand Down
2 changes: 1 addition & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7381,7 +7381,7 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
// See if the memory is going to be read-only on the device.
bool DeviceReadOnly = false;
// Check that incorrect bits are not set in the properties.
if (Properties) {
if (Properties && *Properties != 0) {
PI_ASSERT(*(Properties) == PI_MEM_ALLOC_FLAGS && *(Properties + 2) == 0,
PI_INVALID_VALUE);
DeviceReadOnly = *(Properties + 1) & PI_MEM_ALLOC_DEVICE_READ_ONLY;
Expand Down