Page migration reporting (#651)
* Page migration reporting support * Page migration: Update parser and reporting Container does not lave latest KFD header, so CI might fail * Add kfd_ioctl.h * Formatting * Update get_key - get key was not used (and shouldn't be), so delete it * clang-tidy fixes * Tests for page migration * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update tests/bin/page-migration/CMakeLists.txt Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update page-migration test app - add hipHostRegister to register mmap'ed allocation with HIP - misc cleanup and reorg - remove HSA_XNACK=1 from test env * Update lib/rocprofiler-sdk/tests/page_migration.cpp - fix compilation error * Minor updates (reorg, rename) * Page migration reporting support * Page migration: Update parser and reporting Container does not lave latest KFD header, so CI might fail * Update page migration tests, fix trigger types * Page Migration Tracing Support Refactoring (#753) * Reorganization * Update page migration init/fini * Formatting * Update page_migration.cpp - change logging severity * Skip test if KFD does not support page migration reporting * Rework skipping test if KFD does not support page migration * Fix event trigger enum values * Fix clang-diagnostic-unused-const-variable --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com> Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <rocprofiler-sdk/defines.h>
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
ROCPROFILER_EXTERN_C_INIT
|
||||
|
||||
/**
|
||||
@@ -35,6 +37,49 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Page migration triggers
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_PAGE_MIGRATION_TRIGGER_NONE = -1,
|
||||
ROCPROFILER_PAGE_MIGRATION_TRIGGER_PREFETCH,
|
||||
ROCPROFILER_PAGE_MIGRATION_TRIGGER_PAGEFAULT_GPU,
|
||||
ROCPROFILER_PAGE_MIGRATION_TRIGGER_PAGEFAULT_CPU,
|
||||
ROCPROFILER_PAGE_MIGRATION_TRIGGER_TTM_EVICTION,
|
||||
ROCPROFILER_PAGE_MIGRATION_TRIGGER_LAST,
|
||||
} rocprofiler_page_migration_trigger_t;
|
||||
|
||||
/**
|
||||
* @brief Page migration triggers causing the queue to suspend
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_NONE = -1,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_SVM,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_USERPTR,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_TTM,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_SUSPEND,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_CRIU_CHECKPOINT,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_CRIU_RESTORE,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_LAST,
|
||||
} rocprofiler_page_migration_queue_suspend_trigger_t;
|
||||
|
||||
/**
|
||||
* @brief Page migration triggers causing an unmap from the GPU
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_NONE = -1,
|
||||
ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_MMU_NOTIFY,
|
||||
ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_MMU_NOTIFY_MIGRATE,
|
||||
ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_UNMAP_FROM_CPU,
|
||||
ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_LAST,
|
||||
} rocprofiler_page_migration_unmap_from_gpu_trigger_t;
|
||||
|
||||
/**
|
||||
* @brief ROCProfiler Buffer HSA API Tracer Record.
|
||||
*/
|
||||
@@ -150,17 +195,63 @@ typedef struct rocprofiler_buffer_tracing_kernel_dispatch_record_t
|
||||
/// @brief runtime grid size
|
||||
} rocprofiler_buffer_tracing_kernel_dispatch_record_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t read_fault : 1; ///< Is the fault due to a read or a write
|
||||
uint8_t migrated : 1;
|
||||
uint32_t node_id; ///< GPU or CPU node ID which reports a page fault
|
||||
uint64_t address; ///< Address access that caused the page fault
|
||||
} rocprofiler_buffer_tracing_page_migration_page_fault_record_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t start_addr; ///< Start address of the page being migrated
|
||||
uint64_t end_addr; ///< End address of the page being migrated
|
||||
uint32_t from_node; ///< Source node
|
||||
uint32_t to_node; ///< Destination node
|
||||
uint32_t prefetch_node; ///< Node from which page was prefetched
|
||||
uint32_t preferred_node; ///< Preferred destinaion node
|
||||
rocprofiler_page_migration_trigger_t trigger; ///< Cause of migration
|
||||
} rocprofiler_buffer_tracing_page_migration_page_migrate_record_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rescheduled : 1;
|
||||
uint32_t node_id; ///< GPU node from which the queue was suspended
|
||||
rocprofiler_page_migration_queue_suspend_trigger_t trigger; ///< Cause of queue suspension
|
||||
} rocprofiler_buffer_tracing_page_migration_queue_suspend_record_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t node_id; ///< Node ID from which page was unmapped
|
||||
uint64_t start_addr; ///< Start address of unmapped page
|
||||
uint64_t end_addr; ///< End address of unmapped page
|
||||
rocprofiler_page_migration_unmap_from_gpu_trigger_t trigger; ///< Cause of unmap
|
||||
} rocprofiler_buffer_tracing_page_migration_unmap_from_gpu_record_t;
|
||||
|
||||
/**
|
||||
* @brief ROCProfiler Buffer Page Migration Tracer Record. Not implemented.
|
||||
* @brief ROCProfiler Buffer Page Migration Tracer Record
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t size; ///< size of this struct
|
||||
rocprofiler_buffer_tracing_kind_t kind; ///< ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION
|
||||
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
|
||||
rocprofiler_tracing_operation_t operation;
|
||||
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
|
||||
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
|
||||
// Not Sure What is the info needed here?
|
||||
uint32_t pid;
|
||||
|
||||
union
|
||||
{
|
||||
rocprofiler_buffer_tracing_page_migration_page_fault_record_t page_fault;
|
||||
rocprofiler_buffer_tracing_page_migration_page_migrate_record_t page_migrate;
|
||||
rocprofiler_buffer_tracing_page_migration_queue_suspend_record_t queue_suspend;
|
||||
rocprofiler_buffer_tracing_page_migration_unmap_from_gpu_record_t unmap_from_gpu;
|
||||
struct
|
||||
{
|
||||
uint64_t reserved[12];
|
||||
};
|
||||
};
|
||||
} rocprofiler_buffer_tracing_page_migration_record_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -89,6 +89,10 @@ typedef enum // NOLINT(performance-enum-size)
|
||||
ROCPROFILER_STATUS_ERROR_AST_GENERATION_FAILED, ///< AST could not be generated correctly
|
||||
ROCPROFILER_STATUS_ERROR_AST_NOT_FOUND, ///< AST was not found
|
||||
ROCPROFILER_STATUS_ERROR_AQL_NO_EVENT_COORD, ///< Event coordinate was not found by AQL profile
|
||||
ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_KERNEL, ///< A service depends on a newer version of KFD
|
||||
///< (amdgpu kernel driver). Check logs for
|
||||
///< service that report incompatibility
|
||||
|
||||
ROCPROFILER_STATUS_LAST,
|
||||
} rocprofiler_status_t;
|
||||
|
||||
@@ -202,6 +206,21 @@ typedef enum // NOLINT(performance-enum-size)
|
||||
ROCPROFILER_MEMORY_COPY_LAST,
|
||||
} rocprofiler_memory_copy_operation_t;
|
||||
|
||||
/**
|
||||
* @brief Page migration event.
|
||||
*/
|
||||
typedef enum // NOLINT(performance-enum-size)
|
||||
{
|
||||
ROCPROFILER_PAGE_MIGRATION_NONE = 0, ///< Unknown event
|
||||
ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE,
|
||||
ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT,
|
||||
ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND,
|
||||
ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU,
|
||||
// Any and all events, from all processes. Requires superuser
|
||||
// ROCPROFILER_PAGE_MIGRATION_ANY_ALL_PROCESSES,
|
||||
ROCPROFILER_PAGE_MIGRATION_LAST,
|
||||
} rocprofiler_page_migration_operation_t;
|
||||
|
||||
/**
|
||||
* @brief ROCProfiler Kernel Dispatch Tracing Operation Types.
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,7 @@ add_subdirectory(marker)
|
||||
add_subdirectory(thread_trace)
|
||||
add_subdirectory(tracing)
|
||||
add_subdirectory(kernel_dispatch)
|
||||
add_subdirectory(page_migration)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-object-library
|
||||
|
||||
@@ -34,12 +34,15 @@
|
||||
#include "lib/rocprofiler-sdk/hsa/scratch_memory.hpp"
|
||||
#include "lib/rocprofiler-sdk/kernel_dispatch/kernel_dispatch.hpp"
|
||||
#include "lib/rocprofiler-sdk/marker/marker.hpp"
|
||||
#include "lib/rocprofiler-sdk/page_migration/page_migration.hpp"
|
||||
#include "lib/rocprofiler-sdk/registration.hpp"
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#define RETURN_STATUS_ON_FAIL(...) \
|
||||
@@ -105,8 +108,7 @@ rocprofiler_configure_buffer_tracing_service(rocprofiler_context_id_t c
|
||||
if(rocprofiler::registration::get_init_status() > -1)
|
||||
return ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED;
|
||||
|
||||
static auto unsupported = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{
|
||||
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION};
|
||||
static auto unsupported = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{};
|
||||
if(unsupported.count(kind) > 0) return ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
auto* ctx = rocprofiler::context::get_mutable_registered_context(context_id);
|
||||
@@ -137,6 +139,9 @@ rocprofiler_configure_buffer_tracing_service(rocprofiler_context_id_t c
|
||||
ctx->buffered_tracer->domains, kind, operations[i]));
|
||||
}
|
||||
|
||||
if(kind == ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION)
|
||||
RETURN_STATUS_ON_FAIL(rocprofiler::page_migration::init());
|
||||
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -233,6 +238,10 @@ rocprofiler_query_buffer_tracing_kind_operation_name(rocprofiler_buffer_tracing_
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION:
|
||||
{
|
||||
val = rocprofiler::page_migration::name_by_id(operation);
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_BUFFER_TRACING_CORRELATION_ID_RETIREMENT:
|
||||
{
|
||||
return ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -340,6 +349,10 @@ rocprofiler_iterate_buffer_tracing_kind_operations(
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION:
|
||||
{
|
||||
ops = rocprofiler::page_migration::get_ids();
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_BUFFER_TRACING_CORRELATION_ID_RETIREMENT:
|
||||
{
|
||||
return ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#
|
||||
#
|
||||
set(ROCPROFILER_LIB_UVM_SOURCES page_migration.cpp)
|
||||
set(ROCPROFILER_LIB_UVM_HEADERS defines.hpp page_migration.hpp utils.hpp)
|
||||
|
||||
target_sources(rocprofiler-object-library PRIVATE ${ROCPROFILER_LIB_UVM_SOURCES}
|
||||
${ROCPROFILER_LIB_UVM_HEADERS})
|
||||
|
||||
add_subdirectory(details)
|
||||
@@ -0,0 +1,87 @@
|
||||
// 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
|
||||
|
||||
#define KFD_EVENT_PARSE_EVENTS(X, HANDLER) \
|
||||
do \
|
||||
{ \
|
||||
const auto find_newline = [&](auto b) { return std::find(b, X.cend(), '\n'); }; \
|
||||
\
|
||||
const auto* cursor = X.cbegin(); \
|
||||
\
|
||||
for(const auto* pos = find_newline(cursor); pos != X.cend(); pos = find_newline(cursor)) \
|
||||
{ \
|
||||
size_t char_count = pos - cursor; \
|
||||
assert(char_count > 0); \
|
||||
std::string_view event_str{cursor, char_count}; \
|
||||
\
|
||||
LOG(INFO) << fmt::format("KFD event: [{}]", event_str); \
|
||||
HANDLER(event_str); \
|
||||
\
|
||||
cursor = pos + 1; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define APPEND_UVM_EVENT(X) ROCPROFILER_UVM_EVENT_##X
|
||||
#define APPEND_1(X) APPEND_UVM_EVENT(X)
|
||||
#define CONCAT(X, Y) X##Y
|
||||
#define APPEND_2(A1, A2) APPEND_1(A1), APPEND_1(A2)
|
||||
#define APPEND_3(A1, A2, A3) APPEND_2(A1, A2), APPEND_1(A3)
|
||||
#define APPEND_4(A1, A2, A3, A4) APPEND_3(A1, A2, A3), APPEND_1(A4)
|
||||
#define APPEND_5(A1, A2, A3, A4, A5) APPEND_4(A1, A2, A3, A4), APPEND_1(A5)
|
||||
|
||||
#define MACRO_N(MACRO, N, ...) CONCAT(MACRO, N)(__VA_ARGS__)
|
||||
#define APPLY_N(MACRO, ...) MACRO_N(MACRO, IMPL_DETAIL_FOR_EACH_NARG(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#define GET_UVM_ENUMS(...) APPLY_N(APPEND_, __VA_ARGS__)
|
||||
|
||||
// static constexpr size_t uvm_event = UVM_ENUM;
|
||||
#define SPECIALIZE_UVM_KFD_EVENT(UVM_ENUM, KFD_ENUM, FORMAT_STRING) \
|
||||
template <> \
|
||||
struct uvm_event_info<UVM_ENUM> \
|
||||
{ \
|
||||
static constexpr size_t kfd_event = KFD_ENUM; \
|
||||
static constexpr std::string_view format_str{FORMAT_STRING}; \
|
||||
};
|
||||
|
||||
#define SPECIALIZE_PAGE_MIGRATION_INFO(TYPE, ...) \
|
||||
template <> \
|
||||
struct page_migration_info<ROCPROFILER_PAGE_MIGRATION_##TYPE> \
|
||||
{ \
|
||||
static constexpr auto operation_idx = ROCPROFILER_PAGE_MIGRATION_##TYPE; \
|
||||
static constexpr auto name = #TYPE; \
|
||||
static constexpr size_t uvm_bitmask = \
|
||||
bitmask(std::index_sequence<GET_UVM_ENUMS(__VA_ARGS__)>()); \
|
||||
static constexpr size_t kfd_bitmask = \
|
||||
to_kfd_bitmask(std::index_sequence<GET_UVM_ENUMS(__VA_ARGS__)>()); \
|
||||
}
|
||||
|
||||
#define COPY_FROM_START_1(MEMBER) end.MEMBER = start.MEMBER;
|
||||
#define COPY_FROM_START_2(UNION_TYPE, MEMBER) end.UNION_TYPE.MEMBER = start.UNION_TYPE.MEMBER;
|
||||
|
||||
#define SPECIALIZE_KFD_IOC_IOCTL(STRUCT, ARG_IOC) \
|
||||
template <> \
|
||||
struct IOC_event<STRUCT> \
|
||||
{ \
|
||||
static constexpr auto value = ARG_IOC; \
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
#
|
||||
set(ROCPROFILER_LIB_UVM_DETAILS_SOURCES)
|
||||
set(ROCPROFILER_LIB_UVM_DETAILS_HEADERS kfd_ioctl.h)
|
||||
|
||||
target_sources(rocprofiler-object-library PRIVATE ${ROCPROFILER_LIB_UVM_DETAILS_SOURCES}
|
||||
${ROCPROFILER_LIB_UVM_DETAILS_HEADERS})
|
||||
File diff soppresso perché troppo grande
Carica Diff
File diff soppresso perché troppo grande
Carica Diff
@@ -0,0 +1,74 @@
|
||||
// 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.
|
||||
|
||||
#include "lib/rocprofiler-sdk/page_migration/defines.hpp"
|
||||
#include "lib/rocprofiler-sdk/page_migration/page_migration.hpp"
|
||||
|
||||
#if defined(ROCPROFILER_LIB_ROCPROFILER_SDK_PAGE_MIGRATION_PAGE_MIGRATION_CPP_IMPL) && \
|
||||
ROCPROFILER_LIB_ROCPROFILER_SDK_PAGE_MIGRATION_PAGE_MIGRATION_CPP_IMPL == 1
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
namespace page_migration
|
||||
{
|
||||
// clang-format off
|
||||
// Map ROCPROF UVM enums to KFD enums
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_NONE, KFD_SMI_EVENT_NONE, "Error: Invalid UVM event from KFD" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_MIGRATE_START, KFD_SMI_EVENT_MIGRATE_START, "%x %ld -%d @%lx(%lx) %x->%x %x:%x %d\n" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_MIGRATE_END, KFD_SMI_EVENT_MIGRATE_END, "%x %ld -%d @%lx(%lx) %x->%x %d\n" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_PAGE_FAULT_START, KFD_SMI_EVENT_PAGE_FAULT_START, "%x %ld -%d @%lx(%x) %c\n" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_PAGE_FAULT_END, KFD_SMI_EVENT_PAGE_FAULT_END, "%x %ld -%d @%lx(%x) %c\n" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_QUEUE_EVICTION, KFD_SMI_EVENT_QUEUE_EVICTION, "%x %ld -%d %x %d\n" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_QUEUE_RESTORE, KFD_SMI_EVENT_QUEUE_RESTORE, "%x %ld -%d %x\n" );
|
||||
SPECIALIZE_UVM_KFD_EVENT(ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU, KFD_SMI_EVENT_UNMAP_FROM_GPU, "%x %ld -%d @%lx(%lx) %x %d\n" );
|
||||
// clang-format on
|
||||
# undef SPECIALIZE_UVM_KFD_EVENT
|
||||
|
||||
SPECIALIZE_PAGE_MIGRATION_INFO(NONE, NONE);
|
||||
SPECIALIZE_PAGE_MIGRATION_INFO(PAGE_MIGRATE, MIGRATE_START, MIGRATE_END);
|
||||
SPECIALIZE_PAGE_MIGRATION_INFO(PAGE_FAULT, PAGE_FAULT_START, PAGE_FAULT_END);
|
||||
SPECIALIZE_PAGE_MIGRATION_INFO(QUEUE_SUSPEND, QUEUE_EVICTION, QUEUE_RESTORE);
|
||||
SPECIALIZE_PAGE_MIGRATION_INFO(UNMAP_FROM_GPU, UNMAP_FROM_GPU);
|
||||
|
||||
template <size_t UvmOpInx, size_t... OpInxs>
|
||||
constexpr size_t to_rocprof_op_impl(std::index_sequence<OpInxs...>)
|
||||
{
|
||||
return ((((bitmask(UvmOpInx) & page_migration_info<OpInxs>::uvm_bitmask) != 0) * OpInxs) + ...);
|
||||
}
|
||||
|
||||
template <size_t... OpInxs>
|
||||
constexpr auto _to_rocprof_op_impl(std::index_sequence<OpInxs...>)
|
||||
{
|
||||
return std::array{
|
||||
to_rocprof_op_impl<OpInxs>(std::make_index_sequence<ROCPROFILER_PAGE_MIGRATION_LAST>{})...};
|
||||
}
|
||||
|
||||
constexpr auto
|
||||
to_rocprof_op(size_t pos)
|
||||
{
|
||||
using rop = rocprofiler_page_migration_operation_t;
|
||||
return static_cast<rop>(
|
||||
_to_rocprof_op_impl(std::make_index_sequence<ROCPROFILER_UVM_EVENT_LAST>{})[pos]);
|
||||
}
|
||||
} // namespace page_migration
|
||||
} // namespace rocprofiler
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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 "lib/common/container/small_vector.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
namespace page_migration
|
||||
{
|
||||
const char*
|
||||
name_by_id(uint32_t id);
|
||||
|
||||
std::vector<uint32_t>
|
||||
get_ids();
|
||||
|
||||
rocprofiler_status_t
|
||||
init();
|
||||
|
||||
void
|
||||
finalize();
|
||||
} // namespace page_migration
|
||||
} // namespace rocprofiler
|
||||
@@ -0,0 +1,218 @@
|
||||
// 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 "lib/rocprofiler-sdk/page_migration/details/kfd_ioctl.h"
|
||||
|
||||
#include <rocprofiler-sdk/buffer_tracing.h>
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
namespace page_migration
|
||||
{
|
||||
// serves as an overview of what events we capture and report
|
||||
enum fault_type_t
|
||||
{
|
||||
NONE,
|
||||
READ,
|
||||
WRITE,
|
||||
};
|
||||
|
||||
struct uvm_event_page_fault_start_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t start_timestamp;
|
||||
int pid;
|
||||
int node_id;
|
||||
uint64_t address;
|
||||
fault_type_t fault;
|
||||
};
|
||||
|
||||
struct uvm_event_page_fault_end_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t end_timestamp;
|
||||
uint32_t pid;
|
||||
int node_id;
|
||||
uint64_t address;
|
||||
bool migrated;
|
||||
};
|
||||
|
||||
struct uvm_event_migrate_start_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t start_timestamp;
|
||||
uint32_t pid;
|
||||
uint64_t start;
|
||||
uint64_t end_offset;
|
||||
uint32_t from;
|
||||
uint32_t to;
|
||||
uint32_t prefetch_node; // last prefetch location, 0 for CPU, or GPU id
|
||||
uint32_t preferred_node; // perferred location, 0 for CPU, or GPU id
|
||||
uint32_t trigger;
|
||||
};
|
||||
|
||||
struct uvm_event_migrate_end_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t end_timestamp;
|
||||
uint32_t pid;
|
||||
uint64_t start;
|
||||
uint64_t end_offset;
|
||||
uint32_t from;
|
||||
uint32_t to;
|
||||
uint32_t trigger;
|
||||
};
|
||||
|
||||
struct uvm_event_queue_eviction_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t start_timestamp;
|
||||
uint32_t pid;
|
||||
int node_id;
|
||||
uint32_t trigger;
|
||||
};
|
||||
|
||||
struct uvm_event_queue_restore_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t end_timestamp;
|
||||
uint32_t pid;
|
||||
int node_id;
|
||||
bool rescheduled;
|
||||
};
|
||||
|
||||
struct uvm_event_unmap_from_gpu_t
|
||||
{
|
||||
int kind;
|
||||
uint64_t timestamp;
|
||||
uint32_t pid;
|
||||
uint64_t address;
|
||||
uint64_t size;
|
||||
int node_id;
|
||||
uint32_t trigger;
|
||||
};
|
||||
|
||||
template <size_t e>
|
||||
struct uvm_event_info;
|
||||
|
||||
template <size_t>
|
||||
struct page_migration_info;
|
||||
|
||||
namespace kfd
|
||||
{
|
||||
template <typename T>
|
||||
struct IOC_event;
|
||||
} // namespace kfd
|
||||
|
||||
constexpr size_t
|
||||
bitmask(size_t num)
|
||||
{
|
||||
if(num == 0)
|
||||
return 0;
|
||||
else
|
||||
return (1ULL << (num - 1));
|
||||
}
|
||||
|
||||
template <size_t... Args>
|
||||
constexpr size_t bitmask(std::index_sequence<Args...>)
|
||||
{
|
||||
return (bitmask(Args) | ...);
|
||||
}
|
||||
|
||||
enum uvm_event_id_t
|
||||
{
|
||||
ROCPROFILER_UVM_EVENT_NONE,
|
||||
ROCPROFILER_UVM_EVENT_MIGRATE_START,
|
||||
ROCPROFILER_UVM_EVENT_MIGRATE_END,
|
||||
ROCPROFILER_UVM_EVENT_PAGE_FAULT_START,
|
||||
ROCPROFILER_UVM_EVENT_PAGE_FAULT_END,
|
||||
ROCPROFILER_UVM_EVENT_QUEUE_EVICTION,
|
||||
ROCPROFILER_UVM_EVENT_QUEUE_RESTORE,
|
||||
ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU,
|
||||
ROCPROFILER_UVM_EVENT_LAST,
|
||||
};
|
||||
|
||||
static_assert(KFD_SMI_EVENT_NONE == 0);
|
||||
static_assert(KFD_SMI_EVENT_MIGRATE_START == 5);
|
||||
static_assert(KFD_SMI_EVENT_MIGRATE_END == 6);
|
||||
static_assert(KFD_SMI_EVENT_PAGE_FAULT_START == 7);
|
||||
static_assert(KFD_SMI_EVENT_PAGE_FAULT_END == 8);
|
||||
static_assert(KFD_SMI_EVENT_QUEUE_EVICTION == 9);
|
||||
static_assert(KFD_SMI_EVENT_QUEUE_RESTORE == 10);
|
||||
static_assert(KFD_SMI_EVENT_UNMAP_FROM_GPU == 11);
|
||||
static_assert(KFD_SMI_EVENT_ALL_PROCESS == 64);
|
||||
|
||||
using rocprof_buffer_op_t = rocprofiler_page_migration_operation_t;
|
||||
|
||||
using node_fd_t = int;
|
||||
|
||||
using event_map_t =
|
||||
std::unordered_map<uint64_t, rocprofiler_buffer_tracing_page_migration_record_t>;
|
||||
using events_cache_t = std::array<event_map_t, ROCPROFILER_PAGE_MIGRATION_LAST>;
|
||||
|
||||
template <size_t... Ints>
|
||||
constexpr size_t to_kfd_bitmask(std::index_sequence<Ints...>)
|
||||
{
|
||||
return bitmask(std::index_sequence<uvm_event_info<Ints>::kfd_event...>());
|
||||
}
|
||||
|
||||
template <rocprofiler_page_migration_operation_t... Ops>
|
||||
constexpr size_t to_uvm_bitmask(std::index_sequence<Ops...>)
|
||||
{
|
||||
return bitmask(std::index_sequence<static_cast<uint32_t>(Ops)...>());
|
||||
}
|
||||
|
||||
template <size_t RocprofOpIdx, size_t UvmOpIdx>
|
||||
constexpr bool
|
||||
is_rocprof_uvm_map()
|
||||
{
|
||||
return page_migration_info<RocprofOpIdx>::uvm_bitmask & bitmask(UvmOpIdx);
|
||||
}
|
||||
|
||||
template <size_t RocprofOpIdx, size_t OpInx, size_t... OpInxs>
|
||||
constexpr bool
|
||||
_is_rocprof_uvm_map(size_t uvm_event, std::index_sequence<OpInx, OpInxs...>)
|
||||
{
|
||||
if(OpInx == uvm_event)
|
||||
return is_rocprof_uvm_map<RocprofOpIdx, OpInx>();
|
||||
else if constexpr(sizeof...(OpInxs) > 0)
|
||||
return _is_rocprof_uvm_map<RocprofOpIdx>(uvm_event, std::index_sequence<OpInxs...>{});
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
template <size_t RocprofOpIdx>
|
||||
constexpr bool
|
||||
is_rocprof_uvm_map(size_t uvm_event)
|
||||
{
|
||||
return _is_rocprof_uvm_map<RocprofOpIdx>(
|
||||
uvm_event, std::make_index_sequence<ROCPROFILER_UVM_EVENT_LAST>{});
|
||||
}
|
||||
} // namespace page_migration
|
||||
} // namespace rocprofiler
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "lib/rocprofiler-sdk/intercept_table.hpp"
|
||||
#include "lib/rocprofiler-sdk/internal_threading.hpp"
|
||||
#include "lib/rocprofiler-sdk/marker/marker.hpp"
|
||||
#include "lib/rocprofiler-sdk/page_migration/page_migration.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/context.h>
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
@@ -600,6 +601,7 @@ finalize()
|
||||
set_fini_status(-1);
|
||||
hsa::async_copy_fini();
|
||||
hsa::queue_controller_fini();
|
||||
page_migration::finalize();
|
||||
hsa::code_object_shutdown();
|
||||
if(get_init_status() > 0)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,8 @@ ROCPROFILER_STATUS_STRING(ROCPROFILER_STATUS_ERROR_AST_NOT_FOUND, "AST was not f
|
||||
ROCPROFILER_STATUS_STRING(
|
||||
ROCPROFILER_STATUS_ERROR_AQL_NO_EVENT_COORD,
|
||||
"AQL Profiler was not able to find event coordinates for defined counters")
|
||||
ROCPROFILER_STATUS_STRING(ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_KERNEL,
|
||||
"A service depends on a newer version of KFD (amdgpu kernel driver)")
|
||||
template <size_t Idx, size_t... Tail>
|
||||
const char*
|
||||
get_status_name(rocprofiler_status_t status, std::index_sequence<Idx, Tail...>)
|
||||
|
||||
@@ -36,8 +36,9 @@ set_tests_properties(${lib_TESTS} PROPERTIES TIMEOUT 30 LABELS "unittests")
|
||||
#
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
|
||||
set(rocprofiler_shared_lib_sources external_correlation.cpp intercept_table.cpp
|
||||
registration.cpp roctx.cpp status.cpp)
|
||||
set(rocprofiler_shared_lib_sources
|
||||
external_correlation.cpp intercept_table.cpp page_migration.cpp registration.cpp
|
||||
roctx.cpp status.cpp)
|
||||
|
||||
add_executable(rocprofiler-lib-tests-shared)
|
||||
target_sources(rocprofiler-lib-tests-shared PRIVATE ${rocprofiler_shared_lib_sources})
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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.
|
||||
|
||||
#include "lib/common/defines.hpp"
|
||||
#include "lib/rocprofiler-sdk/page_migration/details/kfd_ioctl.h"
|
||||
#include "lib/rocprofiler-sdk/page_migration/utils.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
|
||||
#define ROCPROFILER_LIB_ROCPROFILER_SDK_PAGE_MIGRATION_PAGE_MIGRATION_CPP_IMPL 1
|
||||
#include "lib/rocprofiler-sdk/page_migration/page_migration.def.cpp"
|
||||
#undef ROCPROFILER_LIB_ROCPROFILER_SDK_PAGE_MIGRATION_PAGE_MIGRATION_CPP_IMPL
|
||||
|
||||
#define ASSERT_SAME(A, B) static_assert(static_cast<size_t>(A) == static_cast<size_t>(B))
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::string_view MULTILINE_STRING = "This is 0 Line 0\n"
|
||||
"This is 10 Line 1\n"
|
||||
"This is 20 Line 2\n"
|
||||
"This is 30 Line 3\n"
|
||||
"This is 40 Line 4\n";
|
||||
}
|
||||
|
||||
void
|
||||
return_line(const std::string_view line)
|
||||
{
|
||||
static int line_no = 0;
|
||||
std::stringstream strs{};
|
||||
strs << fmt::format("This is {} Line {}", line_no * 10, line_no);
|
||||
EXPECT_EQ(strs.str(), line);
|
||||
line_no++;
|
||||
}
|
||||
|
||||
auto
|
||||
parse_lines()
|
||||
{
|
||||
KFD_EVENT_PARSE_EVENTS(MULTILINE_STRING, return_line);
|
||||
}
|
||||
|
||||
TEST(page_migration, readlines)
|
||||
{
|
||||
// Ensure all lines are read
|
||||
parse_lines();
|
||||
}
|
||||
|
||||
TEST(page_migration, parse_kvm_events)
|
||||
{
|
||||
// Ensure all lines are read
|
||||
parse_lines();
|
||||
}
|
||||
|
||||
TEST(page_migtation, rocprof_kfd_map)
|
||||
{
|
||||
using namespace ::rocprofiler::page_migration;
|
||||
|
||||
// clang-format off
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_PAGE_FAULT_START >() );
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_PAGE_FAULT_END >() );
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_MIGRATE_START >() );
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_MIGRATE_END >() );
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_QUEUE_EVICTION >() );
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_QUEUE_RESTORE >() );
|
||||
static_assert( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU >() );
|
||||
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_START) );
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_END ) );
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_MIGRATE_START ) );
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_MIGRATE_END ) );
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_QUEUE_EVICTION ) );
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_QUEUE_RESTORE ) );
|
||||
EXPECT_TRUE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU ) );
|
||||
|
||||
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_QUEUE_EVICTION >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_QUEUE_RESTORE >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_PAGE_FAULT_START >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE, ROCPROFILER_UVM_EVENT_PAGE_FAULT_END >() );
|
||||
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_MIGRATE_START >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_MIGRATE_END >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_QUEUE_EVICTION >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_QUEUE_RESTORE >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT, ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU >() );
|
||||
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_MIGRATE_START >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_MIGRATE_END >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_PAGE_FAULT_START >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_PAGE_FAULT_END >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND, ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU >() );
|
||||
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_MIGRATE_START >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_MIGRATE_END >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_PAGE_FAULT_START >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_PAGE_FAULT_END >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_QUEUE_EVICTION >() );
|
||||
static_assert( ! is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU, ROCPROFILER_UVM_EVENT_QUEUE_RESTORE >() );
|
||||
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_QUEUE_EVICTION ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_QUEUE_RESTORE ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_START) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_END ) );
|
||||
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_MIGRATE_START ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_MIGRATE_END ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_QUEUE_EVICTION ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_QUEUE_RESTORE ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT >(ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU ) );
|
||||
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_MIGRATE_START ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_MIGRATE_END ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_START) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_END ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND >(ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU ) );
|
||||
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_MIGRATE_START ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_MIGRATE_END ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_START) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_PAGE_FAULT_END ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_QUEUE_EVICTION ) );
|
||||
EXPECT_FALSE( is_rocprof_uvm_map < ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU >(ROCPROFILER_UVM_EVENT_QUEUE_RESTORE ) );
|
||||
|
||||
static_assert(to_rocprof_op(ROCPROFILER_UVM_EVENT_MIGRATE_START) == ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE );
|
||||
static_assert(to_rocprof_op(ROCPROFILER_UVM_EVENT_PAGE_FAULT_END) == ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT );
|
||||
static_assert(to_rocprof_op(ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU) == ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU );
|
||||
static_assert(to_rocprof_op(ROCPROFILER_UVM_EVENT_QUEUE_EVICTION) == ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND );
|
||||
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_TRIGGER_PREFETCH, KFD_MIGRATE_TRIGGER_PREFETCH );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_TRIGGER_PAGEFAULT_GPU, KFD_MIGRATE_TRIGGER_PAGEFAULT_GPU );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_TRIGGER_PAGEFAULT_CPU, KFD_MIGRATE_TRIGGER_PAGEFAULT_CPU );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_TRIGGER_TTM_EVICTION, KFD_MIGRATE_TRIGGER_TTM_EVICTION );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_SVM, KFD_QUEUE_EVICTION_TRIGGER_SVM );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_USERPTR, KFD_QUEUE_EVICTION_TRIGGER_USERPTR );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_TTM, KFD_QUEUE_EVICTION_TRIGGER_TTM );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_SUSPEND, KFD_QUEUE_EVICTION_TRIGGER_SUSPEND );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_CRIU_CHECKPOINT, KFD_QUEUE_EVICTION_CRIU_CHECKPOINT );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND_TRIGGER_CRIU_RESTORE, KFD_QUEUE_EVICTION_CRIU_RESTORE );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_MMU_NOTIFY, KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFY );
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_MMU_NOTIFY_MIGRATE, KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFY_MIGRATE);
|
||||
ASSERT_SAME(ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_UNMAP_FROM_CPU, KFD_SVM_UNMAP_TRIGGER_UNMAP_FROM_CPU );
|
||||
|
||||
static_assert(to_kfd_bitmask(std::index_sequence<
|
||||
ROCPROFILER_UVM_EVENT_PAGE_FAULT_START, ROCPROFILER_UVM_EVENT_UNMAP_FROM_GPU>()) ==
|
||||
(KFD_SMI_EVENT_MASK_FROM_INDEX(KFD_SMI_EVENT_PAGE_FAULT_START)
|
||||
| KFD_SMI_EVENT_MASK_FROM_INDEX(KFD_SMI_EVENT_UNMAP_FROM_GPU)));
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
Regular → Executable
+2
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user