Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Mysore <[email protected]>
  • Loading branch information
nishraptor committed Sep 20, 2023
1 parent 6e840e4 commit 51ec26f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/runtime_src/core/common/api/xrt_hw_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ hw_context::
hw_context(const xrt::device& device, const xrt::uuid& xclbin_id, const xrt::hw_context::cfg_param_type& cfg_param)
: detail::pimpl<hw_context_impl>(std::make_shared<hw_context_impl>(device.get_handle(), xclbin_id, cfg_param))
{
// xrt_core::xdp::update_device(get_handle().get());
xrt_core::xdp::update_device(get_handle().get());
}


Expand Down
1 change: 0 additions & 1 deletion src/runtime_src/core/common/xdp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ add_library(core_common_xdp_profile_objects OBJECT
target_include_directories(core_common_xdp_profile_objects
PRIVATE
${XRT_SOURCE_DIR}/runtime_src
${XRT_SOURCE_DIR}/runtime_src/core/common/elf
)

if (XDP_MINIMAL_BUILD STREQUAL "yes")
Expand Down
8 changes: 3 additions & 5 deletions src/runtime_src/core/common/xdp/profile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// 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"
Expand All @@ -21,8 +22,8 @@ namespace xrt_core::xdp::aie::profile {
warning_callbacks);
}

std::function<void (void*)> update_device_cb;
std::function<void (void*)> end_poll_cb;
std::function<void (void*)> update_device_cb = nullptr;
std::function<void (void*)> end_poll_cb = nullptr;

void
register_callbacks(void* handle)
Expand All @@ -32,9 +33,6 @@ namespace xrt_core::xdp::aie::profile {
#ifdef XDP_MINIMAL_BUILD
update_device_cb = reinterpret_cast<ftype>(xrt_core::dlsym(handle, "updateAIECtrDevice"));
end_poll_cb = reinterpret_cast<ftype>(xrt_core::dlsym(handle, "endAIECtrPoll"));
#else
update_device_cb = reinterpret_cast<ftype>(xrt_core::dlsym(handle, "IPUConfigProfile"));
end_poll_cb = reinterpret_cast<ftype>(xrt_core::dlsym(handle, "IPUReadProfile"));
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace xdp {
}
metricStrings[module_type::core].insert(metricStrings[module_type::core].end(), {"s2mm_throughputs", "mm2s_throughputs"});
metricStrings[module_type::dma].insert(metricStrings[module_type::dma].end(), {"s2mm_throughputs", "mm2s_throughputs"});
metricStrings[module_type::shim].insert(metricStrings[module_type::shim].end(), {"s2mm_throughputs", "mm2s_throughputs", "s2mm_stalls", "mm2s_stalls"});
metricStrings[module_type::shim].insert(metricStrings[module_type::shim].end(), {"s2mm_throughputs", "mm2s_throughputs", "s2mm_stalls0", "mm2s_stalls0", "s2mm_stalls1", "mm2s_stalls1"});
metricStrings[module_type::mem_tile].insert(metricStrings[module_type::mem_tile].end(), {"s2mm_throughputs", "mm2s_throughputs", "conflict_stats1", "conflict_stats2","conflict_stats3", "conflict_stats4"});

#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,9 @@ namespace xdp {
AIEData.threadCtrlBool = false;
#else
AIEData.threadCtrlBool = true;
#endif
auto device_thread = std::thread(&AieProfilePlugin::pollAIECounters, this, mIndex, handleToAIEData.begin()->first);
// auto device_thread = std::thread(&AieProfileImpl::pollAIECounters, implementation.get(), mIndex, handle);
AIEData.thread = std::move(device_thread);

#endif
// Open the writer for this device
auto time = std::time(nullptr);

Expand Down Expand Up @@ -216,7 +214,7 @@ namespace xdp {
std::this_thread::sleep_for(std::chrono::microseconds(handleToAIEData[handle].metadata->getPollingIntervalVal()));
}
//Final Polling Operation
// handleToAIEData[handle].implementation->poll(index, handle);
handleToAIEData[handle].implementation->poll(index, handle);
}

void AieProfilePlugin::writeAll(bool /*openNewFiles*/)
Expand Down Expand Up @@ -258,8 +256,11 @@ namespace xdp {
void AieProfilePlugin::endPoll()
{
xrt_core::message::send(severity_level::info, "XRT", "Calling AIE Profile endPoll.");
auto& AIEData = handleToAIEData.begin()->second;
AIEData.implementation->poll(0, nullptr);

#ifdef XDP_MINIMAL_BUILD
auto& AIEData = handleToAIEData.begin()->second;
AIEData.implementation->poll(0, nullptr);
#endif
// Ask all threads to end
for (auto& p : handleToAIEData)
p.second.threadCtrlBool = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ namespace xdp {
// **** Interface Tile Counters ****
mShimStartEvents = {
{"s2mm_throughputs", {XAIE_EVENT_GROUP_DMA_ACTIVITY_PL, XAIE_EVENT_PORT_RUNNING_0_PL}},
{"s2mm_stalls", {XAIE_EVENT_DMA_S2MM_SEL0_MEMORY_BACKPRESSURE_MEM_TILE, XAIE_EVENT_DMA_S2MM_SEL0_STALLED_LOCK_ACQUIRE_MEM_TILE}},
{"s2mm_stalls0", {XAIE_EVENT_DMA_S2MM_0_MEMORY_BACKPRESSURE_PL, XAIE_EVENT_DMA_S2MM_0_STALLED_LOCK_PL}},
{"s2mm_stalls1", {XAIE_EVENT_DMA_S2MM_1_MEMORY_BACKPRESSURE_PL, XAIE_EVENT_DMA_S2MM_1_STALLED_LOCK_PL}},
{"mm2s_stalls0", {XAIE_EVENT_DMA_MM2S_0_STREAM_BACKPRESSURE_PL, XAIE_EVENT_DMA_MM2S_0_MEMORY_STARVATION_PL}},
{"mm2s_stalls1", {XAIE_EVENT_DMA_MM2S_1_STREAM_BACKPRESSURE_PL, XAIE_EVENT_DMA_MM2S_1_MEMORY_STARVATION_PL}},
{"mm2s_throughputs", {XAIE_EVENT_GROUP_DMA_ACTIVITY_PL, XAIE_EVENT_PORT_RUNNING_0_PL}},
{"mm2s_stalls", {XAIE_EVENT_DMA_MM2S_SEL0_STREAM_BACKPRESSURE_MEM_TILE, XAIE_EVENT_DMA_MM2S_SEL0_MEMORY_STARVATION_MEM_TILE}},
{"packets", {XAIE_EVENT_PORT_TLAST_0_PL, XAIE_EVENT_PORT_TLAST_1_PL}}
};

Expand Down Expand Up @@ -478,7 +480,10 @@ namespace xdp {
AieProfile_WinImpl::
poll(uint32_t index, void* handle)
{
std::cout << "handle; " << handle << std::endl;
if (finishedPoll)
return;

(void)handle;
double timestamp = xrt_core::time_ns() / 1.0e6;
auto context = metadata->getHwContext();

Expand Down Expand Up @@ -533,6 +538,7 @@ namespace xdp {
db->getDynamicInfo().addAIESample(index, timestamp, values);
}

finishedPoll=true;
free(op);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ namespace xdp {
std::size_t op_size;
XAie_DevInst aieDevInst = {0};
std::vector<std::vector<uint64_t>> outputValues;
bool finishedPoll = false;

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace xdp {
{
// Base functionality is just to have all writers write. Derived
// classes might have to do more.
std::cout << "in writeall base class!" << std::endl;

endWrite();
}

Expand Down

0 comments on commit 51ec26f

Please sign in to comment.