Skip to content

Commit d6b191a

Browse files
committed
[ESI][Runtime] Add service context to bundle requests
Pass the current services table when requesting bundle ports. Not (yet) used in CIRCT but is required for an internal DMA engine. Useful for any DMA engine but we haven't open sourced any.
1 parent 555de19 commit d6b191a

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

lib/Dialect/ESI/runtime/cpp/include/esi/Accelerator.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,17 @@ class AcceleratorConnection {
8585
/// Disconnect from the accelerator cleanly.
8686
virtual void disconnect();
8787

88+
// While building the design, keep around a std::map of active services
89+
// indexed by the service name. When a new service is encountered during
90+
// descent, add it to the table (perhaps overwriting one). Modifications to
91+
// the table only apply to the current branch, so copy this and update it at
92+
// each level of the tree.
93+
using ServiceTable = std::map<std::string, services::Service *>;
94+
8895
/// Request the host side channel ports for a particular instance (identified
8996
/// by the AppID path). For convenience, provide the bundle type.
9097
virtual std::map<std::string, ChannelPort &>
91-
requestChannelsFor(AppIDPath, const BundleType *) = 0;
98+
requestChannelsFor(AppIDPath, const BundleType *, const ServiceTable &) = 0;
9299

93100
/// Return a pointer to the accelerator 'service' thread (or threads). If the
94101
/// thread(s) are not running, they will be started when this method is

lib/Dialect/ESI/runtime/cpp/include/esi/backends/Cosim.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class CosimAccelerator : public esi::AcceleratorConnection {
5454
/// by the AppID path). For convenience, provide the bundle type and direction
5555
/// of the bundle port.
5656
virtual std::map<std::string, ChannelPort &>
57-
requestChannelsFor(AppIDPath, const BundleType *) override;
57+
requestChannelsFor(AppIDPath, const BundleType *,
58+
const ServiceTable &) override;
5859

5960
// C++ doesn't have a mechanism to forward declare a nested class and we don't
6061
// want to include the generated header here. So we have to wrap it in a

lib/Dialect/ESI/runtime/cpp/include/esi/backends/Trace.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class TraceAccelerator : public esi::AcceleratorConnection {
6868
/// Request the host side channel ports for a particular instance (identified
6969
/// by the AppID path). For convenience, provide the bundle type.
7070
std::map<std::string, ChannelPort &>
71-
requestChannelsFor(AppIDPath, const BundleType *) override;
71+
requestChannelsFor(AppIDPath, const BundleType *,
72+
const ServiceTable &) override;
7273

7374
protected:
7475
virtual Service *createService(Service::Type service, AppIDPath idPath,

lib/Dialect/ESI/runtime/cpp/include/esi/backends/Xrt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class XrtAccelerator : public esi::AcceleratorConnection {
4141
/// by the AppID path). For convenience, provide the bundle type and direction
4242
/// of the bundle port.
4343
std::map<std::string, ChannelPort &>
44-
requestChannelsFor(AppIDPath, const BundleType *) override;
44+
requestChannelsFor(AppIDPath, const BundleType *,
45+
const ServiceTable &) override;
4546

4647
protected:
4748
virtual Service *createService(Service::Type service, AppIDPath path,

lib/Dialect/ESI/runtime/cpp/lib/Manifest.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
#include <sstream>
2121

2222
using namespace ::esi;
23-
24-
// While building the design, keep around a std::map of active services indexed
25-
// by the service name. When a new service is encountered during descent, add it
26-
// to the table (perhaps overwriting one). Modifications to the table only apply
27-
// to the current branch, so copy this and update it at each level of the tree.
28-
using ServiceTable = std::map<std::string, services::Service *>;
23+
using ServiceTable = AcceleratorConnection::ServiceTable;
2924

3025
// This is a proxy class to the manifest JSON. It is used to avoid having to
3126
// include the JSON parser in the header. Forward references don't work since
@@ -454,7 +449,7 @@ Manifest::Impl::getBundlePorts(AcceleratorConnection &acc, AppIDPath idPath,
454449

455450
idPath.push_back(parseID(content.at("appID")));
456451
std::map<std::string, ChannelPort &> portChannels =
457-
acc.requestChannelsFor(idPath, bundleType);
452+
acc.requestChannelsFor(idPath, bundleType, activeServices);
458453

459454
services::ServicePort *svcPort =
460455
svc->getPort(idPath, bundleType, portChannels, acc);

lib/Dialect/ESI/runtime/cpp/lib/backends/Cosim.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,8 @@ class ReadCosimChannelPort
291291

292292
} // namespace
293293

294-
std::map<std::string, ChannelPort &>
295-
CosimAccelerator::requestChannelsFor(AppIDPath idPath,
296-
const BundleType *bundleType) {
294+
std::map<std::string, ChannelPort &> CosimAccelerator::requestChannelsFor(
295+
AppIDPath idPath, const BundleType *bundleType, const ServiceTable &) {
297296
std::map<std::string, ChannelPort &> channelResults;
298297

299298
// Find the client details for the port at 'fullPath'.

lib/Dialect/ESI/runtime/cpp/lib/backends/Trace.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,8 @@ TraceAccelerator::Impl::requestChannelsFor(AppIDPath idPath,
257257
return channels;
258258
}
259259

260-
std::map<std::string, ChannelPort &>
261-
TraceAccelerator::requestChannelsFor(AppIDPath idPath,
262-
const BundleType *bundleType) {
260+
std::map<std::string, ChannelPort &> TraceAccelerator::requestChannelsFor(
261+
AppIDPath idPath, const BundleType *bundleType, const ServiceTable &) {
263262
return impl->requestChannelsFor(idPath, bundleType);
264263
}
265264

lib/Dialect/ESI/runtime/cpp/lib/backends/Xrt.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ class XrtMMIO : public MMIO {
100100
};
101101
} // namespace
102102

103-
std::map<std::string, ChannelPort &>
104-
XrtAccelerator::requestChannelsFor(AppIDPath idPath,
105-
const BundleType *bundleType) {
103+
std::map<std::string, ChannelPort &> XrtAccelerator::requestChannelsFor(
104+
AppIDPath idPath, const BundleType *bundleType, const ServiceTable &) {
106105
return impl->requestChannelsFor(idPath, bundleType);
107106
}
108107

0 commit comments

Comments
 (0)