CIRCT 23.0.0git
Loading...
Searching...
No Matches
Services.h
Go to the documentation of this file.
1//===- StdServices.h - ESI standard services C++ API ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// The APIs in this backend are all optionally implemented. The lower level
10// ones, however, are strongly recommended. 'Services' here refers to ESI
11// services. These are standard APIs into the standard ESI services.
12//
13// DO NOT EDIT!
14// This file is distributed as part of an ESI package. The source for this file
15// should always be modified within CIRCT.
16//
17//===----------------------------------------------------------------------===//
18
19// NOLINTNEXTLINE(llvm-header-guard)
20#ifndef ESI_RUNTIME_SERVICES_H
21#define ESI_RUNTIME_SERVICES_H
22
23#include "esi/Common.h"
24#include "esi/Context.h"
25#include "esi/Ports.h"
26
27#include <cstdint>
28#include <list>
29
30namespace esi {
31class AcceleratorConnection;
32class Engine;
33namespace services {
34class Service;
35}
36
37// While building the design, keep around a std::map of active services indexed
38// by the service name. When a new service is encountered during descent, add it
39// to the table (perhaps overwriting one). Modifications to the table only apply
40// to the current branch, so copy this and update it at each level of the tree.
41using ServiceTable = std::map<std::string, services::Service *>;
42
43namespace services {
44
45/// Add a custom interface to a service client at a particular point in the
46/// design hierarchy.
47class ServicePort : public BundlePort {
48public:
50 virtual ~ServicePort() = default;
51 // Get a description of the service port.
52 virtual std::optional<std::string> toString(bool oneLine = false) const {
53 return std::nullopt;
54 }
55};
56
57/// Parent class of all APIs modeled as 'services'. May or may not map to a
58/// hardware side 'service'.
59class Service {
60public:
61 using Type = const std::type_info &;
63 virtual ~Service() = default;
64
65 virtual std::string getServiceSymbol() const = 0;
66
67 /// Create a "child" service of this service. Does not have to be the same
68 /// service type, but typically is. Used when a service already exists in the
69 /// active services table, but a new one wants to replace it. Useful for cases
70 /// where the child service needs to use the parent service. Defaults to
71 /// calling the `getService` method on `AcceleratorConnection` to get the
72 /// global service, implying that the child service does not need to use the
73 /// service it is replacing.
74 virtual Service *getChildService(Service::Type service, AppIDPath id = {},
75 std::string implName = {},
76 ServiceImplDetails details = {},
77 HWClientDetails clients = {});
78
79 /// Get specialized port for this service to attach to the given appid path.
80 /// Null returns mean nothing to attach.
81 virtual BundlePort *getPort(AppIDPath id, const BundleType *type) const {
82 return nullptr;
83 }
84
86
87protected:
89};
90
91/// A service for which there are no standard services registered. Requires
92/// ports be added to the design hierarchy instead of high level interfaces like
93/// the ones in StdServices.h.
94class CustomService : public Service {
95public:
97 const ServiceImplDetails &details,
98 const HWClientDetails &clients);
99 virtual ~CustomService() = default;
100
101 virtual std::string getServiceSymbol() const override {
102 return serviceSymbol;
103 }
104 virtual BundlePort *getPort(AppIDPath id,
105 const BundleType *type) const override;
106
107protected:
108 std::string serviceSymbol;
110};
111
112/// Information about the Accelerator system.
113class SysInfo : public Service {
114public:
115 using Service::Service;
116 virtual ~SysInfo() = default;
117
118 virtual std::string getServiceSymbol() const override;
119
120 /// Get the ESI version number to check version compatibility.
121 virtual uint32_t getEsiVersion() const = 0;
122
123 /// Get the current cycle count of the accelerator system.
124 virtual std::optional<uint64_t> getCycleCount() const { return std::nullopt; }
125 /// Get the "core" clock frequency of the accelerator system in Hz. Returns
126 /// nullopt if the accelerator does not provide this information.
127 virtual std::optional<uint64_t> getCoreClockFrequency() const {
128 return std::nullopt;
129 }
130
131 /// Return the JSON-formatted system manifest.
132 virtual std::string getJsonManifest() const;
133
134 /// Return the zlib compressed JSON system manifest.
135 virtual std::vector<uint8_t> getCompressedManifest() const = 0;
136};
137
138class MMIO : public Service {
139public:
140 static constexpr std::string_view StdName = "esi.service.std.mmio";
141
142 /// Describe a region (slice) of MMIO space.
144 uint32_t base;
145 uint32_t size;
146 };
147
148 MMIO(AcceleratorConnection &, const AppIDPath &idPath,
149 const HWClientDetails &clients);
150 virtual ~MMIO() = default;
151
152 /// Read a 64-bit value from the global MMIO space.
153 virtual uint64_t read(uint32_t addr) const = 0;
154 /// Write a 64-bit value to the global MMIO space.
155 virtual void write(uint32_t addr, uint64_t data) = 0;
156 /// Get the regions of MMIO space that this service manages. Otherwise known
157 /// as the base address table.
158 const std::map<AppIDPath, RegionDescriptor> &getRegions() const {
159 return regions;
160 }
161
162 /// If the service is a MMIO service, return a region of the MMIO space which
163 /// peers into ours.
164 virtual Service *getChildService(Service::Type service, AppIDPath id = {},
165 std::string implName = {},
166 ServiceImplDetails details = {},
167 HWClientDetails clients = {}) override;
168
169 virtual std::string getServiceSymbol() const override;
170
171 /// Get a MMIO region port for a particular region descriptor.
172 virtual BundlePort *getPort(AppIDPath id,
173 const BundleType *type) const override;
174
175protected:
176 // The current ESI hardware implementations only support one MMIO command at a
177 // time but don't enforce it. So we must grab a lock to enforce it on the
178 // software side.
179 mutable std::mutex mmioCmdLock;
180
181private:
182 /// MMIO base address table.
183 std::map<AppIDPath, RegionDescriptor> regions;
184
185public:
186 /// A "slice" of some parent MMIO space.
187 class MMIORegion : public ServicePort {
188 friend class MMIO;
190
191 public:
192 /// Get the offset (and size) of the region in the parent (usually global)
193 /// MMIO address space.
194 virtual RegionDescriptor getDescriptor() const { return desc; };
195 /// Read a 64-bit value from this region, not the global address space.
196 virtual uint64_t read(uint32_t addr) const;
197 /// Write a 64-bit value to this region, not the global address space.
198 virtual void write(uint32_t addr, uint64_t data);
199
200 virtual std::optional<std::string>
201 toString(bool oneLine = false) const override {
202 return "MMIO region " + toHex(desc.base) + " - " +
204 }
205
206 private:
209 };
210};
211
212/// Implement the SysInfo API for a standard MMIO protocol.
213class MMIOSysInfo final : public SysInfo {
214public:
215 MMIOSysInfo(const MMIO *);
216
217 /// Get the ESI version number to check version compatibility.
218 uint32_t getEsiVersion() const override;
219
220 /// Get the current cycle count of the accelerator system's core clock.
221 std::optional<uint64_t> getCycleCount() const override;
222 /// Get the "core" clock frequency of the accelerator system in Hz. Returns
223 /// nullopt if the accelerator does not provide this information.
224 std::optional<uint64_t> getCoreClockFrequency() const override;
225
226 /// Return the zlib compressed JSON system manifest.
227 virtual std::vector<uint8_t> getCompressedManifest() const override;
228
229private:
230 const MMIO *mmio;
231};
232
233class HostMem : public Service {
234public:
235 static constexpr std::string_view StdName = "esi.service.std.hostmem";
236
237 using Service::Service;
238 virtual ~HostMem() = default;
239 virtual std::string getServiceSymbol() const override;
240
241 /// RAII memory region for host memory. Automatically frees the memory when
242 /// deconstructed.
244 virtual ~HostMemRegion() = default;
245 /// Get a pointer to the host memory.
246 virtual void *getPtr() const = 0;
247 /// Sometimes the pointer the device sees is different from the pointer the
248 /// host sees. Call this functon to get the device pointer.
249 virtual void *getDevicePtr() const { return getPtr(); }
250 operator void *() const { return getPtr(); }
251 virtual std::size_t getSize() const = 0;
252 /// Flush the memory region to ensure that the device sees the latest
253 /// contents. Because some platforms require it before DMA transactions, it
254 /// is recommended to call this before any DMA on all platforms. On
255 /// platforms which don't require it, it is a cheap no-op virtual method
256 /// call.
257 virtual void flush() {}
258 };
259
260 /// Options for allocating host memory.
261 struct Options {
262 bool writeable = false;
263 bool useLargePages = false;
264 };
265
266 /// In cases where necessary, enable host memory services.
267 virtual void start() {}
268
269 /// Allocate a region of host memory in accelerator accessible address space.
270 virtual std::unique_ptr<HostMemRegion> allocate(std::size_t size,
271 Options opts) const = 0;
272
273 /// Try to make a region of host memory accessible to the accelerator. Returns
274 /// 'false' on failure. It is optional for an accelerator backend to implement
275 /// this, so client code needs to have a fallback for when this returns
276 /// 'false'. On success, it is the client's responsibility to ensure that the
277 /// memory eventually gets unmapped.
278 virtual bool mapMemory(void *ptr, std::size_t size, Options opts) const {
279 return false;
280 }
281 /// Unmap memory which was previously mapped with 'mapMemory'. Undefined
282 /// behavior when called with a pointer which was not previously mapped.
283 virtual void unmapMemory(void *ptr) const {}
284};
285
286/// Service for raw communication channels to/from the accelerator.
287class ChannelService : public Service {
288public:
290 ServiceImplDetails details, HWClientDetails clients);
291
292 virtual std::string getServiceSymbol() const override;
293 virtual BundlePort *getPort(AppIDPath id,
294 const BundleType *type) const override;
295
296 /// A port which reads data from the accelerator (to_host).
297 class ToHost : public ServicePort {
298 friend class ChannelService;
299 using ServicePort::ServicePort;
300
301 public:
302 static ToHost *get(AppID id, const BundleType *type,
304 void connect();
305 std::future<MessageData> read();
306
307 virtual std::optional<std::string>
308 toString(bool oneLine = false) const override {
309 const esi::Type *dataType =
310 dynamic_cast<const ChannelType *>(type->findChannel("data").first)
311 ->getInner();
312 return "channel to_host " + dataType->toString(oneLine);
313 }
314
315 private:
317 bool connected = false;
318 };
319
320 /// A port which writes data to the accelerator (from_host).
321 class FromHost : public ServicePort {
322 friend class ChannelService;
323 using ServicePort::ServicePort;
324
325 public:
326 static FromHost *get(AppID id, const BundleType *type,
328 void connect();
329 void write(const MessageData &data);
330
331 virtual std::optional<std::string>
332 toString(bool oneLine = false) const override {
333 const esi::Type *dataType =
334 dynamic_cast<const ChannelType *>(type->findChannel("data").first)
335 ->getInner();
336 return "channel from_host " + dataType->toString(oneLine);
337 }
338
339 private:
341 bool connected = false;
342 };
343
344private:
345 std::string symbol;
346};
347
348/// Service for calling functions.
349class FuncService : public Service {
350public:
352 HWClientDetails clients);
353
354 virtual std::string getServiceSymbol() const override;
355 virtual BundlePort *getPort(AppIDPath id,
356 const BundleType *type) const override;
357
358 /// A function call which gets attached to a service port.
359 class Function : public ServicePort {
360 friend class FuncService;
361 using ServicePort::ServicePort;
362
363 public:
366
367 void connect(const ChannelPort::ConnectOptions &options = {});
368 std::future<MessageData> call(const MessageData &arg);
369
370 const esi::Type *getArgType() const {
371 return dynamic_cast<const ChannelType *>(type->findChannel("arg").first)
372 ->getInner();
373 }
374
375 const esi::Type *getResultType() const {
376 return dynamic_cast<const ChannelType *>(
377 type->findChannel("result").first)
378 ->getInner();
379 }
380
381 virtual std::optional<std::string>
382 toString(bool oneLine = false) const override {
383 const esi::Type *argType = getArgType();
384 const esi::Type *resultType = getResultType();
385 return "function " + resultType->toString(oneLine) + "(" +
386 argType->toString(oneLine) + ")";
387 }
388
389 private:
390 std::mutex callMutex;
393 bool connected = false;
394 };
395
396private:
397 std::string symbol;
398};
399
400/// Service for servicing function calls from the accelerator.
401class CallService : public Service {
402public:
404 ServiceImplDetails details);
405
406 virtual std::string getServiceSymbol() const override;
407 virtual BundlePort *getPort(AppIDPath id,
408 const BundleType *type) const override;
409
410 /// A function call which gets attached to a service port.
411 class Callback : public ServicePort {
412 friend class CallService;
415
416 public:
420
421 /// Connect a callback to code which will be executed when the accelerator
422 /// invokes the callback. The 'quick' flag indicates that the callback is
423 /// sufficiently fast that it could be called in the same thread as the
424 /// port callback.
425 void connect(std::function<MessageData(const MessageData &)> callback,
426 bool quick = false,
427 const ChannelPort::ConnectOptions &options = {});
428
429 const esi::Type *getArgType() const {
430 return dynamic_cast<const ChannelType *>(type->findChannel("arg").first)
431 ->getInner();
432 }
433
434 const esi::Type *getResultType() const {
435 return dynamic_cast<const ChannelType *>(
436 type->findChannel("result").first)
437 ->getInner();
438 }
439
440 virtual std::optional<std::string>
441 toString(bool oneLine = false) const override {
442 const esi::Type *argType = getArgType();
443 const esi::Type *resultType = getResultType();
444 return "callback " + resultType->toString(oneLine) + "(" +
445 argType->toString(oneLine) + ")";
446 }
447
448 private:
452 };
453
454private:
455 std::string symbol;
456};
457
458/// Service for retrieving telemetry data from the accelerator.
459class TelemetryService : public Service {
460public:
461 static constexpr std::string_view StdName = "esi.service.std.telemetry";
462
464 ServiceImplDetails details, HWClientDetails clients);
465
466 virtual std::string getServiceSymbol() const override;
467 virtual BundlePort *getPort(AppIDPath id,
468 const BundleType *type) const override;
469 virtual Service *getChildService(Service::Type service, AppIDPath id = {},
470 std::string implName = {},
471 ServiceImplDetails details = {},
472 HWClientDetails clients = {}) override;
473 MMIO::MMIORegion *getMMIORegion() const;
474
475 /// A telemetry port which gets attached to a service port.
476 class Metric : public ServicePort {
477 friend class TelemetryService;
480 std::optional<uint64_t> offset);
481
482 public:
483 void connect();
484 std::future<MessageData> read();
485 uint64_t readInt();
486
487 virtual std::optional<std::string>
488 toString(bool oneLine = false) const override {
489 const esi::Type *dataType =
490 dynamic_cast<const ChannelType *>(type->findChannel("data").first)
491 ->getInner();
492 return "telemetry " + dataType->toString(oneLine);
493 }
494
495 private:
498 std::optional<uint64_t> offset;
499 };
500
501 std::map<AppIDPath, Metric *> getTelemetryPorts() {
502 std::map<AppIDPath, Metric *> ports;
503 getTelemetryPorts(ports);
504 return ports;
505 }
506 void getTelemetryPorts(std::map<AppIDPath, Metric *> &ports);
507
508private:
511 std::map<AppIDPath, uint64_t> portAddressAssignments;
512 mutable std::map<AppIDPath, Metric *> telemetryPorts;
513 std::list<TelemetryService *> children;
514};
515
516/// Registry of services which can be instantiated directly by the Accelerator
517/// class if the backend doesn't do anything special with a service.
519public:
520 /// Create a service instance from the given details. Returns nullptr if
521 /// 'svcType' isn't registered.
523 Service::Type svcType, AppIDPath id,
524 std::string implName,
525 ServiceImplDetails details,
526 HWClientDetails clients);
527
528 /// Resolve a service type from a string. If the string isn't recognized,
529 /// default to CustomService.
530 static Service::Type lookupServiceType(const std::string &);
531};
532
533} // namespace services
534} // namespace esi
535
536#endif // ESI_RUNTIME_SERVICES_H
Abstract class representing a connection to an accelerator.
Services provide connections to 'bundles' – collections of named, unidirectional communication channe...
Definition Ports.h:611
PortMap channels
Definition Ports.h:655
const BundleType * type
Definition Ports.h:654
BundlePort(AppID id, const BundleType *type, PortMap channels)
Construct a port.
Definition Ports.cpp:39
Bundles represent a collection of channels.
Definition Types.h:104
std::pair< const Type *, Direction > findChannel(std::string name) const
Definition Types.cpp:127
Channels are the basic communication primitives.
Definition Types.h:125
A concrete flat message backed by a single vector of bytes.
Definition Common.h:155
A ChannelPort which reads data from the accelerator.
Definition Ports.h:453
Root class of the ESI type system.
Definition Types.h:36
std::string toString(bool oneLine=false) const
Definition Types.cpp:120
A ChannelPort which sends data to the accelerator.
Definition Ports.h:308
A function call which gets attached to a service port.
Definition Services.h:411
static Callback * get(AcceleratorConnection &acc, AppID id, const BundleType *type, WriteChannelPort &result, ReadChannelPort &arg)
Definition Services.cpp:335
const esi::Type * getArgType() const
Definition Services.h:429
const esi::Type * getResultType() const
Definition Services.h:434
virtual std::optional< std::string > toString(bool oneLine=false) const override
Definition Services.h:441
AcceleratorConnection & acc
Definition Services.h:451
void connect(std::function< MessageData(const MessageData &)> callback, bool quick=false, const ChannelPort::ConnectOptions &options={})
Connect a callback to code which will be executed when the accelerator invokes the callback.
Definition Services.cpp:343
Service for servicing function calls from the accelerator.
Definition Services.h:401
virtual std::string getServiceSymbol() const override
Definition Services.cpp:324
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const override
Get specialized port for this service to attach to the given appid path.
Definition Services.cpp:326
A port which writes data to the accelerator (from_host).
Definition Services.h:321
virtual std::optional< std::string > toString(bool oneLine=false) const override
Definition Services.h:332
static FromHost * get(AppID id, const BundleType *type, WriteChannelPort &dataPort)
Definition Services.cpp:247
void write(const MessageData &data)
Definition Services.cpp:263
A port which reads data from the accelerator (to_host).
Definition Services.h:297
std::future< MessageData > read()
Definition Services.cpp:239
virtual std::optional< std::string > toString(bool oneLine=false) const override
Definition Services.h:308
static ToHost * get(AppID id, const BundleType *type, ReadChannelPort &dataPort)
Definition Services.cpp:222
Service for raw communication channels to/from the accelerator.
Definition Services.h:287
virtual std::string getServiceSymbol() const override
Definition Services.cpp:211
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const override
Get specialized port for this service to attach to the given appid path.
Definition Services.cpp:213
A service for which there are no standard services registered.
Definition Services.h:94
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const override
Get specialized port for this service to attach to the given appid path.
Definition Services.cpp:197
virtual ~CustomService()=default
virtual std::string getServiceSymbol() const override
Definition Services.h:101
A function call which gets attached to a service port.
Definition Services.h:359
const esi::Type * getArgType() const
Definition Services.h:370
const esi::Type * getResultType() const
Definition Services.h:375
std::future< MessageData > call(const MessageData &arg)
Definition Services.cpp:308
virtual std::optional< std::string > toString(bool oneLine=false) const override
Definition Services.h:382
static Function * get(AppID id, BundleType *type, WriteChannelPort &arg, ReadChannelPort &result)
Definition Services.cpp:286
void connect(const ChannelPort::ConnectOptions &options={})
Definition Services.cpp:294
Service for calling functions.
Definition Services.h:349
virtual std::string getServiceSymbol() const override
Definition Services.cpp:279
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const override
Get specialized port for this service to attach to the given appid path.
Definition Services.cpp:281
virtual ~HostMem()=default
virtual std::string getServiceSymbol() const override
Definition Services.cpp:184
virtual void start()
In cases where necessary, enable host memory services.
Definition Services.h:267
static constexpr std::string_view StdName
Definition Services.h:235
virtual std::unique_ptr< HostMemRegion > allocate(std::size_t size, Options opts) const =0
Allocate a region of host memory in accelerator accessible address space.
virtual void unmapMemory(void *ptr) const
Unmap memory which was previously mapped with 'mapMemory'.
Definition Services.h:283
virtual bool mapMemory(void *ptr, std::size_t size, Options opts) const
Try to make a region of host memory accessible to the accelerator.
Definition Services.h:278
Implement the SysInfo API for a standard MMIO protocol.
Definition Services.h:213
std::optional< uint64_t > getCycleCount() const override
Get the current cycle count of the accelerator system's core clock.
Definition Services.cpp:153
virtual std::vector< uint8_t > getCompressedManifest() const override
Return the zlib compressed JSON system manifest.
Definition Services.cpp:164
std::optional< uint64_t > getCoreClockFrequency() const override
Get the "core" clock frequency of the accelerator system in Hz.
Definition Services.cpp:157
uint32_t getEsiVersion() const override
Get the ESI version number to check version compatibility.
Definition Services.cpp:146
A "slice" of some parent MMIO space.
Definition Services.h:187
virtual uint64_t read(uint32_t addr) const
Read a 64-bit value from this region, not the global address space.
Definition Services.cpp:132
virtual std::optional< std::string > toString(bool oneLine=false) const override
Definition Services.h:201
virtual void write(uint32_t addr, uint64_t data)
Write a 64-bit value to this region, not the global address space.
Definition Services.cpp:137
virtual RegionDescriptor getDescriptor() const
Get the offset (and size) of the region in the parent (usually global) MMIO address space.
Definition Services.h:194
virtual uint64_t read(uint32_t addr) const =0
Read a 64-bit value from the global MMIO space.
virtual ~MMIO()=default
virtual void write(uint32_t addr, uint64_t data)=0
Write a 64-bit value to the global MMIO space.
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const override
Get a MMIO region port for a particular region descriptor.
Definition Services.cpp:94
std::map< AppIDPath, RegionDescriptor > regions
MMIO base address table.
Definition Services.h:183
static constexpr std::string_view StdName
Definition Services.h:140
virtual Service * getChildService(Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={}) override
If the service is a MMIO service, return a region of the MMIO space which peers into ours.
Definition Services.cpp:118
const std::map< AppIDPath, RegionDescriptor > & getRegions() const
Get the regions of MMIO space that this service manages.
Definition Services.h:158
std::mutex mmioCmdLock
Definition Services.h:179
virtual std::string getServiceSymbol() const override
Definition Services.cpp:91
Add a custom interface to a service client at a particular point in the design hierarchy.
Definition Services.h:47
virtual ~ServicePort()=default
virtual std::optional< std::string > toString(bool oneLine=false) const
Definition Services.h:52
Registry of services which can be instantiated directly by the Accelerator class if the backend doesn...
Definition Services.h:518
static Service::Type lookupServiceType(const std::string &)
Resolve a service type from a string.
Definition Services.cpp:506
static Service * createService(AcceleratorConnection *acc, Service::Type svcType, AppIDPath id, std::string implName, ServiceImplDetails details, HWClientDetails clients)
Create a service instance from the given details.
Definition Services.cpp:487
Parent class of all APIs modeled as 'services'.
Definition Services.h:59
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const
Get specialized port for this service to attach to the given appid path.
Definition Services.h:81
virtual std::string getServiceSymbol() const =0
AcceleratorConnection & getConnection() const
Definition Services.h:85
const std::type_info & Type
Definition Services.h:61
virtual Service * getChildService(Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
Create a "child" service of this service.
Definition Services.cpp:28
Service(AcceleratorConnection &conn)
Definition Services.h:62
virtual ~Service()=default
AcceleratorConnection & conn
Definition Services.h:88
Information about the Accelerator system.
Definition Services.h:113
virtual std::optional< uint64_t > getCoreClockFrequency() const
Get the "core" clock frequency of the accelerator system in Hz.
Definition Services.h:127
virtual std::string getJsonManifest() const
Return the JSON-formatted system manifest.
Definition Services.cpp:40
virtual uint32_t getEsiVersion() const =0
Get the ESI version number to check version compatibility.
virtual std::vector< uint8_t > getCompressedManifest() const =0
Return the zlib compressed JSON system manifest.
virtual std::string getServiceSymbol() const override
Definition Services.cpp:35
virtual std::optional< uint64_t > getCycleCount() const
Get the current cycle count of the accelerator system.
Definition Services.h:124
virtual ~SysInfo()=default
A telemetry port which gets attached to a service port.
Definition Services.h:476
std::optional< uint64_t > offset
Definition Services.h:498
virtual std::optional< std::string > toString(bool oneLine=false) const override
Definition Services.h:488
void connect()
Connect to a particular telemetry port. Offset should be non-nullopt.
Definition Services.cpp:459
std::future< MessageData > read()
Definition Services.cpp:466
const TelemetryService * telemetryService
Definition Services.h:496
Service for retrieving telemetry data from the accelerator.
Definition Services.h:459
std::list< TelemetryService * > children
Definition Services.h:513
std::map< AppIDPath, Metric * > getTelemetryPorts()
Definition Services.h:501
MMIO::MMIORegion * mmio
Definition Services.h:510
MMIO::MMIORegion * getMMIORegion() const
Definition Services.cpp:412
std::map< AppIDPath, Metric * > telemetryPorts
Definition Services.h:512
std::map< AppIDPath, uint64_t > portAddressAssignments
Definition Services.h:511
static constexpr std::string_view StdName
Definition Services.h:461
virtual std::string getServiceSymbol() const override
Definition Services.cpp:408
virtual BundlePort * getPort(AppIDPath id, const BundleType *type) const override
Get specialized port for this service to attach to the given appid path.
Definition Services.cpp:431
virtual Service * getChildService(Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={}) override
Create a "child" service of this service.
Definition Services.cpp:442
Definition esi.py:1
std::map< std::string, std::any > ServiceImplDetails
Definition Common.h:108
std::string toHex(void *val)
Definition Common.cpp:37
std::map< std::string, ChannelPort & > PortMap
Definition Ports.h:33
std::map< std::string, services::Service * > ServiceTable
Definition Services.h:41
std::vector< HWClientDetail > HWClientDetails
Definition Common.h:107
RAII memory region for host memory.
Definition Services.h:243
virtual void * getDevicePtr() const
Sometimes the pointer the device sees is different from the pointer the host sees.
Definition Services.h:249
virtual void * getPtr() const =0
Get a pointer to the host memory.
virtual void flush()
Flush the memory region to ensure that the device sees the latest contents.
Definition Services.h:257
virtual std::size_t getSize() const =0
Options for allocating host memory.
Definition Services.h:261
Describe a region (slice) of MMIO space.
Definition Services.h:143