Add initial implementation of specialization constants

Related-To: NEO-2260

Change-Id: Ib722109039555a028eb4ec0862e9de72342f9730
Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
Jobczyk, Lukasz
2019-04-25 12:46:43 +02:00
committed by sys_ocldev
parent 3a75c4fb71
commit 971eb7a1b4
16 changed files with 561 additions and 42 deletions

View File

@@ -131,7 +131,7 @@ cl_int CompilerInterface::build(
if (!binaryLoaded) {
auto igcTranslationCtx = createIgcTranslationCtx(device, intermediateCodeType, IGC::CodeType::oclGenBin);
auto igcOutput = translate(igcTranslationCtx.get(), intermediateRepresentation.get(),
auto igcOutput = translate(igcTranslationCtx.get(), intermediateRepresentation.get(), program.getSpecConstIdsBuffer().get(), program.getSpecConstValuesBuffer().get(),
fclOptions.get(), fclInternalOptions.get(), inputArgs.GTPinInput);
if (igcOutput == nullptr) {
@@ -272,6 +272,27 @@ cl_int CompilerInterface::link(
return CL_SUCCESS;
}
cl_int CompilerInterface::getSpecConstantsInfo(Program &program, const TranslationArgs &inputArgs) {
if (false == isCompilerAvailable()) {
return CL_COMPILER_NOT_AVAILABLE;
}
auto igcTranslationCtx = createIgcTranslationCtx(program.getDevice(0), IGC::CodeType::spirV, IGC::CodeType::oclGenBin);
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain.get(), inputArgs.pInput, inputArgs.InputSize);
program.getSpecConstIdsBuffer() = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
program.getSpecConstSizesBuffer() = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
program.getSpecConstValuesBuffer() = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
auto retVal = getSpecConstantsInfoImpl(igcTranslationCtx.get(), inSrc.get(), program.getSpecConstIdsBuffer().get(), program.getSpecConstSizesBuffer().get(), program.getSpecConstValuesBuffer().get());
if (!retVal) {
return CL_OUT_OF_HOST_MEMORY;
}
return CL_SUCCESS;
}
cl_int CompilerInterface::createLibrary(
Program &program,
const TranslationArgs &inputArgs) {