SWDEV-243423 - Avoid repeated metadata processing if the unbundled binary_ptr is same.
Change-Id: I71e008021b728dec61187d9ff29483ad8c4cad5c
Цей коміт міститься в:
зафіксовано
Karthik Jayaprakash
джерело
9ed1767c02
коміт
e993bf9f47
@@ -1978,7 +1978,7 @@ bool Program::initClBinary(const char* binaryIn, size_t size) {
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
bool Program::setBinary(const char* binaryIn, size_t size) {
|
||||
bool Program::setBinary(const char* binaryIn, size_t size, const device::Program* same_dev_prog) {
|
||||
if (!initClBinary(binaryIn, size)) {
|
||||
DevLogError("Init CL Binary failed \n");
|
||||
return false;
|
||||
@@ -2025,8 +2025,13 @@ bool Program::setBinary(const char* binaryIn, size_t size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
clBinary()->loadCompileOptions(compileOptions_);
|
||||
clBinary()->loadLinkOptions(linkOptions_);
|
||||
if (same_dev_prog != nullptr) {
|
||||
compileOptions_ = same_dev_prog->compileOptions();
|
||||
linkOptions_ = same_dev_prog->linkOptions();
|
||||
} else {
|
||||
clBinary()->loadCompileOptions(compileOptions_);
|
||||
clBinary()->loadLinkOptions(linkOptions_);
|
||||
}
|
||||
|
||||
clBinary()->resetElfIn();
|
||||
return true;
|
||||
|
||||
Звичайний файл → Виконуваний файл
+3
-1
@@ -166,6 +166,8 @@ class Program : public amd::HeapObject {
|
||||
//! Return the compiler options used to build the program.
|
||||
const std::string& compileOptions() const { return compileOptions_; }
|
||||
|
||||
const std::string& linkOptions() const { return linkOptions_; }
|
||||
|
||||
//! Return the option arg passed in to clCompileProgram(), clLinkProgram(),
|
||||
//! or clBuildProgram(), whichever is called last
|
||||
const std::string lastBuildOptionsArg() const { return lastBuildOptionsArg_; }
|
||||
@@ -191,7 +193,7 @@ class Program : public amd::HeapObject {
|
||||
ClBinary* clBinary() { return clBinary_; }
|
||||
const ClBinary* clBinary() const { return clBinary_; }
|
||||
|
||||
bool setBinary(const char* binaryIn, size_t size);
|
||||
bool setBinary(const char* binaryIn, size_t size, const device::Program* same_dev_prog = nullptr);
|
||||
|
||||
type_t type() const { return type_; }
|
||||
|
||||
|
||||
@@ -86,7 +86,8 @@ const Symbol* Program::findSymbol(const char* kernelName) const {
|
||||
}
|
||||
|
||||
int32_t Program::addDeviceProgram(Device& device, const void* image, size_t length,
|
||||
bool make_copy, amd::option::Options* options) {
|
||||
bool make_copy, amd::option::Options* options,
|
||||
const amd::Program* same_prog) {
|
||||
if (image != NULL && !amd::isElfMagic((const char*)image)) {
|
||||
if (device.settings().useLightning_) {
|
||||
return CL_INVALID_BINARY;
|
||||
@@ -175,7 +176,14 @@ int32_t Program::addDeviceProgram(Device& device, const void* image, size_t leng
|
||||
binary_[&rootDev] = std::make_tuple(memory, length, make_copy);
|
||||
}
|
||||
|
||||
if (!program->setBinary(reinterpret_cast<const char*>(memory), length)) {
|
||||
const device::Program* same_dev_prog = nullptr;
|
||||
if ((amd::IS_HIP) && (same_prog != nullptr)) {
|
||||
auto same_dev_prog_map_ = same_prog->devicePrograms();
|
||||
guarantee(same_dev_prog_map_.size() == 1);
|
||||
same_dev_prog = same_dev_prog_map_.begin()->second;
|
||||
}
|
||||
|
||||
if (!program->setBinary(reinterpret_cast<const char*>(memory), length, same_dev_prog)) {
|
||||
delete program;
|
||||
return CL_INVALID_BINARY;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,8 @@ class Program : public RuntimeObject {
|
||||
|
||||
//! Add a new device program with or without binary image and options.
|
||||
int32_t addDeviceProgram(Device&, const void* image = NULL, size_t len = 0,
|
||||
bool make_copy = true, amd::option::Options* options = NULL);
|
||||
bool make_copy = true, amd::option::Options* options = NULL,
|
||||
const amd::Program* same_prog = nullptr);
|
||||
|
||||
//! Find the section for the given device. Return NULL if not found.
|
||||
device::Program* getDeviceProgram(const Device& device) const;
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача