HIP Streams to Queues Translation (#235)
* rocprofiler_stream_id_t: opaque handle for a stream
- e.g. HIP stream
- the same HIP stream may map to different HSA queues at different points in the application
- added to:
- rocprofiler_buffer_tracing_hip_api_record_t
- rocprofiler_buffer_tracing_memory_copy_record_t
- rocprofiler_callback_tracing_hip_api_data_t
- rocprofiler_callback_tracing_memory_copy_data_t
---------
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Co-authored-by: Mark Meserve <mark.meserve@amd.com>
Co-authored-by: Elwazir, Ammar <Ammar.Elwazir@amd.com>
Co-authored-by: Ammar ELWazir <aelwazir@amd.com>
Co-authored-by: Jakaraddi, Manjunath <Manjunath.Jakaraddi@amd.com>
Co-authored-by: Bhardwaj, Gopesh <Gopesh.Bhardwaj@amd.com>
Co-authored-by: Nagaraj, Sriraksha <Sriraksha.Nagaraj@amd.com>
Co-authored-by: U, Srihari <Srihari.U@amd.com>
Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>
Co-authored-by: Welton, Benjamin <Benjamin.Welton@amd.com>
Co-authored-by: Benjamin Welton <ben@amd.com>
Co-authored-by: Indic, Vladimir <Vladimir.Indic@amd.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>
[ROCm/rocprofiler-sdk commit: ccd1e54293]
This commit is contained in:
committed by
GitHub
orang tua
c08db2daa1
melakukan
7aeaffd871
@@ -52,3 +52,5 @@ target_link_libraries(
|
||||
|
||||
set_target_properties(rocprofiler-sdk-common-library PROPERTIES OUTPUT_NAME
|
||||
rocprofiler-sdk-common)
|
||||
|
||||
add_subdirectory(details)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# add details sources and headers to common library target
|
||||
#
|
||||
set(details_headers mpl.hpp)
|
||||
set(details_sources)
|
||||
|
||||
target_sources(rocprofiler-sdk-common-library PRIVATE ${details_sources}
|
||||
${details_headers})
|
||||
@@ -0,0 +1,211 @@
|
||||
// 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 <cstddef>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
namespace mpl
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template <typename... Tp>
|
||||
struct type_list
|
||||
{
|
||||
static constexpr auto size() { return sizeof...(Tp); }
|
||||
};
|
||||
|
||||
template <typename InTuple, typename OutTuple>
|
||||
struct reverse;
|
||||
|
||||
template <template <typename...> class InTuple,
|
||||
typename InT,
|
||||
typename... InTail,
|
||||
template <typename...>
|
||||
class OutTuple,
|
||||
typename... OutTail>
|
||||
struct reverse<InTuple<InT, InTail...>, OutTuple<OutTail...>>
|
||||
: reverse<InTuple<InTail...>, OutTuple<InT, OutTail...>>
|
||||
{};
|
||||
|
||||
template <template <typename...> class InTuple,
|
||||
template <typename...>
|
||||
class OutTuple,
|
||||
typename... OutTail>
|
||||
struct reverse<InTuple<>, OutTuple<OutTail...>>
|
||||
{
|
||||
using type = OutTuple<OutTail...>;
|
||||
};
|
||||
|
||||
template <template <typename...> class InTuple, typename... InTail>
|
||||
struct reverse<InTuple<InTail...>, void> : reverse<InTuple<InTail...>, InTuple<>>
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct function_traits;
|
||||
|
||||
template <typename T>
|
||||
struct function_traits<T&> : function_traits<T>
|
||||
{};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct function_traits<std::function<R(Args...)>>
|
||||
{
|
||||
static constexpr bool is_memfun = false;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = args_type;
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct function_traits<R (*)(Args...)>
|
||||
{
|
||||
static constexpr bool is_memfun = false;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = args_type;
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct function_traits<R(Args...)>
|
||||
{
|
||||
static constexpr bool is_memfun = false;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = args_type;
|
||||
};
|
||||
|
||||
// member function pointer
|
||||
template <typename C, typename R, typename... Args>
|
||||
struct function_traits<R (C::*)(Args...)>
|
||||
{
|
||||
static constexpr bool is_memfun = true;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = type_list<C&, Args...>;
|
||||
};
|
||||
|
||||
// const member function pointer
|
||||
template <typename C, typename R, typename... Args>
|
||||
struct function_traits<R (C::*)(Args...) const>
|
||||
{
|
||||
static constexpr bool is_memfun = true;
|
||||
static constexpr bool is_const = true;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = type_list<C&, Args...>;
|
||||
};
|
||||
|
||||
// member object pointer
|
||||
template <typename C, typename R>
|
||||
struct function_traits<R(C::*)>
|
||||
{
|
||||
static constexpr bool is_memfun = true;
|
||||
static constexpr bool is_const = false;
|
||||
static const size_t nargs = 0;
|
||||
using result_type = R;
|
||||
using args_type = type_list<>;
|
||||
using call_type = type_list<C&>;
|
||||
};
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct function_traits<std::function<R(Args...) noexcept>>
|
||||
{
|
||||
static constexpr bool is_memfun = false;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = args_type;
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct function_traits<R (*)(Args...) noexcept>
|
||||
{
|
||||
static constexpr bool is_memfun = false;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = args_type;
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct function_traits<R(Args...) noexcept>
|
||||
{
|
||||
static constexpr bool is_memfun = false;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = args_type;
|
||||
};
|
||||
|
||||
// member function pointer
|
||||
template <typename C, typename R, typename... Args>
|
||||
struct function_traits<R (C::*)(Args...) noexcept>
|
||||
{
|
||||
static constexpr bool is_memfun = true;
|
||||
static constexpr bool is_const = false;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = type_list<C&, Args...>;
|
||||
};
|
||||
|
||||
// const member function pointer
|
||||
template <typename C, typename R, typename... Args>
|
||||
struct function_traits<R (C::*)(Args...) const noexcept>
|
||||
{
|
||||
static constexpr bool is_memfun = true;
|
||||
static constexpr bool is_const = true;
|
||||
static constexpr size_t nargs = sizeof...(Args);
|
||||
using result_type = R;
|
||||
using args_type = type_list<Args...>;
|
||||
using call_type = type_list<C&, Args...>;
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace impl
|
||||
} // namespace mpl
|
||||
} // namespace common
|
||||
} // namespace rocprofiler
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lib/common/details/mpl.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -162,6 +164,15 @@ struct assert_false
|
||||
{
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
template <typename InTuple>
|
||||
using reverse = typename impl::reverse<InTuple, void>::type;
|
||||
|
||||
template <typename Tp>
|
||||
using function_traits = impl::function_traits<Tp>;
|
||||
|
||||
template <typename Tp>
|
||||
using function_args_t = typename impl::function_traits<Tp>::args_type;
|
||||
} // namespace mpl
|
||||
} // namespace common
|
||||
} // namespace rocprofiler
|
||||
|
||||
Reference in New Issue
Block a user