CIRCT  20.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
esi::ChannelPort Class Referenceabstract

Unidirectional channels are the basic communication primitive between the host and accelerator. More...

#include <Ports.h>

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

Public Member Functions

 ChannelPort (const Type *type)
 
virtual ~ChannelPort ()
 
virtual void connect (std::optional< unsigned > bufferSize=std::nullopt)=0
 Set up a connection to the accelerator. More...
 
virtual void disconnect ()=0
 
virtual bool isConnected () const =0
 
bool poll ()
 Poll for incoming data. More...
 
const TypegetType () const
 

Protected Member Functions

virtual bool pollImpl ()
 Method called by poll() to actually poll the channel if the channel is connected. More...
 
virtual void connectImpl (std::optional< unsigned > bufferSize)
 Called by all connect methods to let backends initiate the underlying connections. More...
 

Protected Attributes

const Typetype
 

Detailed Description

Unidirectional channels are the basic communication primitive between the host and accelerator.

A 'ChannelPort' is the host side of a channel. It can be either read or write but not both. At this level, channels are untyped – just streams of bytes. They are not intended to be used directly by users but used by higher level APIs which add types.

Definition at line 33 of file Ports.h.

Constructor & Destructor Documentation

◆ ChannelPort()

esi::ChannelPort::ChannelPort ( const Type type)
inline

Definition at line 35 of file Ports.h.

◆ ~ChannelPort()

virtual esi::ChannelPort::~ChannelPort ( )
inlinevirtual

Definition at line 36 of file Ports.h.

Member Function Documentation

◆ connect()

virtual void esi::ChannelPort::connect ( std::optional< unsigned >  bufferSize = std::nullopt)
pure virtual

Set up a connection to the accelerator.

The buffer size is optional and should be considered merely a hint. Individual implementations use it however they like. The unit is number of messages of the port type.

Implemented in esi::ReadChannelPort, and esi::WriteChannelPort.

Referenced by PYBIND11_MODULE().

◆ connectImpl()

virtual void esi::ChannelPort::connectImpl ( std::optional< unsigned >  bufferSize)
inlineprotectedvirtual

Called by all connect methods to let backends initiate the underlying connections.

Definition at line 70 of file Ports.h.

Referenced by esi::ReadChannelPort::connect(), and esi::WriteChannelPort::connect().

◆ disconnect()

virtual void esi::ChannelPort::disconnect ( )
pure virtual

Implemented in esi::ReadChannelPort, and esi::WriteChannelPort.

Referenced by PYBIND11_MODULE().

◆ getType()

const Type* esi::ChannelPort::getType ( ) const
inline

◆ isConnected()

virtual bool esi::ChannelPort::isConnected ( ) const
pure virtual

Implemented in esi::ReadChannelPort, and esi::WriteChannelPort.

Referenced by poll().

◆ poll()

bool esi::ChannelPort::poll ( )
inline

Poll for incoming data.

Returns true if data was read or written into a buffer as a result of the poll. Calling the call back could (will) also happen in that case. Some backends need this to be called periodically. In the usual case, this will be called by a background thread, but the ESI runtime does not want to assume that the host processes use standard threads. If the user wants to provide their own threads, they need to call this on each port occasionally. This is also called from the 'master' poll method in the Accelerator class.

Definition at line 53 of file Ports.h.

References isConnected(), and pollImpl().

◆ pollImpl()

virtual bool esi::ChannelPort::pollImpl ( )
inlineprotectedvirtual

Method called by poll() to actually poll the channel if the channel is connected.

Definition at line 66 of file Ports.h.

Referenced by poll().

Member Data Documentation

◆ type

const Type* esi::ChannelPort::type
protected

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