Files
mscclpp/src/basic_proxy_handler.cc
Olli Saarikivi 9fbb0debdd C++ API changes
2023-04-19 22:02:23 +00:00

30 lines
834 B
C++

#include "basic_proxy_handler.hpp"
namespace mscclpp {
ProxyHandler makeBasicProxyHandler(Communicator::Impl &comm) {
return [&comm](ProxyTrigger triggerRaw) {
ChannelTrigger *trigger = reinterpret_cast<ChannelTrigger*>(&triggerRaw);
HostConnection& conn = *comm.connections.at(trigger->fields.connId);
auto result = ProxyHandlerResult::Continue;
if (trigger->fields.type & mscclppData) {
conn.put(trigger->fields.dstBufferHandle, trigger->fields.dstOffset, trigger->fields.srcBufferHandle, trigger->fields.srcOffset, trigger->fields.size);
}
if (trigger->fields.type & mscclppFlag) {
conn.signal();
}
if (trigger->fields.type & mscclppSync) {
conn.flush();
result = ProxyHandlerResult::FlushFifoTailAndContinue;
}
return result;
};
}
} // namespace mscclpp