mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Use blit when patching data segments with Linker
Change-Id: I79e92add07f5bd7a68d4b03cf8069ed9c2cb907f Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
6be8d332f4
commit
38740c7b75
@@ -51,7 +51,7 @@ const KernelInfo *Program::getKernelInfo(size_t ordinal) const {
|
||||
return kernelInfoArray[ordinal];
|
||||
}
|
||||
|
||||
cl_int Program::linkBinary() {
|
||||
cl_int Program::linkBinary(Device *pDevice, const void *constantsInitData, const void *variablesInitData) {
|
||||
if (linkerInput == nullptr) {
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
@@ -59,19 +59,15 @@ cl_int Program::linkBinary() {
|
||||
Linker::SegmentInfo globals;
|
||||
Linker::SegmentInfo constants;
|
||||
Linker::SegmentInfo exportedFunctions;
|
||||
Linker::PatchableSegment globalsForPatching;
|
||||
Linker::PatchableSegment constantsForPatching;
|
||||
if (this->globalSurface != nullptr) {
|
||||
globals.gpuAddress = static_cast<uintptr_t>(this->globalSurface->getGpuAddress());
|
||||
globals.segmentSize = this->globalSurface->getUnderlyingBufferSize();
|
||||
globalsForPatching.hostPointer = this->globalSurface->getUnderlyingBuffer();
|
||||
globalsForPatching.segmentSize = this->globalSurface->getUnderlyingBufferSize();
|
||||
GraphicsAllocation *globalsForPatching = this->globalSurface;
|
||||
GraphicsAllocation *constantsForPatching = this->constantSurface;
|
||||
if (globalsForPatching != nullptr) {
|
||||
globals.gpuAddress = static_cast<uintptr_t>(globalsForPatching->getGpuAddress());
|
||||
globals.segmentSize = globalsForPatching->getUnderlyingBufferSize();
|
||||
}
|
||||
if (this->constantSurface != nullptr) {
|
||||
constants.gpuAddress = static_cast<uintptr_t>(this->constantSurface->getGpuAddress());
|
||||
constants.segmentSize = this->constantSurface->getUnderlyingBufferSize();
|
||||
constantsForPatching.hostPointer = this->constantSurface->getUnderlyingBuffer();
|
||||
constantsForPatching.segmentSize = this->constantSurface->getUnderlyingBufferSize();
|
||||
if (constantsForPatching != nullptr) {
|
||||
constants.gpuAddress = static_cast<uintptr_t>(constantsForPatching->getGpuAddress());
|
||||
constants.segmentSize = constantsForPatching->getUnderlyingBufferSize();
|
||||
}
|
||||
if (this->linkerInput->getExportedFunctionsSegmentId() >= 0) {
|
||||
// Exported functions reside in instruction heap of one of kernels
|
||||
@@ -95,7 +91,8 @@ cl_int Program::linkBinary() {
|
||||
Linker::UnresolvedExternals unresolvedExternalsInfo;
|
||||
bool linkSuccess = linker.link(globals, constants, exportedFunctions,
|
||||
globalsForPatching, constantsForPatching,
|
||||
isaSegmentsForPatching, unresolvedExternalsInfo);
|
||||
isaSegmentsForPatching, unresolvedExternalsInfo,
|
||||
pDevice, constantsInitData, variablesInitData);
|
||||
this->symbols = linker.extractRelocatedSymbols();
|
||||
if (false == linkSuccess) {
|
||||
std::vector<std::string> kernelNames;
|
||||
@@ -212,7 +209,7 @@ cl_int Program::processProgramInfo(ProgramInfo &src) {
|
||||
kernelInfo->apply(deviceInfoConstants);
|
||||
}
|
||||
|
||||
return linkBinary();
|
||||
return linkBinary(this->pDevice, src.globalConstants.initData, src.globalVariables.initData);
|
||||
}
|
||||
|
||||
void Program::processDebugData() {
|
||||
|
||||
@@ -266,7 +266,7 @@ class Program : public BaseObject<_cl_program> {
|
||||
|
||||
cl_int packDeviceBinary();
|
||||
|
||||
MOCKABLE_VIRTUAL cl_int linkBinary();
|
||||
MOCKABLE_VIRTUAL cl_int linkBinary(Device *pDevice, const void *constantsInitData, const void *variablesInitData);
|
||||
|
||||
void separateBlockKernels();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user