SWDEV-286150 - Add detailed thread trace support in RGP

- Create hash values for binaries
- Add the binaries into RGP trace
- Add corresponding hash value for every dispatch

Change-Id: I2c3ce004d69f37d0d46bc4744e12f24273517f5e
This commit is contained in:
German Andryeyev
2021-11-03 16:24:04 -04:00
parent b2de4f625c
commit 2a298f2ec3
5 changed files with 110 additions and 26 deletions
+38
View File
@@ -76,6 +76,28 @@ RgpCaptureMgr* RgpCaptureMgr::Create(Pal::IPlatform* platform, const Device& dev
return mgr;
}
// ================================================================================================
uint64_t RgpCaptureMgr::AddElfBinary(const void* exe_binary, size_t exe_binary_size,
const void* elf_binary, size_t elf_binary_size,
Pal::IGpuMemory* pGpuMemory, size_t offset) {
GpuUtil::ElfBinaryInfo elfBinaryInfo = {};
elfBinaryInfo.pBinary = exe_binary;
elfBinaryInfo.binarySize = exe_binary_size; ///< FAT Elf binary size.
elfBinaryInfo.pGpuMemory = pGpuMemory; ///< GPU Memory where the compiled ISA resides.
elfBinaryInfo.offset = static_cast<Pal::gpusize>(offset);
elfBinaryInfo.originalHash = DevDriver::MetroHash::MetroHash64(
reinterpret_cast<const DevDriver::uint8*>(elf_binary), elf_binary_size);
elfBinaryInfo.compiledHash = DevDriver::MetroHash::MetroHash64(
reinterpret_cast<const DevDriver::uint8*>(exe_binary), exe_binary_size);
assert(trace_.gpa_session_ != nullptr);
trace_.gpa_session_->RegisterElfBinary(elfBinaryInfo);
return elfBinaryInfo.originalHash;
}
// ================================================================================================
bool RgpCaptureMgr::Init(Pal::IPlatform* platform) {
if (dev_driver_server_ == nullptr) {
@@ -413,6 +435,9 @@ void RgpCaptureMgr::PreDispatch(VirtualGPU* gpu, const HSAILKernel& kernel, size
}
}
}
// Write the hash value
WriteComputeBindMarker(gpu, kernel.prog().ApiHash());
WriteUserEventMarker(gpu, RgpSqttMarkerUserEventObjectName, kernel.name());
// Write disaptch marker
WriteEventWithDimsMarker(gpu, apiEvent, static_cast<uint32_t>(x), static_cast<uint32_t>(y),
@@ -893,6 +918,19 @@ void RgpCaptureMgr::WriteUserEventMarker(const VirtualGPU* gpu,
WriteMarker(gpu, user_event_, markerSize);
}
// ================================================================================================
// Inserts a compute bind marker
void RgpCaptureMgr::WriteComputeBindMarker(const VirtualGPU* gpu, uint64_t api_hash) const {
RgpSqttMarkerPipelineBind marker = {};
marker.identifier = RgpSqttMarkerIdentifierBindPipeline;
marker.cbID = gpu->queue(MainEngine).cmdBufId();;
marker.bindPoint = 1;
memcpy(marker.apiPsoHash, &api_hash, sizeof(api_hash));
WriteMarker(gpu, &marker, sizeof(marker));
}
} // namespace pal
#endif // PAL_GPUOPEN_OCL