20 #ifndef ESI_RUNTIME_SERVICES_H
21 #define ESI_RUNTIME_SERVICES_H
29 class AcceleratorConnection;
44 using Type =
const std::type_info &;
52 const std::map<std::string, ChannelPort &> &,
96 virtual uint64_t
read(uint32_t addr)
const = 0;
97 virtual void write(uint32_t addr, uint64_t data) = 0;
126 operator void *()
const {
return getPtr(); }
137 virtual std::unique_ptr<HostMemRegion>
allocate(std::size_t size,
162 const std::map<std::string, ChannelPort &> &,
195 const std::map<std::string, ChannelPort &> &,
202 const std::map<std::string, ChannelPort &> &
channels);
230 std::string implName,
Abstract class representing a connection to an accelerator.
Services provide connections to 'bundles' – collections of named, unidirectional communication channe...
std::map< std::string, ChannelPort & > channels
BundlePort(AppID id, std::map< std::string, ChannelPort & > channels)
Construct a port.
Bundles represent a collection of channels.
A logical chunk of data representing serialized data.
A ChannelPort which reads data from the accelerator.
A ChannelPort which sends data to the accelerator.
A function call which gets attached to a service port.
WriteChannelPort & result
Callback(AcceleratorConnection &acc, AppID id, const std::map< std::string, ChannelPort & > &channels)
void connect(std::function< MessageData(const MessageData &)> callback, bool quick=false)
Connect a callback to code which will be executed when the accelerator invokes the callback.
AcceleratorConnection & acc
Service for servicing function calls from the accelerator.
CallService(AcceleratorConnection *acc, AppIDPath id, std::string implName, ServiceImplDetails details, HWClientDetails clients)
virtual std::string getServiceSymbol() const override
virtual ServicePort * getPort(AppIDPath id, const BundleType *type, const std::map< std::string, ChannelPort & > &, AcceleratorConnection &) const override
Get specialized port for this service to attach to the given appid path.
A service for which there are no standard services registered.
CustomService(AppIDPath idPath, const ServiceImplDetails &details, const HWClientDetails &clients)
virtual ~CustomService()=default
virtual std::string getServiceSymbol() const override
std::string serviceSymbol
A function call which gets attached to a service port.
std::future< MessageData > call(const MessageData &arg)
static Function * get(AppID id, WriteChannelPort &arg, ReadChannelPort &result)
Function(AppID id, const std::map< std::string, ChannelPort & > &channels)
Service for calling functions.
virtual std::string getServiceSymbol() const override
virtual ServicePort * getPort(AppIDPath id, const BundleType *type, const std::map< std::string, ChannelPort & > &, AcceleratorConnection &) const override
Get specialized port for this service to attach to the given appid path.
FuncService(AcceleratorConnection *acc, AppIDPath id, const std::string &implName, ServiceImplDetails details, HWClientDetails clients)
virtual ~HostMem()=default
virtual std::string getServiceSymbol() const override
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'.
virtual bool mapMemory(void *ptr, std::size_t size, Options opts) const
Try to make a region of host memory accessible to the accelerator.
Implement the SysInfo API for a standard MMIO protocol.
virtual std::vector< uint8_t > getCompressedManifest() const override
Return the zlib compressed JSON system manifest.
uint32_t getEsiVersion() const override
Get the ESI version number to check version compatibility.
MMIOSysInfo(const MMIO *)
virtual uint64_t read(uint32_t addr) const =0
virtual void write(uint32_t addr, uint64_t data)=0
virtual std::string getServiceSymbol() const override
Add a custom interface to a service client at a particular point in the design hierarchy.
virtual ~ServicePort()=default
Registry of services which can be instantiated directly by the Accelerator class if the backend doesn...
static Service::Type lookupServiceType(const std::string &)
Resolve a service type from a string.
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.
Parent class of all APIs modeled as 'services'.
virtual std::string getServiceSymbol() const =0
const std::type_info & Type
virtual ~Service()=default
virtual ServicePort * getPort(AppIDPath id, const BundleType *type, const std::map< std::string, ChannelPort & > &, AcceleratorConnection &) const
Get specialized port for this service to attach to the given appid path.
Information about the Accelerator system.
virtual std::string getJsonManifest() const
Return the JSON-formatted system manifest.
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
virtual ~SysInfo()=default
std::map< std::string, std::any > ServiceImplDetails
std::vector< HWClientDetail > HWClientDetails
RAII memory region for host memory.
virtual ~HostMemRegion()=default
virtual void * getPtr() const =0
virtual std::size_t getSize() const =0
Options for allocating host memory.