feature: Adding support to clCreateProgramWithIL

Related-To: NEO-15701
Signed-off-by: Aleksandra Nizio <aleksandra.nizio@intel.com>
This commit is contained in:
Aleksandra Nizio
2025-09-29 15:19:56 +00:00
committed by Compute-Runtime-Automation
parent 7aa5349ba1
commit 2b8acba2f1
11 changed files with 63 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2022 Intel Corporation
# Copyright (C) 2018-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -9,6 +9,7 @@ set(RUNTIME_SRCS_PROGRAM
${CMAKE_CURRENT_SOURCE_DIR}/build.cpp
${CMAKE_CURRENT_SOURCE_DIR}/compile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/create.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}create_ext.cpp
${CMAKE_CURRENT_SOURCE_DIR}/create.inl
${CMAKE_CURRENT_SOURCE_DIR}/get_info.cpp
${CMAKE_CURRENT_SOURCE_DIR}/link.cpp

View File

@@ -69,7 +69,9 @@ cl_int Program::build(
TranslationInput inputArgs = {IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
if (createdFrom != CreatedFrom::source) {
inputArgs.srcType = isSpirV ? IGC::CodeType::spirV : IGC::CodeType::llvmBc;
inputArgs.srcType = (intermediateRepresentation != IGC::CodeType::invalid)
? intermediateRepresentation
: (isSpirV ? IGC::CodeType::spirV : IGC::CodeType::llvmBc);
inputArgs.src = ArrayRef<const char>(irBinary.get(), irBinarySize);
} else {
inputArgs.src = ArrayRef<const char>(sourceCode.c_str(), sourceCode.size());

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/program/program.h"
namespace NEO {
cl_int Program::createFromILExt(Context *context, const void *il, size_t length) {
return CL_INVALID_BINARY;
}
} // namespace NEO

View File

@@ -176,7 +176,9 @@ cl_int Program::createProgramFromBinary(
auto rootDeviceIndex = clDevice.getRootDeviceIndex();
cl_int retVal = CL_INVALID_BINARY;
if (pBinary == nullptr) {
return retVal;
}
this->irBinary.reset();
this->irBinarySize = 0U;
this->isSpirV = false;
@@ -280,6 +282,8 @@ cl_int Program::createProgramFromBinary(
break;
}
}
} else {
retVal = this->createFromILExt(context, pBinary, binarySize);
}
return retVal;

View File

@@ -276,6 +276,7 @@ class Program : public BaseObject<_cl_program> {
Zebin::Debug::Segments getZebinSegments(uint32_t rootDeviceIndex);
MOCKABLE_VIRTUAL void callPopulateZebinExtendedArgsMetadataOnce(uint32_t rootDeviceIndex);
MOCKABLE_VIRTUAL void callGenerateDefaultExtendedArgsMetadataOnce(uint32_t rootDeviceIndex);
MOCKABLE_VIRTUAL cl_int createFromILExt(Context *context, const void *il, size_t length);
protected:
MOCKABLE_VIRTUAL cl_int createProgramFromBinary(const void *pBinary, size_t binarySize, ClDevice &clDevice);
@@ -388,6 +389,7 @@ class Program : public BaseObject<_cl_program> {
std::string decodeErrors;
std::string decodeWarnings;
} decodedSingleDeviceBinary;
IGC::CodeType::CodeType_t intermediateRepresentation = IGC::CodeType::invalid;
};
static_assert(NEO::NonCopyableAndNonMovable<Program>);