From dcc82f97ac838978a4ce2dede7b2bb42535d8a72 Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Wed, 18 Oct 2023 23:37:49 -0500 Subject: [PATCH] Move AQLPacket::~AQLPacket to aql_packet.cpp (#137) - this was defined in queue.cpp --- source/lib/rocprofiler/hsa/CMakeLists.txt | 3 +- source/lib/rocprofiler/hsa/aql_packet.cpp | 50 +++++++++++++++++++++++ source/lib/rocprofiler/hsa/queue.cpp | 21 ---------- 3 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 source/lib/rocprofiler/hsa/aql_packet.cpp diff --git a/source/lib/rocprofiler/hsa/CMakeLists.txt b/source/lib/rocprofiler/hsa/CMakeLists.txt index ae23d01b6b..7a1b724f29 100644 --- a/source/lib/rocprofiler/hsa/CMakeLists.txt +++ b/source/lib/rocprofiler/hsa/CMakeLists.txt @@ -1,4 +1,5 @@ -set(ROCPROFILER_LIB_HSA_SOURCES hsa.cpp queue.cpp queue_controller.cpp agent_cache.cpp) +set(ROCPROFILER_LIB_HSA_SOURCES hsa.cpp queue.cpp queue_controller.cpp agent_cache.cpp + aql_packet.cpp) set(ROCPROFILER_LIB_HSA_HEADERS hsa.hpp defines.hpp types.hpp utils.hpp queue.hpp queue_controller.hpp agent_cache.hpp aql_packet.hpp) target_sources(rocprofiler-object-library PRIVATE ${ROCPROFILER_LIB_HSA_SOURCES} diff --git a/source/lib/rocprofiler/hsa/aql_packet.cpp b/source/lib/rocprofiler/hsa/aql_packet.cpp new file mode 100644 index 0000000000..ff0a5568ec --- /dev/null +++ b/source/lib/rocprofiler/hsa/aql_packet.cpp @@ -0,0 +1,50 @@ +// Copyright (c) 2018-2023 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "lib/rocprofiler/hsa/aql_packet.hpp" + +#include + +namespace rocprofiler +{ +namespace hsa +{ +AQLPacket::~AQLPacket() +{ + if(!command_buf_mallocd) + { + free_func(profile.command_buffer.ptr); + } + else + { + ::free(profile.command_buffer.ptr); + } + + if(!output_buffer_malloced) + { + free_func(profile.output_buffer.ptr); + } + else + { + ::free(profile.output_buffer.ptr); + } +} +} // namespace hsa +} // namespace rocprofiler diff --git a/source/lib/rocprofiler/hsa/queue.cpp b/source/lib/rocprofiler/hsa/queue.cpp index c1fccdbecc..afafd48a81 100644 --- a/source/lib/rocprofiler/hsa/queue.cpp +++ b/source/lib/rocprofiler/hsa/queue.cpp @@ -245,27 +245,6 @@ WriteInterceptor(const void* packets, } } // namespace -AQLPacket::~AQLPacket() -{ - if(!command_buf_mallocd) - { - free_func(profile.command_buffer.ptr); - } - else - { - free(profile.command_buffer.ptr); - } - - if(!output_buffer_malloced) - { - free_func(profile.output_buffer.ptr); - } - else - { - free(profile.output_buffer.ptr); - } -} - Queue::~Queue() { // Potentially replace with condition variable at some point