Files
versitygw/cuwrapper/rc/v2-clock.cpp
T
Jihyeon Gim efa0309da4 rdma: port the hipObject v2 RC session core
Port the hipObject v2 reliable-connection session core into
cuwrapper/rc: the session table and state machine, the wire
codec for the hipobj-rc-v2 headers, request parsing, the
injectable clock and randomness sources, the transport layer
(QP/CQ lifecycle, RTR/RTS transitions, staging registration),
the data phase (RDMA write with immediate for GET, receive with
immediate for PUT), the RDMA token codec, and the dynamically
loaded ibverbs shim (ibv-core.h plus the dlopen host binding).

The sources are a port of the upstream hipObject v2 core, kept
close to the original so the two trees can be diffed during
review. Nothing links against them yet; a Makefile rule builds
the objects into rdma/librcserver.a for the ABI layer that
follows.

Signed-off-by: Jihyeon Gim <potatogim@potatogim.net>
2026-08-30 00:00:29 +09:00

42 lines
901 B
C++

/* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) Gluesys Inc. and Jihyeon Gim. All rights reserved.
*
* SPDX-License-Identifier: MIT
*/
#include "v2-clock.h"
#include <chrono>
namespace hipObj {
namespace v2 {
namespace {
class SteadyClock : public ClockSource {
public:
uint64_t nowMs() override {
auto now = std::chrono::steady_clock::now().time_since_epoch();
return static_cast<uint64_t>(
std::chrono::duration_cast<std::chrono::milliseconds>(now).count());
}
};
SteadyClock g_defaultClock;
ClockSource* g_override = nullptr;
} // namespace
ClockSource& clockSource() {
return g_override ? *g_override : static_cast<ClockSource&>(g_defaultClock);
}
ClockSource* setClockSourceForTest(ClockSource* source) {
ClockSource* previous = g_override;
g_override = source;
return previous;
}
} // namespace v2
} // namespace hipObj