OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
l0::L0Device Class Reference

#include <L0Mgr.h>

+ Collaboration diagram for l0::L0Device:

Public Member Functions

std::shared_ptr< L0CommandQueuecommand_queue () const
 
std::unique_ptr< L0CommandListcreate_command_list () const
 
std::shared_ptr< L0Modulecreate_module (uint8_t *code, size_t len, bool log=false) const
 

Private Attributes

L0Driver driver_
 
std::shared_ptr< L0CommandQueuecommand_queue_
 

Detailed Description

Definition at line 58 of file L0Mgr.h.

Member Function Documentation

std::shared_ptr< L0CommandQueue > l0::L0Device::command_queue ( ) const

Definition at line 142 of file L0Mgr.cpp.

142  {
143  return command_queue_;
144 }
std::shared_ptr< L0CommandQueue > command_queue_
Definition: L0Mgr.h:65
std::unique_ptr< L0CommandList > l0::L0Device::create_command_list ( ) const

Definition at line 146 of file L0Mgr.cpp.

References run_benchmark_import::res.

146  {
147  ze_command_list_desc_t desc = {
148  ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC,
149  nullptr,
150  0,
151  0 // flags
152  };
153  ze_command_list_handle_t res;
154  zeCommandListCreate(ctx(), device_, &desc, &res);
155  return std::make_unique<L0CommandList>(res);
156 }
std::shared_ptr< L0Module > l0::L0Device::create_module ( uint8_t *  code,
size_t  len,
bool  log = false 
) const

Definition at line 171 of file L0Mgr.cpp.

References L0_SAFE_CALL.

173  {
174  ze_module_desc_t desc{
175  .stype = ZE_STRUCTURE_TYPE_MODULE_DESC,
176  .pNext = nullptr,
177  .format = ZE_MODULE_FORMAT_IL_SPIRV,
178  .inputSize = len,
179  .pInputModule = code,
180  .pBuildFlags = "",
181  .pConstants = nullptr,
182  };
183  ze_module_handle_t handle;
184  ze_module_build_log_handle_t buildlog = nullptr;
185 
186  auto status = zeModuleCreate(ctx(), device_, &desc, &handle, &buildlog);
187  if (log) {
188  size_t logSize = 0;
189  L0_SAFE_CALL(zeModuleBuildLogGetString(buildlog, &logSize, nullptr));
190  std::vector<char> strLog(logSize);
191  L0_SAFE_CALL(zeModuleBuildLogGetString(buildlog, &logSize, strLog.data()));
192  std::fstream out;
193  out.open("log.txt", std::ios::app);
194  if (!out.good()) {
195  std::cerr << "Unable to open log file.\n";
196  } else {
197  out << std::string(strLog.begin(), strLog.end());
198  out.close();
199  }
200  }
201  if (status) {
202  throw l0::L0Exception(status);
203  }
204  return std::make_shared<L0Module>(handle);
205 }
#define L0_SAFE_CALL(call)
Definition: Utils.h:20

Member Data Documentation

std::shared_ptr<L0CommandQueue> l0::L0Device::command_queue_
private

Definition at line 65 of file L0Mgr.h.

L0Driver l0::L0Device::driver_
private

Definition at line 64 of file L0Mgr.h.


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