Use all passed devices when linking program

Related-To: NEO-5001
Change-Id: I3944375023b9cb3322df83e6e042ba8be2bd762c
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-10-28 17:18:37 +01:00
committed by sys_ocldev
parent 17970ad5e7
commit 430cca3f4c
11 changed files with 397 additions and 119 deletions

View File

@ -1539,30 +1539,10 @@ cl_int CL_API_CALL clCompileProgram(cl_program program,
retVal = validateObjects(WithCastToInternal(program, &pProgram), Program::isValidCallback(funcNotify, userData));
ClDeviceVector deviceVector;
const ClDeviceVector *deviceVectorPtr = &deviceVector;
ClDeviceVector *deviceVectorPtr = &deviceVector;
if (CL_SUCCESS == retVal) {
if (deviceList == nullptr) {
if (numDevices == 0) {
deviceVectorPtr = &pProgram->getDevices();
} else {
retVal = CL_INVALID_VALUE;
}
} else {
if (numDevices == 0) {
retVal = CL_INVALID_VALUE;
} else {
for (auto i = 0u; i < numDevices; i++) {
auto device = castToObject<ClDevice>(deviceList[i]);
if (!device || !pProgram->isDeviceAssociated(*device)) {
retVal = CL_INVALID_DEVICE;
break;
}
deviceVector.push_back(device);
}
}
}
retVal = Program::processInputDevices(deviceVectorPtr, numDevices, deviceList, pProgram->getDevices());
}
if (CL_SUCCESS == retVal) {
retVal = pProgram->compile(*deviceVectorPtr, options,
@ -1590,23 +1570,28 @@ cl_program CL_API_CALL clLinkProgram(cl_context context,
ErrorCodeHelper err(errcodeRet, CL_SUCCESS);
Context *pContext = nullptr;
Program *program = nullptr;
Program *pProgram = nullptr;
retVal = validateObjects(WithCastToInternal(context, &pContext), Program::isValidCallback(funcNotify, userData));
ClDeviceVector deviceVector;
ClDeviceVector *deviceVectorPtr = &deviceVector;
if (CL_SUCCESS == retVal) {
retVal = Program::processInputDevices(deviceVectorPtr, numDevices, deviceList, pContext->getDevices());
}
if (CL_SUCCESS == retVal) {
ClDeviceVector deviceVector;
deviceVector.push_back(pContext->getDevice(0));
program = new Program(pContext, false, deviceVector);
retVal = program->link(numDevices, deviceList, options,
numInputPrograms, inputPrograms);
program->invokeCallback(funcNotify, userData);
pProgram = new Program(pContext, false, *deviceVectorPtr);
retVal = pProgram->link(*deviceVectorPtr, options,
numInputPrograms, inputPrograms);
pProgram->invokeCallback(funcNotify, userData);
}
err.set(retVal);
TRACING_EXIT(clLinkProgram, (cl_program *)&program);
return program;
TRACING_EXIT(clLinkProgram, (cl_program *)&pProgram);
return pProgram;
}
cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id platform) {