-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XDP AIE PC Plugin to capture total execution cycles of specified func…
…tions (#8439)
- Loading branch information
1 parent
ab21783
commit 36c792b
Showing
12 changed files
with
892 additions
and
17 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,42 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. | ||
# | ||
|
||
# ======================================================================== | ||
# This builds the AIE PC Plugin which can configure Perf Counter registers | ||
# to count cycles between core function start and end. | ||
# It is currently built on Client Windows Only. | ||
# ========================================================================= | ||
|
||
if (XDP_CLIENT_BUILD_CMAKE STREQUAL "yes") | ||
set(IMPL_DIR "${PROFILE_DIR}/plugin/aie_pc/clientDev") | ||
endif() | ||
|
||
|
||
file(GLOB XDP_AIE_PC_PLUGIN_FILES | ||
"${PROFILE_DIR}/plugin/aie_pc/*.h" | ||
"${PROFILE_DIR}/plugin/aie_pc/*.cpp" | ||
"${IMPL_DIR}/*.h" | ||
"${IMPL_DIR}/*.cpp" | ||
) | ||
|
||
file(GLOB XDP_DEVICE_COMMON_FILES | ||
"${PROFILE_DIR}/device/common/*.h" | ||
"${PROFILE_DIR}/device/common/*.cpp" | ||
) | ||
|
||
if (XDP_CLIENT_BUILD_CMAKE STREQUAL "yes") | ||
add_library(xdp_aie_pc_plugin MODULE ${XDP_AIE_PC_PLUGIN_FILES} ${XDP_DEVICE_COMMON_FILES}) | ||
add_dependencies(xdp_aie_pc_plugin xdp_core xrt_coreutil) | ||
target_link_libraries(xdp_aie_pc_plugin PRIVATE xdp_core xrt_coreutil xaiengine) | ||
target_compile_definitions(xdp_aie_pc_plugin PRIVATE XDP_CLIENT_BUILD=1 -DXAIE_FEATURE_MSVC) | ||
target_include_directories(xdp_aie_pc_plugin PRIVATE ${AIERT_DIR}/include) | ||
set_target_properties(xdp_aie_pc_plugin PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION}) | ||
|
||
install (TARGETS xdp_aie_pc_plugin | ||
LIBRARY DESTINATION ${XDP_PLUGIN_INSTALL_DIR} | ||
) | ||
|
||
# Else, on edge-aarch64 don't build at all | ||
|
||
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,52 @@ | ||
/** | ||
* Copyright (C) 2024 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 "xdp/profile/plugin/aie_pc/aie_pc_cb.h" | ||
#include "xdp/profile/plugin/aie_pc/aie_pc_plugin.h" | ||
|
||
namespace xdp { | ||
|
||
static AIEPCPlugin aiePCPluginInstance; | ||
|
||
static void updateDeviceAIEPC(void* hwCtxImpl) | ||
{ | ||
if (AIEPCPlugin::alive()) { | ||
aiePCPluginInstance.updateDevice(hwCtxImpl); | ||
} | ||
} | ||
|
||
static void finishflushDeviceAIEPC(void* hwCtxImpl) | ||
{ | ||
if (AIEPCPlugin::alive()) { | ||
aiePCPluginInstance.finishflushDevice(hwCtxImpl); | ||
} | ||
} | ||
|
||
} // end namespace xdp | ||
|
||
extern "C" | ||
void updateDeviceAIEPC(void* hwCtxImpl) | ||
{ | ||
xdp::updateDeviceAIEPC(hwCtxImpl); | ||
} | ||
|
||
extern "C" | ||
void finishflushDeviceAIEPC(void* hwCtxImpl) | ||
{ | ||
xdp::finishflushDeviceAIEPC(hwCtxImpl); | ||
} |
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,28 @@ | ||
/** | ||
* Copyright (C) 2024 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_PC_CB_H | ||
#define XDP_PLUGIN_AIE_PC_CB_H | ||
|
||
#include "xdp/config.h" | ||
|
||
extern "C" { | ||
|
||
XDP_PLUGIN_EXPORT void updateDeviceAIEPC(void* hwCtxImpl); | ||
XDP_PLUGIN_EXPORT void finishflushDeviceAIEPC(void* hwCtxImpl); | ||
|
||
} | ||
#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,51 @@ | ||
/** | ||
* Copyright (C) 2024 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_PC_IMPL_H | ||
#define XDP_PLUGIN_AIE_PC_IMPL_H | ||
|
||
#include "core/include/xrt/xrt_hw_context.h" | ||
|
||
namespace xdp { | ||
|
||
class VPDatabase; | ||
|
||
class AIEPCImpl | ||
{ | ||
protected : | ||
VPDatabase* db = nullptr; | ||
xrt::hw_context mHwContext; | ||
|
||
public: | ||
AIEPCImpl(VPDatabase* dB) | ||
: db(dB) | ||
{} | ||
|
||
AIEPCImpl() = delete; | ||
|
||
virtual ~AIEPCImpl() {} | ||
|
||
virtual void updateDevice(void*) = 0; | ||
virtual void finishflushDevice(void*) = 0; | ||
|
||
void setHwContext(xrt::hw_context ctx) | ||
{ | ||
mHwContext = std::move(ctx); | ||
} | ||
}; | ||
|
||
} | ||
#endif |
Oops, something went wrong.