Use ProgramInfo instead of Program in sip kernel

Related-To: NEO-5001
Change-Id: I58eda3ecc52fe1215ea8bbc35f97eea3a9d848e0
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-10-13 11:41:48 +02:00
committed by sys_ocldev
parent dd5c5ed723
commit 97154f7f98
18 changed files with 127 additions and 171 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/built_ins/sip.h"
#include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/device_binary_format/device_binary_formats.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/debug_helpers.h"
@@ -35,8 +36,6 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
auto &sipBuiltIn = this->sipKernels[kernelId];
auto initializer = [&] {
int retVal = 0;
std::vector<char> sipBinary;
auto compilerInteface = device.getCompilerInterface();
UNRECOVERABLE_IF(compilerInteface == nullptr);
@@ -45,19 +44,10 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::Success);
UNRECOVERABLE_IF(sipBinary.size() == 0);
auto program = createProgramForSip(*device.getExecutionEnvironment(),
nullptr,
sipBinary,
sipBinary.size(),
&retVal,
&device);
DEBUG_BREAK_IF(retVal != 0);
UNRECOVERABLE_IF(program == nullptr);
retVal = program->processGenBinary(device.getRootDeviceIndex());
DEBUG_BREAK_IF(retVal != 0);
ProgramInfo programInfo = createProgramInfoForSip(sipBinary, sipBinary.size(), device);
sipBuiltIn.first.reset(new SipKernel(type, program));
sipBuiltIn.first.reset(new SipKernel(type, std::move(programInfo)));
};
std::call_once(sipBuiltIn.second, initializer);
UNRECOVERABLE_IF(sipBuiltIn.first == nullptr);

View File

@@ -17,7 +17,6 @@
#include "shared/source/memory_manager/graphics_allocation.h"
#include "opencl/source/program/kernel_info.h"
#include "opencl/source/program/program.h"
namespace NEO {
@@ -68,24 +67,20 @@ const char *getSipLlSrc(const Device &device) {
return (ptrSize == 8) ? llDummySrc64 : llDummySrc32;
}
SipKernel::SipKernel(SipKernelType type, Program *sipProgram)
: type(type) {
program = sipProgram;
}
SipKernel::~SipKernel() {
program->release();
}
SipKernel::SipKernel(SipKernelType type, ProgramInfo &&sipProgram)
: type(type), programInfo(std::move(sipProgram)) {}
SipKernel::~SipKernel() = default;
GraphicsAllocation *SipKernel::getSipAllocation() const {
return program->getKernelInfo(size_t{0})->getGraphicsAllocation();
return programInfo.kernelInfos[0]->getGraphicsAllocation();
}
const char *SipKernel::getBinary() const {
auto kernelInfo = program->getKernelInfo(size_t{0});
auto kernelInfo = programInfo.kernelInfos[0];
return reinterpret_cast<const char *>(ptrOffset(kernelInfo->heapInfo.pKernelHeap, kernelInfo->systemKernelOffset));
}
size_t SipKernel::getBinarySize() const {
auto kernelInfo = program->getKernelInfo(size_t{0});
auto kernelInfo = programInfo.kernelInfos[0];
return kernelInfo->heapInfo.KernelHeapSize - kernelInfo->systemKernelOffset;
}

View File

@@ -8,13 +8,13 @@
#pragma once
#include "shared/source/built_ins/sip_kernel_type.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/program/program_info.h"
#include <memory>
namespace NEO {
class Device;
class Program;
class GraphicsAllocation;
const char *getSipKernelCompilerInternalOptions(SipKernelType kernel);
@@ -23,11 +23,11 @@ const char *getSipLlSrc(const Device &device);
class SipKernel {
public:
SipKernel(SipKernelType type, Program *sipProgram);
SipKernel(SipKernelType type, ProgramInfo &&sipProgramInfo);
SipKernel(const SipKernel &) = delete;
SipKernel &operator=(const SipKernel &) = delete;
SipKernel(SipKernel &&) = default;
SipKernel &operator=(SipKernel &&) = default;
SipKernel(SipKernel &&) = delete;
SipKernel &operator=(SipKernel &&) = delete;
virtual ~SipKernel();
const char *getBinary() const;
@@ -46,6 +46,6 @@ class SipKernel {
protected:
SipKernelType type = SipKernelType::COUNT;
Program *program = nullptr;
const ProgramInfo programInfo;
};
} // namespace NEO