Skip to content

[SYCL] Fix excessive memory allocation for devices in the OpenCL plugin #2954

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 1 commit into from
Jan 5, 2021
Merged
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
16 changes: 8 additions & 8 deletions sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ static pi_result getExtFuncFromContext(pi_context context, T *fptr) {
return PI_SUCCESS;
}

size_t deviceCount;
cl_int ret_err = clGetContextInfo(
cast<cl_context>(context), CL_CONTEXT_DEVICES, 0, nullptr, &deviceCount);
cl_uint deviceCount;
cl_int ret_err =
clGetContextInfo(cast<cl_context>(context), CL_CONTEXT_NUM_DEVICES,
sizeof(cl_uint), &deviceCount, nullptr);

if (ret_err != CL_SUCCESS || deviceCount < 1) {
return PI_INVALID_CONTEXT;
Expand Down Expand Up @@ -354,11 +355,10 @@ pi_result piextQueueCreateWithNativeHandle(pi_native_handle nativeHandle,

pi_result piProgramCreate(pi_context context, const void *il, size_t length,
pi_program *res_program) {

size_t deviceCount;

cl_int ret_err = clGetContextInfo(
cast<cl_context>(context), CL_CONTEXT_DEVICES, 0, nullptr, &deviceCount);
cl_uint deviceCount;
cl_int ret_err =
clGetContextInfo(cast<cl_context>(context), CL_CONTEXT_NUM_DEVICES,
sizeof(cl_uint), &deviceCount, nullptr);

std::vector<cl_device_id> devicesInCtx(deviceCount);

Expand Down