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.
AIE Profiling Plugin Refactor (Xilinx#7197)
- Loading branch information
1 parent
35202df
commit e3c362d
Showing
13 changed files
with
1,964 additions
and
30 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
29 changes: 0 additions & 29 deletions
29
src/runtime_src/xdp/profile/plugin/aie_profile/CMakeLists.txt
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/runtime_src/xdp/profile/plugin/aie_profile_new/CMakeLists.txt
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 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. | ||
# | ||
|
||
# ==================================================================== | ||
# This builds the AIE Profile plugin. It is currently built | ||
# on both Edge and x86 platforms that support AIE. | ||
# ==================================================================== | ||
|
||
if (${XRT_NATIVE_BUILD} STREQUAL "yes") | ||
set(IMPL_DIR "${PROFILE_DIR}/plugin/aie_profile_new/x86") | ||
elseif (DEFINED XRT_AIE_BUILD AND ${XRT_NATIVE_BUILD} STREQUAL "no") | ||
set(IMPL_DIR "${PROFILE_DIR}/plugin/aie_profile_new/edge") | ||
endif() | ||
|
||
file(GLOB AIE_PROFILE_PLUGIN_FILES | ||
"${PROFILE_DIR}/plugin/aie_profile_new/*.h" | ||
"${PROFILE_DIR}/plugin/aie_profile_new/*.cpp" | ||
"${PROFILE_DIR}/writer/aie_profile/*.h" | ||
"${PROFILE_DIR}/writer/aie_profile/*.cpp" | ||
"${IMPL_DIR}/*.h" | ||
"${IMPL_DIR}/*.cpp" | ||
) | ||
|
||
if (${XRT_NATIVE_BUILD} STREQUAL "yes") | ||
|
||
add_library(xdp_aie_profile_plugin MODULE ${AIE_PROFILE_PLUGIN_FILES}) | ||
add_dependencies(xdp_aie_profile_plugin xdp_core xrt_core) | ||
target_link_libraries(xdp_aie_profile_plugin PRIVATE xdp_core xrt_core) | ||
target_compile_definitions(xdp_aie_profile_plugin PRIVATE XRT_X86_BUILD=1) | ||
|
||
set_target_properties(xdp_aie_profile_plugin PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION}) | ||
|
||
install (TARGETS xdp_aie_profile_plugin | ||
LIBRARY DESTINATION ${XDP_PLUGIN_INSTALL_DIR} | ||
) | ||
|
||
elseif (DEFINED XRT_AIE_BUILD AND ${XRT_NATIVE_BUILD} STREQUAL "no") | ||
add_library(xdp_aie_profile_plugin MODULE ${AIE_PROFILE_PLUGIN_FILES}) | ||
|
||
add_dependencies(xdp_aie_profile_plugin xdp_core xrt_core) | ||
target_link_libraries(xdp_aie_profile_plugin PRIVATE xdp_core xrt_core metal xaiengine) | ||
set_target_properties(xdp_aie_profile_plugin PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION}) | ||
|
||
install (TARGETS xdp_aie_profile_plugin | ||
LIBRARY DESTINATION ${XDP_PLUGIN_INSTALL_DIR} | ||
) | ||
|
||
# Else, on edge-aarch64 don't build at all | ||
|
||
endif() |
47 changes: 47 additions & 0 deletions
47
src/runtime_src/xdp/profile/plugin/aie_profile_new/aie_cb.cpp
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,47 @@ | ||
/** | ||
* Copyright (C) 2022 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. | ||
*/ | ||
|
||
#include "aie_profile_plugin.h" | ||
|
||
namespace xdp { | ||
|
||
static AieProfilePlugin aieProfilePluginInstance; | ||
|
||
static void updateAIECtrDevice(void* handle) | ||
{ | ||
if (AieProfilePlugin::alive()) | ||
aieProfilePluginInstance.updateAIEDevice(handle); | ||
} | ||
|
||
static void endAIECtrPoll(void* handle) | ||
{ | ||
if (AieProfilePlugin::alive()) | ||
aieProfilePluginInstance.endPollforDevice(handle); | ||
} | ||
|
||
} // end namespace xdp | ||
|
||
extern "C" | ||
void updateAIECtrDevice(void* handle) | ||
{ | ||
xdp::updateAIECtrDevice(handle); | ||
} | ||
|
||
extern "C" | ||
void endAIECtrPoll(void* handle) | ||
{ | ||
xdp::endAIECtrPoll(handle); | ||
} |
50 changes: 50 additions & 0 deletions
50
src/runtime_src/xdp/profile/plugin/aie_profile_new/aie_profile_impl.h
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,50 @@ | ||
/** | ||
* Copyright (C) 2022 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 AIE_PROFILE_IMPL_H | ||
#define AIE_PROFILE_IMPL_H | ||
|
||
#include "xdp/profile/plugin/vp_base/vp_base_plugin.h" | ||
#include "aie_profile_metadata.h" | ||
|
||
namespace xdp { | ||
|
||
// AIE profile configurations can be done in different ways depending | ||
// on the platform. For example, platforms like the VCK5000 or | ||
// discovery platform, where the host code runs on the x86 and the AIE | ||
// is not directly accessible, will require configuration be done via | ||
// PS kernel. | ||
class AieProfileImpl | ||
{ | ||
|
||
protected: | ||
VPDatabase* db = nullptr; | ||
std::shared_ptr<AieProfileMetadata> metadata; | ||
|
||
public: | ||
AieProfileImpl(VPDatabase* database, std::shared_ptr<AieProfileMetadata> metadata) | ||
:db(database), metadata(metadata) {} | ||
|
||
AieProfileImpl() = delete; | ||
virtual ~AieProfileImpl() {}; | ||
|
||
virtual void updateDevice() = 0; | ||
virtual void poll(uint32_t index, void* handle) = 0; | ||
}; | ||
|
||
} // namespace xdp | ||
|
||
#endif |
46 changes: 46 additions & 0 deletions
46
src/runtime_src/xdp/profile/plugin/aie_profile_new/aie_profile_metadata.cpp
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,46 @@ | ||
/** | ||
* Copyright (C) 2022 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. | ||
*/ | ||
|
||
#include <boost/algorithm/string.hpp> | ||
|
||
#include "core/common/config_reader.h" | ||
#include "core/common/message.h" | ||
#include "aie_profile_metadata.h" | ||
|
||
namespace xdp { | ||
using severity_level = xrt_core::message::severity_level; | ||
|
||
AieProfileMetadata::AieProfileMetadata(uint64_t deviceID, void* handle) | ||
: deviceID(deviceID) | ||
, handle(handle) | ||
{} | ||
|
||
void AieProfileMetadata::parsePollingInterval() | ||
{ | ||
// Get polling interval (in usec; minimum is 100) | ||
mPollingInterval = xrt_core::config::get_aie_profile_settings_interval_us(); | ||
if (1000 == mPollingInterval) { | ||
// If set to default value, then check for old style config | ||
mPollingInterval = xrt_core::config::get_aie_profile_interval_us(); | ||
if (1000 != mPollingInterval) { | ||
xrt_core::message::send(severity_level::warning, "XRT", | ||
"The xrt.ini flag \"aie_profile_interval_us\" is deprecated and will be removed in future release. Please use \"interval_us\" under \"AIE_profile_settings\" section."); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/runtime_src/xdp/profile/plugin/aie_profile_new/aie_profile_metadata.h
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,40 @@ | ||
/** | ||
* Copyright (C) 2022 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 AIE_PROFILE_METADATA_H | ||
#define AIE_PROFILE_METADATA_H | ||
|
||
namespace xdp { | ||
|
||
class AieProfileMetadata{ | ||
|
||
public: | ||
AieProfileMetadata(uint64_t deviceID, void* handle); | ||
void parsePollingInterval(); | ||
|
||
uint64_t getDeviceID() {return deviceID;} | ||
void* getHandle() {return handle;} | ||
uint32_t getPollingIntervalVal(){return mPollingInterval;} | ||
|
||
private: | ||
uint32_t mIndex = 0; | ||
uint32_t mPollingInterval; | ||
uint64_t deviceID; | ||
void* handle; | ||
}; | ||
} | ||
|
||
#endif |
Oops, something went wrong.