fix: create buffer with proper size for event packets

Related-To: HSD-18037791927
Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
Naklicki, Mateusz
2024-04-15 18:53:45 +00:00
committed by Compute-Runtime-Automation
parent c2b4699cb6
commit 4e6b8a2c90

View File

@@ -453,13 +453,6 @@ ze_result_t EventImp<TagSizeT>::hostEventSetValue(TagSizeT eventVal) {
uint32_t packets = 0;
std::array<uint64_t, 16 * 4 * 3 * 4> tempCopyData = {}; // 16 packets, 4 timestamps, 3 kernels, 4 32-byte packet size
UNRECOVERABLE_IF(tempCopyData.size() * sizeof(uint64_t) < totalEventSize);
// in case of 32-byte packets the fill has to be appropriately wider
const auto numElements = getMaxPacketsCount() * kernelCount * (this->singlePacketSize / sizeof(uint64_t));
std::fill_n(tempCopyData.begin(), numElements, static_cast<uint64_t>(eventVal));
auto packetHostAddr = basePacketHostAddr;
auto packetGpuAddr = basePacketGpuAddr;
@@ -479,7 +472,10 @@ ze_result_t EventImp<TagSizeT>::hostEventSetValue(TagSizeT eventVal) {
}
}
copyDataToEventAlloc(basePacketHostAddr, basePacketGpuAddr, totalSizeToCopy, tempCopyData[0]);
if (packets > 0) {
std::vector<uint64_t> tempCopyData(totalSizeToCopy / sizeof(uint64_t), static_cast<uint64_t>(eventVal));
copyDataToEventAlloc(basePacketHostAddr, basePacketGpuAddr, totalSizeToCopy, tempCopyData[0]);
}
if (this->signalAllEventPackets) {
setRemainingPackets(eventVal, packetGpuAddr, packetHostAddr, packets);