mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
feat(zebin): get extended args metadata on clGetKernelArgInfo API call
This commit adds support for retrieving extended args metadata passed in .kernel_misc_info zeInfo's section on clGetKernelArgInfo call. Related-To: NEO-7372 Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b284b727e9
commit
709e322a4a
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/device_binary_format/device_binary_formats.h"
|
||||
#include "shared/source/device_binary_format/zebin_decoder.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
@@ -248,6 +249,7 @@ cl_int Program::processProgramInfo(ProgramInfo &src, const ClDevice &clDevice) {
|
||||
buildInfos[rootDeviceIndex].globalVarTotalSize = 0u;
|
||||
}
|
||||
}
|
||||
buildInfos[rootDeviceIndex].kernelMiscInfoPos = src.kernelMiscInfoPos;
|
||||
|
||||
for (auto &kernelInfo : kernelInfoArray) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
@@ -346,4 +348,21 @@ void Program::notifyDebuggerWithDebugData(ClDevice *clDevice) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Program::callPopulateZebinExtendedArgsMetadataOnce(uint32_t rootDeviceIndex) {
|
||||
auto &buildInfo = this->buildInfos[rootDeviceIndex];
|
||||
auto extractAndDecodeMetadata = [&]() {
|
||||
auto refBin = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(buildInfo.unpackedDeviceBinary.get()), buildInfo.unpackedDeviceBinarySize);
|
||||
if (false == NEO::isDeviceBinaryFormat<NEO::DeviceBinaryFormat::Zebin>(refBin)) {
|
||||
return;
|
||||
}
|
||||
std::string errors{}, warnings{};
|
||||
auto metadataString = extractZeInfoMetadataStringFromZebin(refBin, errors, warnings);
|
||||
auto decodeError = decodeAndPopulateKernelMiscInfo(buildInfo.kernelMiscInfoPos, buildInfo.kernelInfoArray, metadataString, errors, warnings);
|
||||
if (NEO::DecodeError::Success != decodeError) {
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error in decodeAndPopulateKernelMiscInfo: %s\n", errors.c_str());
|
||||
}
|
||||
};
|
||||
std::call_once(extractAndDecodeMetadataOnce, extractAndDecodeMetadata);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -290,6 +290,7 @@ class Program : public BaseObject<_cl_program> {
|
||||
void notifyDebuggerWithDebugData(ClDevice *clDevice);
|
||||
MOCKABLE_VIRTUAL void createDebugZebin(uint32_t rootDeviceIndex);
|
||||
Debug::Segments getZebinSegments(uint32_t rootDeviceIndex);
|
||||
void callPopulateZebinExtendedArgsMetadataOnce(uint32_t rootDeviceIndex);
|
||||
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL cl_int createProgramFromBinary(const void *pBinary, size_t binarySize, ClDevice &clDevice);
|
||||
@@ -356,6 +357,7 @@ class Program : public BaseObject<_cl_program> {
|
||||
|
||||
std::unique_ptr<char[]> debugData;
|
||||
size_t debugDataSize = 0U;
|
||||
size_t kernelMiscInfoPos = std::string::npos;
|
||||
};
|
||||
|
||||
std::vector<BuildInfo> buildInfos;
|
||||
@@ -375,6 +377,8 @@ class Program : public BaseObject<_cl_program> {
|
||||
uint32_t maxRootDeviceIndex = std::numeric_limits<uint32_t>::max();
|
||||
std::mutex lockMutex;
|
||||
uint32_t exposedKernels = 0;
|
||||
|
||||
std::once_flag extractAndDecodeMetadataOnce;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user