mirror of https://github.com/llvm/circt.git
[ESI] Expose accelerator through AcceleratorConnection py api (#8781)
It is possible that the `AcceleratorConnection` that is instantiated has handed ownership of a constructed accelerator through ` `AcceleratorConnection::takeOwnership`. In that case, it should be possible to retrieve a handle to the given accelerator through the python API. That is this PR.
This commit is contained in:
parent
7f9e66f5f5
commit
d9545ff5a0
|
@ -41,6 +41,13 @@ class AcceleratorConnection:
|
|||
def get_service_hostmem(self) -> cpp.HostMem:
|
||||
return self.cpp_accel.get_service_hostmem()
|
||||
|
||||
def get_accelerator(self) -> "Accelerator":
|
||||
"""
|
||||
Return an accelerator that may be owned by this accelerator connection.
|
||||
If no accelerator is owned, will throw.
|
||||
"""
|
||||
return Accelerator(self.cpp_accel.get_accelerator())
|
||||
|
||||
|
||||
from .esiCppAccel import HostMemOptions
|
||||
|
||||
|
|
|
@ -414,7 +414,9 @@ PYBIND11_MODULE(esiCppAccel, m) {
|
|||
[](AcceleratorConnection &acc) {
|
||||
return acc.getService<services::HostMem>({});
|
||||
},
|
||||
py::return_value_policy::reference);
|
||||
py::return_value_policy::reference)
|
||||
.def("get_accelerator", &AcceleratorConnection::getAccelerator,
|
||||
py::return_value_policy::reference);
|
||||
|
||||
py::class_<Manifest>(m, "Manifest")
|
||||
.def(py::init<Context &, std::string>())
|
||||
|
|
Loading…
Reference in New Issue