mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-12 01:10:22 +00:00
Change device handle interfaces & others (#142)
* Changed device handle interfaces * Changed proxy service interfaces * Move device code into separate files * Fixed FIFO polling issues * Add configuration arguments in several interface functions --------- Co-authored-by: Changho Hwang <changhohwang@microsoft.com> Co-authored-by: Binyang Li <binyli@microsoft.com> Co-authored-by: root <root@a100-saemal0.qxveptpukjsuthqvv514inp03c.gx.internal.cloudapp.net>
This commit is contained in:
@@ -11,15 +11,20 @@ using namespace mscclpp;
|
||||
void register_fifo(nb::module_& m) {
|
||||
nb::class_<ProxyTrigger>(m, "ProxyTrigger").def_rw("fst", &ProxyTrigger::fst).def_rw("snd", &ProxyTrigger::snd);
|
||||
|
||||
nb::class_<DeviceProxyFifo>(m, "DeviceProxyFifo")
|
||||
.def_rw("triggers", &DeviceProxyFifo::triggers)
|
||||
.def_rw("tail_replica", &DeviceProxyFifo::tailReplica)
|
||||
.def_rw("head", &DeviceProxyFifo::head);
|
||||
nb::class_<FifoDeviceHandle>(m, "FifoDeviceHandle")
|
||||
.def_rw("triggers", &FifoDeviceHandle::triggers)
|
||||
.def_rw("tail_replica", &FifoDeviceHandle::tailReplica)
|
||||
.def_rw("head", &FifoDeviceHandle::head)
|
||||
.def_rw("size", &FifoDeviceHandle::size)
|
||||
.def_prop_ro("raw", [](const FifoDeviceHandle& self) -> nb::bytes {
|
||||
return nb::bytes(reinterpret_cast<const char*>(&self), sizeof(self));
|
||||
});
|
||||
|
||||
nb::class_<HostProxyFifo>(m, "HostProxyFifo")
|
||||
.def(nb::init<>())
|
||||
.def("poll", &HostProxyFifo::poll, nb::arg("trigger"))
|
||||
.def("pop", &HostProxyFifo::pop)
|
||||
.def("flush_tail", &HostProxyFifo::flushTail, nb::arg("sync") = false)
|
||||
.def("device_fifo", &HostProxyFifo::deviceFifo);
|
||||
nb::class_<Fifo>(m, "Fifo")
|
||||
.def(nb::init<int>(), nb::arg("size") = 128)
|
||||
.def("poll", &Fifo::poll)
|
||||
.def("pop", &Fifo::pop)
|
||||
.def("flush_tail", &Fifo::flushTail, nb::arg("sync") = false)
|
||||
.def("size", &Fifo::size)
|
||||
.def("device_handle", &Fifo::deviceHandle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user