Updates to compilation without HSA PC sampling support (#887)
- move ROCPROFILER_SDK_HSA_PC_SAMPLING define from lib/rocprofiler-sdk/hsa/hsa.hpp to lib/rocprofiler-sdk/pc_sampling/defines.hpp - Update lib/rocprofiler-sdk/pc_sampling/CMakeLists.txt to return if HSA version is < 1.14.0 - update various includes for "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
This commit is contained in:
committed by
GitHub
vanhempi
c45bf712d1
commit
fbf0b49e22
@@ -22,6 +22,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
#include <hsa/hsa_api_trace.h>
|
||||
@@ -30,28 +32,6 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#if defined(HSA_PC_SAMPLING_API_TABLE_MAJOR_VERSION) && \
|
||||
HSA_PC_SAMPLING_API_TABLE_MAJOR_VERSION > 0x0
|
||||
# define ROCPROFILER_SDK_HSA_PC_SAMPLING 1
|
||||
#else
|
||||
# define ROCPROFILER_SDK_HSA_PC_SAMPLING 0
|
||||
#endif
|
||||
|
||||
// redundant check based on whether the pc sampling API header was found
|
||||
#if defined __has_include
|
||||
# if __has_include(<hsa/hsa_ven_amd_pc_sampling.h>)
|
||||
# if ROCPROFILER_SDK_HSA_PC_SAMPLING == 0
|
||||
# error \
|
||||
"rocprofiler-sdk disabled the HSA PC sampling table even though the hsa_ven_amd_pc_sampling.h was found"
|
||||
# endif
|
||||
# else
|
||||
# if ROCPROFILER_SDK_HSA_PC_SAMPLING == 1
|
||||
# error \
|
||||
"rocprofiler-sdk enabled the HSA PC sampling table even though the hsa_ven_amd_pc_sampling.h was not found"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
namespace hsa
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
#
|
||||
# PC Sampling
|
||||
# - HSA support officially added in HSA-Runtime v1.14.0
|
||||
#
|
||||
if(hsa-runtime64_VERSION AND hsa-runtime64_VERSION VERSION_LESS 1.14.0)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(ROCPROFILER_PC_SAMPLING_SOURCES hsa_adapter.cpp utils.cpp service.cpp cid_manager.cpp
|
||||
code_object.cpp)
|
||||
set(ROCPROFILER_PC_SAMPLING_HEADERS hsa_adapter.hpp utils.hpp service.hpp types.hpp
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rocprofiler-sdk/hsa.h>
|
||||
|
||||
#if defined(HSA_PC_SAMPLING_API_TABLE_MAJOR_VERSION) && \
|
||||
HSA_PC_SAMPLING_API_TABLE_MAJOR_VERSION > 0x0
|
||||
# define ROCPROFILER_SDK_HSA_PC_SAMPLING 1
|
||||
#else
|
||||
# define ROCPROFILER_SDK_HSA_PC_SAMPLING 0
|
||||
#endif
|
||||
|
||||
// redundant check based on whether the pc sampling API header was found
|
||||
#if defined __has_include
|
||||
# if __has_include(<hsa/hsa_ven_amd_pc_sampling.h>)
|
||||
# if ROCPROFILER_SDK_HSA_PC_SAMPLING == 0
|
||||
# error \
|
||||
"rocprofiler-sdk disabled the HSA PC sampling table even though the hsa_ven_amd_pc_sampling.h was found"
|
||||
# endif
|
||||
# else
|
||||
# if ROCPROFILER_SDK_HSA_PC_SAMPLING == 1
|
||||
# error \
|
||||
"rocprofiler-sdk enabled the HSA PC sampling table even though the hsa_ven_amd_pc_sampling.h was not found"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/hsa_adapter.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
@@ -378,4 +379,4 @@ flush_internal_agent_buffers(const PCSAgentSession* agent_session)
|
||||
} // namespace pc_sampling
|
||||
} // namespace rocprofiler
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/service.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
|
||||
#include "lib/rocprofiler-sdk/hsa/queue.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/cid_manager.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/parser/pc_record_interface.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/agent.h>
|
||||
@@ -24,23 +25,23 @@ class PCSCIDManager;
|
||||
|
||||
struct PCSAgentSession
|
||||
{
|
||||
const rocprofiler_agent_t* agent;
|
||||
rocprofiler_pc_sampling_method_t method;
|
||||
rocprofiler_pc_sampling_unit_t unit;
|
||||
uint64_t interval;
|
||||
rocprofiler_buffer_id_t buffer_id;
|
||||
const rocprofiler_agent_t* agent = nullptr;
|
||||
rocprofiler_pc_sampling_method_t method = ROCPROFILER_PC_SAMPLING_METHOD_NONE;
|
||||
rocprofiler_pc_sampling_unit_t unit = ROCPROFILER_PC_SAMPLING_UNIT_NONE;
|
||||
uint64_t interval = 0;
|
||||
rocprofiler_buffer_id_t buffer_id = {.handle = 0};
|
||||
// hsa relevant information
|
||||
std::optional<hsa_agent_t> hsa_agent = std::nullopt;
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
hsa_ven_amd_pcs_t hsa_pc_sampling;
|
||||
hsa_ven_amd_pcs_t hsa_pc_sampling = {};
|
||||
#endif
|
||||
hsa::ClientID intercept_cb_id{-1};
|
||||
hsa::ClientID intercept_cb_id = -1;
|
||||
// ioctl relevant information
|
||||
uint32_t ioctl_pcs_id;
|
||||
uint32_t ioctl_pcs_id = 0;
|
||||
// PC sampling parser
|
||||
std::unique_ptr<PCSamplingParserContext> parser;
|
||||
std::unique_ptr<PCSamplingParserContext> parser = {};
|
||||
// Manager responsible for retiring CIDs
|
||||
std::unique_ptr<PCSCIDManager> cid_manager;
|
||||
std::unique_ptr<PCSCIDManager> cid_manager = {};
|
||||
};
|
||||
|
||||
// TODO static assertions
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/utils.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
|
||||
#include "lib/rocprofiler-sdk/pc_sampling/defines.hpp"
|
||||
|
||||
#if ROCPROFILER_SDK_HSA_PC_SAMPLING > 0
|
||||
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user