From 0e797569329668798131c147ecdb74b7dc7e35f3 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Wed, 30 Oct 2019 19:21:37 -0400 Subject: [PATCH] kfdtest: Return address of packet from IndirectBuffer::AddPacket This can be used for allocating space in the IB for write-back data in a NOP-packet with a payload. Change-Id: I6202b89a455a65326366a15291789004dfdcc0b9 Signed-off-by: Felix Kuehling [ROCm/ROCR-Runtime commit: 07b8c30ce8f79860e815aeb80ed5d39386193b29] --- .../rocr-runtime/tests/kfdtest/src/IndirectBuffer.cpp | 10 +++++----- .../rocr-runtime/tests/kfdtest/src/IndirectBuffer.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.cpp b/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.cpp index 3fa70f27f6..b820230b0d 100644 --- a/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.cpp +++ b/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.cpp @@ -37,16 +37,16 @@ IndirectBuffer::~IndirectBuffer(void) { delete m_IndirectBuf; } -void IndirectBuffer::AddPacket(const BasePacket &packet) { - ASSERT_EQ(packet.PacketType(), m_PacketTypeAllowed) << "Cannot add a packet since packet type doesn't match queue"; +uint32_t *IndirectBuffer::AddPacket(const BasePacket &packet) { + EXPECT_EQ(packet.PacketType(), m_PacketTypeAllowed) << "Cannot add a packet since packet type doesn't match queue"; unsigned int writePtr = m_ActualSize; - ASSERT_GE(m_MaxSize, packet.SizeInDWords() + writePtr) << "Cannot add a packet, not enough room"; + EXPECT_GE(m_MaxSize, packet.SizeInDWords() + writePtr) << "Cannot add a packet, not enough room"; memcpy(m_IndirectBuf->As() + writePtr , packet.GetPacket(), packet.SizeInBytes()); m_ActualSize += packet.SizeInDWords(); m_NumOfPackets++; + + return m_IndirectBuf->As() + writePtr; } - - diff --git a/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.hpp b/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.hpp index c049402558..debf96c62a 100644 --- a/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.hpp +++ b/projects/rocr-runtime/tests/kfdtest/src/IndirectBuffer.hpp @@ -39,7 +39,7 @@ class IndirectBuffer { ~IndirectBuffer(void); // @brief Add packet to queue, all validations are done with gtest ASSERT and EXPECT - void AddPacket(const BasePacket &packet); + uint32_t *AddPacket(const BasePacket &packet); // @returns Actual size of the indirect queue in DWords, equivalent to write pointer unsigned int SizeInDWord() { return m_ActualSize; } // @returns Indirect queue address