Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion profile/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

if (XDP_VE2_BUILD_CMAKE STREQUAL "yes")
add_subdirectory(aie_status)
add_subdirectory(aie_profile)
add_subdirectory(aie_profile)
add_subdirectory(aie_dtrace)
add_subdirectory(aie_trace)
add_subdirectory(ml_timeline)
add_subdirectory(aie_halt)
Expand Down
77 changes: 77 additions & 0 deletions profile/plugin/aie_dtrace/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Link this plugin with the same AIE profile *object sources* as
# xdp_aie_profile_plugin_xdna (see plugin/aie_profile/CMakeLists.txt, XDP_VE2_BUILD),
# except:
# - no aie_profile_plugin*, aie_profile_cb*, writer/aie_profile/*
# - no ve2/aie_profile* (replaced by aie_dtrace/ve2/*)
#
# If load fails with "undefined symbol" from AieProfileMetadata / parser / elf,
# add the missing .cpp here or in AIE_DTRACE_PROFILE_CORE_SOURCES below.
# ELF serialization for aiebu CT: ve2/elf_helper.cpp (same role as aie_profile/ve2/elf_helper.cpp).
#

if (XDP_VE2_BUILD_CMAKE STREQUAL "yes")
set(XDP_PROFILE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..")

file(GLOB AIE_DTRACE_PLUGIN_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)
file(GLOB AIE_DTRACE_UTIL_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/util/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/util/*.cpp"
)
file(GLOB AIE_DTRACE_IMPL_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/ve2/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/ve2/*.cpp"
)

# Explicit .cpp from aie_profile tree required by metadata + CT/ELF (not covered by util/config globs).
set(AIE_DTRACE_PROFILE_CORE_SOURCES
"${XDP_PROFILE_ROOT}/plugin/aie_profile/aie_profile_metadata.cpp"
"${XDP_PROFILE_ROOT}/plugin/aie_profile/aie_profile_metadata_json.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ve2/elf_helper.cpp"
)

file(GLOB AIE_PROFILE_UTIL_FILES
"${XDP_PROFILE_ROOT}/plugin/aie_base/*"
"${XDP_PROFILE_ROOT}/plugin/aie_base/generations/*"
"${XDP_PROFILE_ROOT}/plugin/aie_profile/util/aie_profile_util.h"
"${XDP_PROFILE_ROOT}/plugin/aie_profile/util/aie_profile_util.cpp"
)
file(GLOB AIE_PROFILE_CONFIG_FILES
"${XDP_PROFILE_ROOT}/plugin/aie_profile/util/aie_profile_config.h"
"${XDP_PROFILE_ROOT}/plugin/aie_profile/util/aie_profile_config.cpp"
)
file(GLOB AIE_JSON_PARSER_FILES
"${XDP_PROFILE_ROOT}/database/parser/*.h"
"${XDP_PROFILE_ROOT}/database/parser/*.cpp"
)

add_library(xdp_aie_dtrace_plugin_xdna SHARED
${AIE_DTRACE_PLUGIN_FILES}
${AIE_DTRACE_IMPL_FILES}
${AIE_DTRACE_UTIL_FILES}
${AIE_DTRACE_PROFILE_CORE_SOURCES}
${AIE_PROFILE_UTIL_FILES}
${AIE_PROFILE_CONFIG_FILES}
${AIE_JSON_PARSER_FILES}
)
add_dependencies(xdp_aie_dtrace_plugin_xdna xdp_core xrt_coreutil)
target_link_libraries(xdp_aie_dtrace_plugin_xdna PRIVATE xdp_core xrt_coreutil xaiengine aiebu_static)
target_compile_definitions(xdp_aie_dtrace_plugin_xdna PRIVATE XDP_VE2_BUILD=1 FAL_LINUX="on")
target_include_directories(xdp_aie_dtrace_plugin_xdna PRIVATE
${CMAKE_SOURCE_DIR}/src
${XRT_SOURCE_DIR}/runtime_src/core/common/aiebu/src/cpp/include
${XRT_SOURCE_DIR}/runtime_src/core/common/elf
)
set_target_properties(xdp_aie_dtrace_plugin_xdna PROPERTIES VERSION ${XRT_VERSION_STRING}
SOVERSION ${XRT_SOVERSION})

install(TARGETS xdp_aie_dtrace_plugin_xdna
RUNTIME DESTINATION ${XDP_PLUGIN_INSTALL_DIR} COMPONENT ${XRT_COMPONENT}
LIBRARY DESTINATION ${XDP_PLUGIN_INSTALL_DIR} COMPONENT ${XRT_COMPONENT} ${XRT_NAMELINK_SKIP}
)
endif()
93 changes: 93 additions & 0 deletions profile/plugin/aie_dtrace/aie_dtrace_cb.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/**
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc. - All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. A copy of the
* License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
#define XDP_PLUGIN_SOURCE

#include "aie_dtrace_cb.h"
#include "aie_dtrace_plugin.h"

namespace xdp {

static AieDtracePlugin aieDtracePluginInstance;

static void updateAIEDtraceDevice(void* handle, bool hw_context_flow)
{
if (AieDtracePlugin::alive())
aieDtracePluginInstance.updateAIEDtraceDevice(handle, hw_context_flow);
}

static void endAIEDtracePoll(void* handle)
{
if (AieDtracePlugin::alive())
aieDtracePluginInstance.endPollforDevice(handle);
}

static void aieDtraceRunConstructor(void* run, void* hwctx, uint32_t run_uid,
const char* kernel_name, void* elf_handle)
{
if (AieDtracePlugin::alive())
aieDtracePluginInstance.runConstructorHook(run, hwctx, run_uid,
kernel_name ? kernel_name : "",
elf_handle);
}

static void aieDtraceRunStart(void* run, void* hwctx, uint32_t run_uid, const char* kernel_name)
{
if (AieDtracePlugin::alive())
aieDtracePluginInstance.runStartHook(run, hwctx, run_uid,
kernel_name ? kernel_name : "");
}

static void aieDtraceRunWait(void* run, void* hwctx, uint32_t run_uid, const char* kernel_name,
int ert_cmd_state)
{
if (AieDtracePlugin::alive())
aieDtracePluginInstance.runWaitHook(run, hwctx, run_uid,
kernel_name ? kernel_name : "", ert_cmd_state);
}

} // end namespace xdp

extern "C"
void updateAIEDtraceDevice(void* handle, bool hw_context_flow)
{
xdp::updateAIEDtraceDevice(handle, hw_context_flow);
}

extern "C"
void endAIEDtracePoll(void* handle)
{
xdp::endAIEDtracePoll(handle);
}

extern "C"
void aieDtraceRunConstructor(void* run, void* hwctx, uint32_t run_uid,
const char* kernel_name, void* elf_handle)
{
xdp::aieDtraceRunConstructor(run, hwctx, run_uid, kernel_name, elf_handle);
}

extern "C"
void aieDtraceRunStart(void* run, void* hwctx, uint32_t run_uid, const char* kernel_name)
{
xdp::aieDtraceRunStart(run, hwctx, run_uid, kernel_name);
}

extern "C"
void aieDtraceRunWait(void* run, void* hwctx, uint32_t run_uid, const char* kernel_name,
int ert_cmd_state)
{
xdp::aieDtraceRunWait(run, hwctx, run_uid, kernel_name, ert_cmd_state);
}
45 changes: 45 additions & 0 deletions profile/plugin/aie_dtrace/aie_dtrace_cb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (C) 2023-2025 Advanced Micro Devices, Inc. - All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. A copy of the
* License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

#ifndef XDP_PLUGIN_AIE_DTRACE_CB_H
#define XDP_PLUGIN_AIE_DTRACE_CB_H

#include <cstdint>
#include "xdp/config.h"

extern "C"
XDP_PLUGIN_EXPORT
void updateAIEDtraceDevice(void* handle, bool hw_context_flow);

extern "C"
XDP_PLUGIN_EXPORT
void endAIEDtracePoll(void* handle);

extern "C"
XDP_PLUGIN_EXPORT
void aieDtraceRunConstructor(void* run, void* hwctx, uint32_t run_uid,
const char* kernel_name, void* elf_handle);

extern "C"
XDP_PLUGIN_EXPORT
void aieDtraceRunStart(void* run, void* hwctx, uint32_t run_uid, const char* kernel_name);

extern "C"
XDP_PLUGIN_EXPORT
void aieDtraceRunWait(void* run, void* hwctx, uint32_t run_uid, const char* kernel_name,
int ert_cmd_state);

#endif
Loading
Loading