SWDEV-277566 - Only build kernelNames_ when requested.

Currently only clGetProgramInfo/CL_PROGRAM_KERNEL_NAMES requests it.

Change-Id: I38be16999ac2f631850fb5e07eeae54bfbe161ad
Этот коммит содержится в:
Jason Tang
2021-05-12 15:45:10 -04:00
коммит произвёл Jason Tang
родитель e5e635f9bf
Коммит f2a077f62f
2 изменённых файлов: 14 добавлений и 21 удалений
+13 -20
Просмотреть файл
@@ -437,16 +437,6 @@ int32_t Program::link(const std::vector<Device*>& devices, size_t numInputs,
}
}
// Create a string with all kernel names from the program
if (kernelNames_.length() == 0) {
for (auto it = symbols().cbegin(); it != symbols().cend(); ++it) {
if (it != symbols().cbegin()) {
kernelNames_.append(1, ';');
}
kernelNames_.append(it->first.c_str());
}
}
if (notifyFptr != NULL) {
notifyFptr(as_cl(this), data);
}
@@ -602,16 +592,6 @@ int32_t Program::build(const std::vector<Device*>& devices, const char* options,
}
}
}
// Create a string with all kernel names from the program
if (kernelNames_.length() == 0) {
for (auto it = symbols().cbegin(); it != symbols().cend(); ++it) {
if (it != symbols().cbegin()) {
kernelNames_.append(1, ';');
}
kernelNames_.append(it->first.c_str());
}
}
}
if (notifyFptr != NULL) {
@@ -647,6 +627,19 @@ bool Program::load(const std::vector<Device*>& devices) {
return true;
}
const std::string& Program::kernelNames() {
// Create a string with all kernel names from the program
if (kernelNames_.length() == 0) {
for (auto it = symbols().cbegin(); it != symbols().cend(); ++it) {
if (it != symbols().cbegin()) {
kernelNames_.append(1, ';');
}
kernelNames_.append(it->first.c_str());
}
}
return kernelNames_;
}
void Program::clear() {
// Destroy old programs if we have any
for (const auto& it : devicePrograms_) {