CIRCT  20.0.0git
Classes | Public Member Functions | List of all members
esi::services::HostMem Class Referenceabstract

#include <Services.h>

Inheritance diagram for esi::services::HostMem:
Inheritance graph
[legend]
Collaboration diagram for esi::services::HostMem:
Collaboration graph
[legend]

Classes

struct  HostMemRegion
 RAII memory region for host memory. More...
 
struct  Options
 Options for allocating host memory. More...
 

Public Member Functions

virtual ~HostMem ()=default
 
virtual std::string getServiceSymbol () const override
 
virtual void start ()
 In cases where necessary, enable host memory services. More...
 
virtual std::unique_ptr< HostMemRegionallocate (std::size_t size, Options opts) const =0
 Allocate a region of host memory in accelerator accessible address space. More...
 
virtual bool mapMemory (void *ptr, std::size_t size, Options opts) const
 Try to make a region of host memory accessible to the accelerator. More...
 
virtual void unmapMemory (void *ptr) const
 Unmap memory which was previously mapped with 'mapMemory'. More...
 
- Public Member Functions inherited from esi::services::Service
virtual ~Service ()=default
 
virtual ServicegetChildService (AcceleratorConnection *conn, Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Create a "child" service of this service. More...
 
virtual ServicePortgetPort (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. More...
 

Additional Inherited Members

- Public Types inherited from esi::services::Service
using Type = const std::type_info &
 

Detailed Description

Definition at line 194 of file Services.h.

Constructor & Destructor Documentation

◆ ~HostMem()

virtual esi::services::HostMem::~HostMem ( )
virtualdefault

Member Function Documentation

◆ allocate()

virtual std::unique_ptr<HostMemRegion> esi::services::HostMem::allocate ( std::size_t  size,
Options  opts 
) const
pure virtual

Allocate a region of host memory in accelerator accessible address space.

Implemented in TraceHostMem.

Referenced by PYBIND11_MODULE().

◆ getServiceSymbol()

std::string HostMem::getServiceSymbol ( ) const
overridevirtual

Implements esi::services::Service.

Definition at line 166 of file Services.cpp.

◆ mapMemory()

virtual bool esi::services::HostMem::mapMemory ( void *  ptr,
std::size_t  size,
Options  opts 
) const
inlinevirtual

Try to make a region of host memory accessible to the accelerator.

Returns 'false' on failure. It is optional for an accelerator backend to implement this, so client code needs to have a fallback for when this returns 'false'. On success, it is the client's responsibility to ensure that the memory eventually gets unmapped.

Reimplemented in TraceHostMem.

Definition at line 226 of file Services.h.

◆ start()

virtual void esi::services::HostMem::start ( )
inlinevirtual

In cases where necessary, enable host memory services.

Definition at line 215 of file Services.h.

Referenced by dmaTest().

◆ unmapMemory()

virtual void esi::services::HostMem::unmapMemory ( void *  ptr) const
inlinevirtual

Unmap memory which was previously mapped with 'mapMemory'.

Undefined behavior when called with a pointer which was not previously mapped.

Reimplemented in TraceHostMem.

Definition at line 231 of file Services.h.


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