CIRCT 24.0.0git
Loading...
Searching...
No Matches
esi::services::HostMem Class Referenceabstract

#include <Services.h>

Inheritance diagram for esi::services::HostMem:
Collaboration diagram for esi::services::HostMem:

Public Types

using HostMemRegion = services::HostMemRegion
 RAII memory region for host memory. See services::HostMemRegion.
Public Types inherited from esi::services::Service
using Type = const std::type_info &

Public Member Functions

virtual ~HostMem ()=default
virtual std::string getServiceSymbol () const override
virtual void start ()
 In cases where necessary, enable host memory services.
virtual std::unique_ptr< HostMemRegion > allocate (std::size_t size, Options opts) const override=0
 Allocate a region of host memory in accelerator accessible address space.
virtual bool mapMemory (void *ptr, std::size_t size, Options opts) const
 Try to make a region of host memory accessible to the accelerator.
virtual void unmapMemory (void *ptr) const
 Unmap memory which was previously mapped with 'mapMemory'.
 Service (AcceleratorConnection &conn)
Public Member Functions inherited from esi::services::Service
 Service (AcceleratorConnection &conn)
virtual ~Service ()=default
virtual Service * getChildService (Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Create a "child" service of this service.
virtual BundlePort * getPort (AppIDPath id, const BundleType *type) const
 Get specialized port for this service to attach to the given appid path.
AcceleratorConnection & getConnection () const
Public Member Functions inherited from esi::services::HostMemAllocator
virtual ~HostMemAllocator ()=default

Static Public Attributes

static constexpr std::string_view StdName = "esi.service.std.hostmem"

Additional Inherited Members

Protected Attributes inherited from esi::services::Service
AcceleratorConnection & conn

Detailed Description

Definition at line 280 of file Services.h.

Member Typedef Documentation

◆ HostMemRegion

RAII memory region for host memory. See services::HostMemRegion.

Definition at line 289 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
overridepure virtual

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

Returns nullptr on failure, and always when size is 0.

Implements esi::services::HostMemAllocator.

Referenced by NB_MODULE().

◆ getServiceSymbol()

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

Implements esi::services::Service.

Definition at line 184 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.

Definition at line 304 of file Services.h.

Referenced by NB_MODULE().

◆ Service()

Definition at line 62 of file Services.h.

◆ start()

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

In cases where necessary, enable host memory services.

Definition at line 292 of file Services.h.

Referenced by aggregateHostmemBandwidthTest(), hostmemBandwidthTest(), hostmemTest(), and NB_MODULE().

◆ 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 309 of file Services.h.

Referenced by NB_MODULE().

Member Data Documentation

◆ StdName

std::string_view esi::services::HostMem::StdName = "esi.service.std.hostmem"
staticconstexpr

Definition at line 282 of file Services.h.

Referenced by esi::services::ServiceRegistry::lookupServiceType().


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