CIRCT  19.0.0git
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
esi::AcceleratorConnection Class Referenceabstract

Abstract class representing a connection to an accelerator. More...

#include <Accelerator.h>

Inheritance diagram for esi::AcceleratorConnection:
Inheritance graph
[legend]
Collaboration diagram for esi::AcceleratorConnection:
Collaboration graph
[legend]

Public Types

using Service = services::Service
 

Public Member Functions

 AcceleratorConnection (Context &ctxt)
 
virtual ~AcceleratorConnection ()=default
 
ContextgetCtxt () const
 
virtual std::map< std::string, ChannelPort & > requestChannelsFor (AppIDPath, const BundleType *)=0
 Request the host side channel ports for a particular instance (identified by the AppID path). More...
 
template<typename ServiceClass >
ServiceClass * getService (AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Get a typed reference to a particular service type. More...
 
virtual ServicegetService (Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Calls createService and caches the result. More...
 

Protected Member Functions

virtual ServicecreateService (Service::Type service, AppIDPath idPath, std::string implName, const ServiceImplDetails &details, const HWClientDetails &clients)=0
 Called by getServiceImpl exclusively. More...
 

Private Types

using ServiceCacheKey = std::tuple< const std::type_info *, AppIDPath >
 Cache services via a unique_ptr so they get free'd automatically when Accelerator objects get deconstructed. More...
 

Private Attributes

std::map< ServiceCacheKey, std::unique_ptr< Service > > serviceCache
 
Contextctxt
 ESI accelerator context. More...
 

Detailed Description

Abstract class representing a connection to an accelerator.

Actual connections (e.g. to a co-simulation or actual device) are implemented by subclasses.

Definition at line 75 of file Accelerator.h.

Member Typedef Documentation

◆ Service

Definition at line 87 of file Accelerator.h.

◆ ServiceCacheKey

using esi::AcceleratorConnection::ServiceCacheKey = std::tuple<const std::type_info *, AppIDPath>
private

Cache services via a unique_ptr so they get free'd automatically when Accelerator objects get deconstructed.

Definition at line 117 of file Accelerator.h.

Constructor & Destructor Documentation

◆ AcceleratorConnection()

esi::AcceleratorConnection::AcceleratorConnection ( Context ctxt)
inline

Definition at line 77 of file Accelerator.h.

◆ ~AcceleratorConnection()

virtual esi::AcceleratorConnection::~AcceleratorConnection ( )
virtualdefault

Member Function Documentation

◆ createService()

virtual Service* esi::AcceleratorConnection::createService ( Service::Type  service,
AppIDPath  idPath,
std::string  implName,
const ServiceImplDetails details,
const HWClientDetails clients 
)
protectedpure virtual

Called by getServiceImpl exclusively.

It wraps the pointer returned by this in a unique_ptr and caches it. Separate this from the wrapping/caching since wrapping/caching is an implementation detail.

Implemented in esi::backends::xrt::XrtAccelerator, and esi::backends::trace::TraceAccelerator.

◆ getCtxt()

Context& esi::AcceleratorConnection::getCtxt ( ) const
inline

Definition at line 80 of file Accelerator.h.

References ctxt.

Referenced by printHier(), and printInfo().

◆ getService() [1/2]

template<typename ServiceClass >
ServiceClass* esi::AcceleratorConnection::getService ( AppIDPath  id = {},
std::string  implName = {},
ServiceImplDetails  details = {},
HWClientDetails  clients = {} 
)
inline

Get a typed reference to a particular service type.

Caller does not take ownership of the returned pointer – the Accelerator object owns it. Pointer lifetime ends with the Accelerator lifetime.

Definition at line 92 of file Accelerator.h.

Referenced by esi::Manifest::Impl::getService(), printHier(), printInfo(), PYBIND11_MODULE(), and esi::Manifest::Impl::scanServiceDecls().

◆ getService() [2/2]

services::Service * esi::AcceleratorConnection::getService ( Service::Type  service,
AppIDPath  id = {},
std::string  implName = {},
ServiceImplDetails  details = {},
HWClientDetails  clients = {} 
)
virtual

Calls createService and caches the result.

Subclasses can override if they want to use their own caching mechanism.

Definition at line 27 of file Accelerator.cpp.

◆ requestChannelsFor()

virtual std::map<std::string, ChannelPort &> esi::AcceleratorConnection::requestChannelsFor ( AppIDPath  ,
const BundleType  
)
pure virtual

Request the host side channel ports for a particular instance (identified by the AppID path).

For convenience, provide the bundle type.

Implemented in esi::backends::xrt::XrtAccelerator, and esi::backends::trace::TraceAccelerator.

Referenced by esi::Manifest::Impl::getBundlePorts().

Member Data Documentation

◆ ctxt

Context& esi::AcceleratorConnection::ctxt
private

ESI accelerator context.

Definition at line 121 of file Accelerator.h.

Referenced by getCtxt().

◆ serviceCache

std::map<ServiceCacheKey, std::unique_ptr<Service> > esi::AcceleratorConnection::serviceCache
private

Definition at line 118 of file Accelerator.h.


The documentation for this class was generated from the following files: