forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added AIE Profiling on additional Windows Devices (Xilinx#7714)
1 parent
f978a3c
commit 0464b83
Showing
24 changed files
with
1,165 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. | ||
add_library(core_common_xdp_profile_objects OBJECT | ||
profile.cpp | ||
) | ||
|
||
target_include_directories(core_common_xdp_profile_objects | ||
PRIVATE | ||
${XRT_SOURCE_DIR}/runtime_src | ||
) | ||
|
||
if (XDP_MINIMAL_BUILD STREQUAL "yes") | ||
target_compile_definitions(core_common_xdp_profile_objects | ||
PRIVATE | ||
XDP_MINIMAL_BUILD=1 | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2023 Advanced Micro Devices, Inc. - All rights reserved | ||
#define XRT_CORE_COMMON_SOURCE | ||
#include "core/common/xdp/profile.h" | ||
|
||
#include "core/common/config_reader.h" | ||
#include "core/common/dlfcn.h" | ||
#include "core/common/module_loader.h" | ||
|
||
#include <functional> | ||
// This file makes the connections between all xrt_coreutil level hooks | ||
// to the corresponding xdp plugins. It is responsible for loading all of | ||
// modules. | ||
|
||
namespace xrt_core::xdp::aie::profile { | ||
|
||
|
||
std::function<void (void*)> update_device_cb; | ||
std::function<void (void*)> end_poll_cb; | ||
|
||
void | ||
register_callbacks(void* handle) | ||
{ | ||
#ifdef XDP_MINIMAL_BUILD | ||
using ftype = void (*)(void*); | ||
|
||
update_device_cb = reinterpret_cast<ftype>(xrt_core::dlsym(handle, "updateAIECtrDevice")); | ||
end_poll_cb = reinterpret_cast<ftype>(xrt_core::dlsym(handle, "endAIECtrPoll")); | ||
#else | ||
(void)handle; | ||
#endif | ||
|
||
|
||
} | ||
|
||
void | ||
warning_callbacks() | ||
{ | ||
} | ||
|
||
void | ||
load() | ||
{ | ||
static xrt_core::module_loader xdp_aie_loader("xdp_aie_profile_plugin", | ||
register_callbacks, | ||
warning_callbacks); | ||
} | ||
|
||
// Make connections | ||
void | ||
update_device(void* handle) | ||
{ | ||
if (update_device_cb) | ||
update_device_cb(handle); | ||
} | ||
|
||
void | ||
end_poll(void* handle) | ||
{ | ||
if (end_poll_cb) | ||
end_poll_cb(handle); | ||
} | ||
|
||
} // end namespace xrt_core::xdp::aie::profile | ||
|
||
namespace xrt_core::xdp { | ||
|
||
void | ||
update_device(void* handle) | ||
{ | ||
if (xrt_core::config::get_aie_profile()) { | ||
try { | ||
xrt_core::xdp::aie::profile::load(); | ||
} | ||
catch (...) { | ||
return; | ||
} | ||
xrt_core::xdp::aie::profile::update_device(handle); | ||
} | ||
} | ||
|
||
void | ||
end_poll(void* handle) | ||
{ | ||
if (xrt_core::config::get_aie_profile()) | ||
xrt_core::xdp::aie::profile::end_poll(handle); | ||
} | ||
|
||
} // end namespace xrt_core::xdp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2023 Advanced Micro Devices, Inc. - All rights reserved | ||
#ifndef CORE_COMMON_PROFILE_DOT_H | ||
#define CORE_COMMON_PROFILE_DOT_H | ||
|
||
// The functions here are the general interfaces for the XDP hooks that are | ||
// called from the common coreutil library and not the specific shims. | ||
namespace xrt_core::xdp { | ||
|
||
// update_device should be called whenever a user creates a hardware context. | ||
// This hook will allow the XDP plugins to cache a reference to the user's | ||
// hardware context so the plugin can configure and read performance counters | ||
// that are used by the user's application. | ||
void | ||
update_device(void* handle); | ||
|
||
// end_poll should be called when the application ends or a hardware context | ||
// is destroyed. It is responsible for flushing out all of the device | ||
// information from the device to host memory so it can be processed before | ||
// the device is reset and the data is wiped. | ||
void | ||
end_poll(void* handle); | ||
|
||
} // end namespace xrt_core::xdp | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,4 @@ extern "C" | |
void endAIECtrPoll(void* handle) | ||
{ | ||
xdp::endAIECtrPoll(handle); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.