Skip to content

Commit

Permalink
Instrument Global Pointers (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaAtulTewari authored May 19, 2024
1 parent a7a7397 commit 69a4f0c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pando-rt/src/global_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "pando-rt/locality.hpp"
#include "pando-rt/memory/address_translation.hpp"
#include "pando-rt/stdlib.hpp"
#include "pando-rt/benchmark/counters.hpp"

#if defined(PANDO_RT_USE_BACKEND_PREP)
#include "prep/cores.hpp"
Expand All @@ -26,6 +27,9 @@
#include "drvx/drvx.hpp"
#endif // PANDO_RT_USE_BACKEND_PREP

constexpr bool POINTER_TIMER_ENABLE = false;
counter::Record<std::int64_t> pointerCount = counter::Record<std::int64_t>();

namespace pando {

namespace detail {
Expand Down Expand Up @@ -116,6 +120,8 @@ void load(GlobalAddress srcGlobalAddr, std::size_t n, void* dstNativePtr) {

const auto nodeIdx = extractNodeIndex(srcGlobalAddr);
if (nodeIdx == Nodes::getCurrentNode()) {
counter::HighResolutionCount<POINTER_TIMER_ENABLE> pointerTimer;
pointerTimer.start();
// yield to other hart and then issue the operation
//hartYield();

Expand All @@ -127,6 +133,7 @@ void load(GlobalAddress srcGlobalAddr, std::size_t n, void* dstNativePtr) {
// if the level of mem-tracing is ALL (2), log intra-pxn memory operations
MemTraceLogger::log("LOAD", nodeIdx, nodeIdx, n, dstNativePtr, srcGlobalAddr);
#endif
counter::recordHighResolutionEvent(pointerCount, pointerTimer);
} else {
// remote load; send remote load request and wait for it to finish
Nodes::LoadHandle handle(dstNativePtr);
Expand Down Expand Up @@ -169,6 +176,8 @@ void store(GlobalAddress dstGlobalAddr, std::size_t n, const void* srcNativePtr)

const auto nodeIdx = extractNodeIndex(dstGlobalAddr);
if (nodeIdx == Nodes::getCurrentNode()) {
counter::HighResolutionCount<POINTER_TIMER_ENABLE> pointerTimer;
pointerTimer.start();
// yield to other hart and then issue the operation
//hartYield();

Expand All @@ -180,6 +189,7 @@ void store(GlobalAddress dstGlobalAddr, std::size_t n, const void* srcNativePtr)
// if the level of mem-tracing is ALL (2), log intra-pxn memory operations
MemTraceLogger::log("STORE", nodeIdx, nodeIdx, n, dstNativePtr, dstGlobalAddr);
#endif
counter::recordHighResolutionEvent(pointerCount, pointerTimer);
} else {
// remote store; send remote store request and wait for it to finish
Nodes::AckHandle handle;
Expand Down
5 changes: 5 additions & 0 deletions pando-rt/src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ int main(int argc, char* argv[]) {
thisPlace.node.id,
std::int8_t((i == std::uint64_t(dims.core.x + 1)) ? -1 : i),
idleCount.get(i));
SPDLOG_WARN("Pointer time on node: {}, core: {} was {}",
thisPlace.node.id,
std::int8_t((i == std::uint64_t(dims.core.x + 1)) ? -1 : i),
pointerCount.get(i));
}


return result;
}

Expand Down
1 change: 1 addition & 0 deletions pando-rt/src/init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <pando-rt/benchmark/counters.hpp>

extern counter::Record<std::int64_t> idleCount;
extern counter::Record<std::int64_t> pointerCount;

namespace pando {

Expand Down

0 comments on commit 69a4f0c

Please sign in to comment.