OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
l0::L0Manager Class Reference

#include <L0Mgr.h>

Public Member Functions

 L0Manager ()
 
void copyHostToDevice (int8_t *device_ptr, const int8_t *host_ptr, const size_t num_bytes, const int device_num)
 
void copyDeviceToHost (int8_t *host_ptr, const int8_t *device_ptr, const size_t num_bytes, const int device_num)
 
void copyDeviceToDevice (int8_t *dest_ptr, int8_t *src_ptr, const size_t num_bytes, const int dest_device_num, const int src_device_num)
 
int8_t * allocatePinnedHostMem (const size_t num_bytes)
 
int8_t * allocateDeviceMem (const size_t num_bytes, const int device_num)
 
void freePinnedHostMem (int8_t *host_ptr)
 
void freeDeviceMem (int8_t *device_ptr)
 
void zeroDeviceMem (int8_t *device_ptr, const size_t num_bytes, const int device_num)
 
void setDeviceMem (int8_t *device_ptr, const unsigned char uc, const size_t num_bytes, const int device_num)
 
void synchronizeDevices () const
 
const std::vector
< std::shared_ptr< L0Driver > > & 
drivers () const
 

Private Attributes

std::vector< std::shared_ptr
< L0Driver > > 
drivers_
 

Detailed Description

Definition at line 177 of file L0Mgr.h.

Constructor & Destructor Documentation

l0::L0Manager::L0Manager ( )

Definition at line 207 of file L0Mgr.cpp.

207 : drivers_(get_drivers()) {}
std::vector< std::shared_ptr< L0Driver > > get_drivers()
Definition: L0Mgr.cpp:67
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210

Member Function Documentation

int8_t * l0::L0Manager::allocateDeviceMem ( const size_t  num_bytes,
const int  device_num 
)

Definition at line 213 of file L0Mgr.cpp.

References l0::allocate_device_mem(), and drivers_.

213  {
214  auto& device = drivers_[0]->devices()[device_id];
215  return (int8_t*)allocate_device_mem(num_bytes, *device);
216 }
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210
void * allocate_device_mem(const size_t num_bytes, L0Device &device)
Definition: L0Mgr.cpp:105

+ Here is the call graph for this function:

int8_t * l0::L0Manager::allocatePinnedHostMem ( const size_t  num_bytes)

Definition at line 298 of file L0Mgr.cpp.

References CHECK.

298  {
299  CHECK(false);
300  return nullptr;
301 }
#define CHECK(condition)
Definition: Logger.h:291
void l0::L0Manager::copyDeviceToDevice ( int8_t *  dest_ptr,
int8_t *  src_ptr,
const size_t  num_bytes,
const int  dest_device_num,
const int  src_device_num 
)

Definition at line 290 of file L0Mgr.cpp.

References CHECK.

294  {
295  CHECK(false);
296 }
#define CHECK(condition)
Definition: Logger.h:291
void l0::L0Manager::copyDeviceToHost ( int8_t *  host_ptr,
const int8_t *  device_ptr,
const size_t  num_bytes,
const int  device_num 
)

Definition at line 278 of file L0Mgr.cpp.

References drivers_.

281  {
282  auto& device = drivers_[0]->devices()[device_num];
283  auto cl = device->create_command_list();
284  auto queue = device->command_queue();
285 
286  cl->copy(host_ptr, device_ptr, num_bytes);
287  cl->submit(*queue);
288 }
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210
void l0::L0Manager::copyHostToDevice ( int8_t *  device_ptr,
const int8_t *  host_ptr,
const size_t  num_bytes,
const int  device_num 
)

Definition at line 266 of file L0Mgr.cpp.

References drivers().

269  {
270  auto& device = drivers()[0]->devices()[device_num];
271  auto cl = device->create_command_list();
272  auto queue = device->command_queue();
273 
274  cl->copy(device_ptr, host_ptr, num_bytes);
275  cl->submit(*queue);
276 }
const std::vector< std::shared_ptr< L0Driver > > & drivers() const
Definition: L0Mgr.cpp:209

+ Here is the call graph for this function:

const std::vector< std::shared_ptr< L0Driver > > & l0::L0Manager::drivers ( ) const

Definition at line 209 of file L0Mgr.cpp.

References drivers_.

Referenced by copyHostToDevice().

209  {
210  return drivers_;
211 }
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210

+ Here is the caller graph for this function:

void l0::L0Manager::freeDeviceMem ( int8_t *  device_ptr)

Definition at line 307 of file L0Mgr.cpp.

References drivers_, and L0_SAFE_CALL.

307  {
308  auto ctx = drivers_[0]->ctx();
309  L0_SAFE_CALL(zeMemFree(ctx, device_ptr));
310 }
#define L0_SAFE_CALL(call)
Definition: Utils.h:20
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210
void l0::L0Manager::freePinnedHostMem ( int8_t *  host_ptr)

Definition at line 303 of file L0Mgr.cpp.

References CHECK.

303  {
304  CHECK(false);
305 }
#define CHECK(condition)
Definition: Logger.h:291
void l0::L0Manager::setDeviceMem ( int8_t *  device_ptr,
const unsigned char  uc,
const size_t  num_bytes,
const int  device_num 
)

Definition at line 317 of file L0Mgr.cpp.

References drivers_, and L0_SAFE_CALL.

Referenced by zeroDeviceMem().

320  {
321  auto& device = drivers_[0]->devices()[device_num];
322  auto cl = device->create_command_list();
323  L0_SAFE_CALL(zeCommandListAppendMemoryFill(
324  cl->handle(), device_ptr, &uc, 1, num_bytes, nullptr, 0, nullptr));
325  cl->submit(*device->command_queue());
326 }
#define L0_SAFE_CALL(call)
Definition: Utils.h:20
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210

+ Here is the caller graph for this function:

void l0::L0Manager::synchronizeDevices ( ) const

Definition at line 328 of file L0Mgr.cpp.

References drivers_, and L0_SAFE_CALL.

328  {
329  for (auto& device : drivers_[0]->devices()) {
330  L0_SAFE_CALL(zeCommandQueueSynchronize(device->command_queue()->handle(),
331  std::numeric_limits<uint32_t>::max()));
332  }
333 }
#define L0_SAFE_CALL(call)
Definition: Utils.h:20
std::vector< std::shared_ptr< L0Driver > > drivers_
Definition: L0Mgr.h:210
void l0::L0Manager::zeroDeviceMem ( int8_t *  device_ptr,
const size_t  num_bytes,
const int  device_num 
)

Definition at line 312 of file L0Mgr.cpp.

References setDeviceMem().

314  {
315  setDeviceMem(device_ptr, 0, num_bytes, device_num);
316 }
void setDeviceMem(int8_t *device_ptr, const unsigned char uc, const size_t num_bytes, const int device_num)
Definition: L0Mgr.cpp:317

+ Here is the call graph for this function:

Member Data Documentation

std::vector<std::shared_ptr<L0Driver> > l0::L0Manager::drivers_
private

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