mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-12 09:17:06 +00:00
30 lines
834 B
C++
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
|