Skip to content

Commit a034e7d

Browse files
authored
[ESI][Runtime] Expose HostMem.start() to Python (#11283)
Extend HostMem::start into Python. Assisted-by: GHCP:Claude Opus 5.5
1 parent dfec4a4 commit a034e7d

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎lib/Dialect/ESI/runtime/CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
### Added
2121

22+
- `HostMem.start()` is now available from Python, so Python code can enable
23+
the host memory service (needed before the accelerator reads host memory
24+
under cosim).
2225
- `CosimBSP` accepts a `channel_service` implementation class for custom channel
2326
transports, including engines shared by multiple channels. The BSP satisfies
2427
the implementation's MMIO and HostMem requests. This option is mutually

‎lib/Dialect/ESI/runtime/python/esiaccel/esiCppAccel.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ NB_MODULE(esiCppAccel, m) {
297297
});
298298

299299
nb::class_<services::HostMem, services::Service>(m, "HostMem")
300+
.def("start", &services::HostMem::start,
301+
"Enable the host memory service (e.g. start servicing the "
302+
"accelerator's read and write requests). Required before the "
303+
"accelerator accesses host memory on some backends.")
300304
.def("allocate", &services::HostMem::allocate, nb::arg("size"),
301305
nb::arg("options") = services::HostMem::Options(),
302306
nb::rv_policy::take_ownership)

‎lib/Dialect/ESI/runtime/tests/integration/sw/test_loopback.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def run(conn: AcceleratorConnection, platform: str = "cosim") -> None:
2222
print(f"mem1: {mem1.ptr} size {mem1.size}")
2323
mem1 = None
2424
assert hostmem.allocate(0) is None
25+
# Enabling host memory service is idempotent.
26+
hostmem.start()
27+
hostmem.start()
2528

2629
assert conn.sysinfo().esi_version() == 1
2730
m = conn.manifest()

0 commit comments

Comments
 (0)