mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 15:53:13 +08:00
Correct clCreateProgramWithBinary
store proper devices validate input devices, lengths and binary return correct binaries Related-To: NEO-5001 Change-Id: I3822c291a4430e64afe54f1486b0014f16de3d64 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
4c2d92890f
commit
8afdb2d981
@@ -1344,16 +1344,32 @@ cl_program CL_API_CALL clCreateProgramWithBinary(cl_context context,
|
||||
"lengths", lengths,
|
||||
"binaries", binaries,
|
||||
"binaryStatus", binaryStatus);
|
||||
retVal = validateObjects(context, deviceList, *deviceList, binaries, *binaries, lengths, *lengths);
|
||||
Context *pContext = nullptr;
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext), deviceList, numDevices, binaries, lengths);
|
||||
cl_program program = nullptr;
|
||||
ClDeviceVector deviceVector;
|
||||
|
||||
if (retVal == CL_SUCCESS) {
|
||||
for (auto i = 0u; i < numDevices; i++) {
|
||||
auto device = castToObject<ClDevice>(deviceList[i]);
|
||||
if (!device || !pContext->isDeviceAssociated(*device)) {
|
||||
retVal = CL_INVALID_DEVICE;
|
||||
break;
|
||||
}
|
||||
if (lengths[i] == 0 || binaries[i] == nullptr) {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
break;
|
||||
}
|
||||
deviceVector.push_back(device);
|
||||
}
|
||||
}
|
||||
|
||||
NEO::FileLoggerInstance().dumpBinaryProgram(numDevices, lengths, binaries);
|
||||
|
||||
if (CL_SUCCESS == retVal) {
|
||||
program = Program::create(
|
||||
context,
|
||||
numDevices,
|
||||
deviceList,
|
||||
pContext,
|
||||
deviceVector,
|
||||
lengths,
|
||||
binaries,
|
||||
binaryStatus,
|
||||
|
||||
Reference in New Issue
Block a user