Pass proper spec const values to IGC

Change-Id: Id02f6fca1ce3ab603ac8b539ecb8ae5383276473
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-03-12 12:55:57 +01:00
committed by sys_ocldev
parent 5b255433c5
commit fe0f259eaa
3 changed files with 29 additions and 48 deletions

View File

@@ -130,15 +130,6 @@ Program::~Program() {
if (context && !isBuiltIn) {
context->decRefInternal();
}
if (specConstantsValues.get() != nullptr) {
for (auto i = 0u; i < specConstantsValues->GetSize<void *>(); i++) {
auto specConstPtr = specConstantsValues->GetMemory<void *>()[i];
if (specConstPtr != nullptr) {
delete[] reinterpret_cast<char *>(specConstPtr);
}
}
}
}
cl_int Program::createProgramFromBinary(
@@ -250,12 +241,9 @@ cl_int Program::updateSpecializationConstant(cl_uint specId, size_t specSize, co
for (uint32_t i = 0; i < specConstantsIds->GetSize<uint32_t>(); i++) {
if (specConstantsIds->GetMemory<uint32_t>()[i] == specId) {
if (specConstantsSizes->GetMemory<uint32_t>()[i] == static_cast<uint32_t>(specSize)) {
auto specConstPtr = specConstantsValues->GetMemoryWriteable<void *>()[i];
if (specConstPtr == nullptr) {
specConstPtr = new char[specSize];
}
memcpy_s(specConstPtr, specSize, specValue, specSize);
specConstantsValues->GetMemoryWriteable<void *>()[i] = specConstPtr;
uint64_t specConstValue = 0u;
memcpy_s(&specConstValue, sizeof(uint64_t), specValue, specSize);
specConstantsValues->GetMemoryWriteable<uint64_t>()[i] = specConstValue;
return CL_SUCCESS;
} else {
return CL_INVALID_VALUE;