DPC++ Runtime
Runtime libraries for oneAPI DPC++
pi_esimd_emulator.cpp
Go to the documentation of this file.
1 //===---------- pi_esimd_emulator.cpp - CM Emulation Plugin ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
14 
15 #include <stdint.h>
16 
17 #include <detail/accessor_impl.hpp>
18 #include <sycl/backend_types.hpp>
19 #include <sycl/detail/common.hpp>
20 #include <sycl/detail/export.hpp>
21 #include <sycl/detail/helpers.hpp>
25 #include <sycl/ext/intel/esimd/common.hpp> // SLM_BTI
26 #include <sycl/group.hpp>
27 #include <sycl/id.hpp>
28 #include <sycl/kernel.hpp>
29 #include <sycl/nd_item.hpp>
30 #include <sycl/range.hpp>
31 
32 #include <esimdemu_support.h>
33 
34 #include <cstdarg>
35 #include <cstdio>
36 #include <cstring>
37 #include <functional>
38 #include <iostream>
39 #include <map>
40 #include <memory>
41 #include <string>
42 #include <thread>
43 #include <utility>
44 
45 #include "pi_esimd_emulator.hpp"
46 
47 #define ARG_UNUSED(x) (void)x
48 
49 namespace {
50 
51 // Helper functions for unified 'Return' type declaration - imported
52 // from pi_level_zero.cpp
53 template <typename T, typename Assign>
54 pi_result getInfoImpl(size_t ParamValueSize, void *ParamValue,
55  size_t *ParamValueSizeRet, T Value, size_t ValueSize,
56  Assign &&AssignFunc) {
57  if (ParamValue != nullptr) {
58  if (ParamValueSize < ValueSize) {
59  return PI_ERROR_INVALID_VALUE;
60  }
61  AssignFunc(ParamValue, Value, ValueSize);
62  }
63  if (ParamValueSizeRet != nullptr) {
64  *ParamValueSizeRet = ValueSize;
65  }
66  return PI_SUCCESS;
67 }
68 
69 template <typename T>
70 pi_result getInfo(size_t ParamValueSize, void *ParamValue,
71  size_t *ParamValueSizeRet, T Value) {
72  auto assignment = [](void *ParamValue, T Value, size_t ValueSize) {
73  ARG_UNUSED(ValueSize);
74  *static_cast<T *>(ParamValue) = Value;
75  };
76  return getInfoImpl(ParamValueSize, ParamValue, ParamValueSizeRet, Value,
77  sizeof(T), assignment);
78 }
79 
80 template <typename T>
81 pi_result getInfoArray(size_t ArrayLength, size_t ParamValueSize,
82  void *ParamValue, size_t *ParamValueSizeRet, T *Value) {
83  return getInfoImpl(ParamValueSize, ParamValue, ParamValueSizeRet, Value,
84  ArrayLength * sizeof(T), memcpy);
85 }
86 
87 template <>
88 pi_result getInfo<const char *>(size_t ParamValueSize, void *ParamValue,
89  size_t *ParamValueSizeRet, const char *Value) {
90  return getInfoArray(strlen(Value) + 1, ParamValueSize, ParamValue,
91  ParamValueSizeRet, Value);
92 }
93 
94 class ReturnHelper {
95 public:
96  ReturnHelper(size_t ArgParamValueSize, void *ArgParamValue,
97  size_t *ArgParamValueSizeRet)
98  : ParamValueSize(ArgParamValueSize), ParamValue(ArgParamValue),
99  ParamValueSizeRet(ArgParamValueSizeRet) {}
100 
101  template <class T> pi_result operator()(const T &t) {
102  return getInfo(ParamValueSize, ParamValue, ParamValueSizeRet, t);
103  }
104 
105 private:
106  size_t ParamValueSize;
107  void *ParamValue;
108  size_t *ParamValueSizeRet;
109 };
110 
111 } // anonymous namespace
112 
113 // Controls PI level tracing prints.
114 static bool PrintPiTrace = false;
115 
116 static void PiTrace(std::string TraceString) {
117  if (PrintPiTrace) {
118  std::cout << TraceString << std::endl;
119  }
120 }
121 
122 // Global variables used in PI_esimd_emulator
123 // Note we only create a simple pointer variables such that C++ RT won't
124 // deallocate them automatically at the end of the main program.
125 // The heap memory allocated for this global variable reclaimed only when
126 // Sycl RT calls piTearDown().
127 static sycl::detail::ESIMDEmuPluginOpaqueData *PiESimdDeviceAccess;
128 
129 // Single-entry cache for piPlatformsGet call.
131 // TODO/FIXME : Memory leak. Handle with 'piTearDown'.
132 static std::mutex *PiPlatformCacheLock = new std::mutex;
133 
134 // Mapping between surface index and CM-managed surface
135 static std::unordered_map<unsigned int, _pi_mem *> *PiESimdSurfaceMap =
136  new std::unordered_map<unsigned int, _pi_mem *>;
137 // TODO/FIXME : Memory leak. Handle with 'piTearDown'.
138 static std::mutex *PiESimdSurfaceMapLock = new std::mutex;
139 
140 // To be compared with ESIMD_EMULATOR_PLUGIN_OPAQUE_DATA_VERSION in device
141 // interface header file
142 #define ESIMDEmuPluginDataVersion 0
143 
144 // To be compared with ESIMD_DEVICE_INTERFACE_VERSION in device
145 // interface header file
146 #define ESIMDEmuPluginInterfaceVersion 1
147 
148 // For PI_DEVICE_INFO_DRIVER_VERSION info
149 static char ESimdEmuVersionString[32];
150 
151 // Global variables for PI_ERROR_PLUGIN_SPECIFIC_ERROR
152 constexpr size_t MaxMessageSize = 256;
153 thread_local pi_result ErrorMessageCode = PI_SUCCESS;
154 thread_local char ErrorMessage[MaxMessageSize];
155 
156 // Utility function for setting a message and warning
157 [[maybe_unused]] static void setErrorMessage(const char *message,
158  pi_result error_code) {
159  assert(strlen(message) <= MaxMessageSize);
160  strcpy(ErrorMessage, message);
161  ErrorMessageCode = error_code;
162 }
163 
164 // Returns plugin specific error and warning messages
166  *message = &ErrorMessage[0];
167  return ErrorMessageCode;
168 }
169 
170 using IDBuilder = sycl::detail::Builder;
171 
172 template <int NDims>
173 using KernelFunc = std::function<void(const sycl::nd_item<NDims> &)>;
174 
175 // Struct to wrap dimension info and lambda function to be invoked by
176 // CM Kernel launcher that only accepts raw function pointer for
177 // kernel execution. Function instances of 'InvokeKernel' un-wrap
178 // this struct instance and invoke lambda function ('Func')
179 template <int NDims> struct KernelInvocationContext {
181  const sycl::range<NDims> &LocalSize;
182  const sycl::range<NDims> &GlobalSize;
183  const sycl::id<NDims> &GlobalOffset;
184 };
185 
186 // A helper structure to create multi-dimensional range when
187 // dimensionality is given as a template parameter. `create` function
188 // in specializations accepts a template `Gen` function which
189 // generates range extent for a dimension given as an argument.
190 template <int NDims> struct RangeBuilder;
191 
192 template <> struct RangeBuilder<1> {
193  template <typename Gen> static sycl::range<1> create(Gen G) {
194  return sycl::range<1>{G(0)};
195  }
196 };
197 template <> struct RangeBuilder<2> {
198  template <typename Gen> static sycl::range<2> create(Gen G) {
199  return sycl::range<2>{G(0), G(1)};
200  }
201 };
202 template <> struct RangeBuilder<3> {
203  template <typename Gen> static sycl::range<3> create(Gen G) {
204  return sycl::range<3>{G(0), G(1), G(2)};
205  }
206 };
207 
208 // Function template to generate entry point of kernel execution as
209 // raw function pointer. CM kernel launcher executes one instance of
210 // this function per 'NDims'
211 template <int NDims> void InvokeKernel(KernelInvocationContext<NDims> *ctx) {
212 
213  sycl::range<NDims> GroupSize{
214  sycl::detail::InitializedVal<NDims, sycl::range>::template get<0>()};
215 
216  for (int i = 0; i < NDims; ++i) {
217  GroupSize[i] = ctx->GlobalSize[i] / ctx->LocalSize[i];
218  }
219 
220  const sycl::id<NDims> LocalID = RangeBuilder<NDims>::create(
221  [](int i) { return cm_support::get_thread_idx(i); });
222 
223  const sycl::id<NDims> GroupID = RangeBuilder<NDims>::create(
224  [](int i) { return cm_support::get_group_idx(i); });
225 
226  const sycl::group<NDims> Group = IDBuilder::createGroup<NDims>(
227  ctx->GlobalSize, ctx->LocalSize, GroupSize, GroupID);
228 
229  const sycl::id<NDims> GlobalID =
230  GroupID * ctx->LocalSize + LocalID + ctx->GlobalOffset;
231 
232  const sycl::item<NDims, /*Offset=*/true> GlobalItem =
233  IDBuilder::createItem<NDims, true>(ctx->GlobalSize, GlobalID,
234  ctx->GlobalOffset);
235 
236  const sycl::item<NDims, /*Offset=*/false> LocalItem =
237  IDBuilder::createItem<NDims, false>(ctx->LocalSize, LocalID);
238 
239  const sycl::nd_item<NDims> NDItem =
240  IDBuilder::createNDItem<NDims>(GlobalItem, LocalItem, Group);
241 
242  ctx->Func(NDItem);
243 }
244 
245 // Interface for lauching kernels using libcm from CM EMU project.
246 template <int DIMS> class libCMBatch {
247 private:
248  const KernelFunc<DIMS> &MKernel;
249  std::vector<uint32_t> GroupDim, SpaceDim;
250 
251 public:
253  : MKernel(Kernel), GroupDim{1, 1, 1}, SpaceDim{1, 1, 1} {}
254 
255  void runIterationSpace(const sycl::range<DIMS> &LocalSize,
256  const sycl::range<DIMS> &GlobalSize,
257  const sycl::id<DIMS> &GlobalOffset) {
258 
259  for (int I = 0; I < DIMS; I++) {
260  SpaceDim[I] = (uint32_t)LocalSize[I];
261  GroupDim[I] = (uint32_t)(GlobalSize[I] / LocalSize[I]);
262  }
263 
264  const auto InvokeKernelArg = KernelInvocationContext<DIMS>{
265  MKernel, LocalSize, GlobalSize, GlobalOffset};
266 
267  EsimdemuKernel{reinterpret_cast<fptrVoid>(InvokeKernel<DIMS>),
268  GroupDim.data(), SpaceDim.data()}
269  .launchMT(sizeof(InvokeKernelArg), &InvokeKernelArg);
270  }
271 };
272 
273 unsigned int sycl_get_cm_surface_index(void *PtrInput) {
274  _pi_mem *Surface = static_cast<_pi_mem *>(PtrInput);
275 
276  return Surface->SurfaceIndex;
277 }
278 
279 // Function to provide image info for kernel compilation using surface
280 // index without dependency on '_pi_image' definition
281 void sycl_get_cm_buffer_params(unsigned int IndexInput, char **BaseAddr,
282  uint32_t *Width, std::mutex **BufMtxLock) {
283  std::lock_guard<std::mutex> Lock{*PiESimdSurfaceMapLock};
284  auto MemIter = PiESimdSurfaceMap->find(IndexInput);
285 
286  assert(MemIter != PiESimdSurfaceMap->end() && "Invalid Surface Index");
287 
288  _pi_buffer *Buf = static_cast<_pi_buffer *>(MemIter->second);
289 
290  *BaseAddr = Buf->MapHostPtr;
291  *Width = static_cast<uint32_t>(Buf->Size);
292 
293  *BufMtxLock = &(Buf->SurfaceLock);
294 }
295 
296 // Function to provide image info for kernel compilation using surface
297 // index without dependency on '_pi_image' definition
298 void sycl_get_cm_image_params(unsigned int IndexInput, char **BaseAddr,
299  uint32_t *Width, uint32_t *Height, uint32_t *Bpp,
300  std::mutex **ImgMtxLock) {
301  std::lock_guard<std::mutex> Lock{*PiESimdSurfaceMapLock};
302  auto MemIter = PiESimdSurfaceMap->find(IndexInput);
303  assert(MemIter != PiESimdSurfaceMap->end() && "Invalid Surface Index");
304 
305  _pi_image *Img = static_cast<_pi_image *>(MemIter->second);
306 
307  *BaseAddr = Img->MapHostPtr;
308 
309  *Bpp = static_cast<uint32_t>(Img->BytesPerPixel);
310  *Width = static_cast<uint32_t>(Img->Width) * (*Bpp);
311  *Height = static_cast<uint32_t>(Img->Height);
312 
313  *ImgMtxLock = &(Img->SurfaceLock);
314 }
315 
318 sycl::detail::ESIMDDeviceInterface::ESIMDDeviceInterface() {
320  reserved = nullptr;
321 
322  /* From 'esimd_emulator_functions_v1.h' : Start */
323  cm_barrier_ptr = cm_support::barrier;
324  cm_sbarrier_ptr = cm_support::split_barrier;
325  cm_fence_ptr = cm_support::fence;
326 
327  sycl_get_surface_base_addr_ptr = cm_support::get_surface_base_addr;
328  __cm_emu_get_slm_ptr = cm_support::get_slm_base;
329  cm_slm_init_ptr = cm_support::init_slm;
330 
331  sycl_get_cm_surface_index_ptr = sycl_get_cm_surface_index;
332  sycl_get_cm_buffer_params_ptr = sycl_get_cm_buffer_params;
333  sycl_get_cm_image_params_ptr = sycl_get_cm_image_params;
334 
335  /* From 'esimd_emulator_functions_v1.h' : End */
336 }
337 
340 
341 static bool isNull(int NDims, const size_t *R) {
342  return ((0 == R[0]) && (NDims < 2 || 0 == R[1]) && (NDims < 3 || 0 == R[2]));
343 }
344 
345 // NDims is the number of dimensions in the ND-range. Kernels are
346 // normalized in the handler so that all kernels take an sycl::nd_item
347 // as argument (see StoreLambda in sycl/handler.hpp). For kernels
348 // whose workgroup size (LocalWorkSize) is unspecified, InvokeImpl
349 // sets LocalWorkSize to {1, 1, 1}, i.e. each workgroup contains just
350 // one work item. CM emulator will run several workgroups in parallel
351 // depending on environment settings.
352 
353 template <int NDims> struct InvokeImpl {
354 
355  static sycl::range<NDims> get_range(const size_t *Array) {
356  if constexpr (NDims == 1)
357  return sycl::range<NDims>{Array[0]};
358  else if constexpr (NDims == 2)
359  return sycl::range<NDims>{Array[0], Array[1]};
360  else if constexpr (NDims == 3)
361  return sycl::range<NDims>{Array[0], Array[1], Array[2]};
362  }
363 
364  static void invoke(pi_kernel Kernel, const size_t *GlobalWorkOffset,
365  const size_t *GlobalWorkSize,
366  const size_t *LocalWorkSize) {
367  libCMBatch<NDims>{*reinterpret_cast<KernelFunc<NDims> *>(Kernel)}
368  .runIterationSpace(get_range(LocalWorkSize), get_range(GlobalWorkSize),
369  sycl::id<NDims>{get_range(GlobalWorkOffset)});
370  }
371 };
372 
373 extern "C" {
374 
375 #define DIE_NO_IMPLEMENTATION \
376  if (PrintPiTrace) { \
377  std::cerr << "Not Implemented : " << __FUNCTION__ \
378  << " - File : " << __FILE__; \
379  std::cerr << " / Line : " << __LINE__ << std::endl; \
380  } \
381  return PI_ERROR_INVALID_OPERATION;
382 
383 #define CONTINUE_NO_IMPLEMENTATION \
384  if (PrintPiTrace) { \
385  std::cerr << "Warning : Not Implemented : " << __FUNCTION__ \
386  << " - File : " << __FILE__; \
387  std::cerr << " / Line : " << __LINE__ << std::endl; \
388  } \
389  return PI_SUCCESS;
390 
391 #define CASE_PI_UNSUPPORTED(not_supported) \
392  case not_supported: \
393  if (PrintPiTrace) { \
394  std::cerr << std::endl \
395  << "Unsupported PI case : " << #not_supported << " in " \
396  << __FUNCTION__ << ":" << __LINE__ << "(" << __FILE__ << ")" \
397  << std::endl; \
398  } \
399  return PI_ERROR_INVALID_OPERATION;
400 
402  pi_uint32 *NumPlatforms) {
403  static bool PiPlatformCachePopulated = false;
404  static const char *PiTraceEnv = std::getenv("SYCL_PI_TRACE");
405  static const int PiTraceValue = PiTraceEnv ? std::stoi(PiTraceEnv) : 0;
406 
407  if (PiTraceValue == -1) { // Means print all PI traces
408  PrintPiTrace = true;
409  }
410 
411  if (NumPlatforms) {
412  *NumPlatforms = 1;
413  }
414 
415  if (NumEntries == 0) {
417  if (Platforms != nullptr) {
418  PiTrace("Invalid Arguments for piPlatformsGet of "
419  "esimd_emulator (Platforms!=nullptr) "
420  "while querying number of platforms");
421  return PI_ERROR_INVALID_VALUE;
422  }
423  return PI_SUCCESS;
424  }
425 
426  if (Platforms == nullptr && NumPlatforms == nullptr) {
427  return PI_ERROR_INVALID_VALUE;
428  }
429 
430  std::lock_guard<std::mutex> Lock{*PiPlatformCacheLock};
433  PiPlatformCache->CmEmuVersion = std::string("0.0.1");
435  }
436 
437  if (Platforms && NumEntries > 0) {
438  *Platforms = PiPlatformCache;
439  }
440 
441  return PI_SUCCESS;
442 }
443 
445  size_t ParamValueSize, void *ParamValue,
446  size_t *ParamValueSizeRet) {
447  if (Platform == nullptr) {
448  return PI_ERROR_INVALID_PLATFORM;
449  }
450  ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet);
451 
452  switch (ParamName) {
454  return ReturnValue("Intel(R) ESIMD_EMULATOR/GPU");
455 
457  return ReturnValue("Intel(R) Corporation");
458 
460  return ReturnValue(Platform->CmEmuVersion.c_str());
461 
463  return ReturnValue("FULL_PROFILE");
464 
466  return ReturnValue("");
467 
468  default:
469  // TODO: implement other parameters
470  die("Unsupported ParamName in piPlatformGetInfo");
471  }
472 
473  return PI_SUCCESS;
474 }
475 
478 }
479 
482 }
483 
485  pi_uint32 NumEntries, pi_device *Devices,
486  pi_uint32 *NumDevices) {
487  if (Platform == nullptr) {
488  return PI_ERROR_INVALID_PLATFORM;
489  }
490 
491  pi_result Res = Platform->populateDeviceCacheIfNeeded();
492  if (Res != PI_SUCCESS) {
493  return Res;
494  }
495 
496  // CM has single-root-GPU-device without sub-device support.
497  pi_uint32 DeviceCount = (DeviceType & PI_DEVICE_TYPE_GPU) ? 1 : 0;
498 
499  if (NumDevices) {
500  *NumDevices = DeviceCount;
501  }
502 
503  if (NumEntries == 0) {
505  if (Devices != nullptr) {
506  PiTrace("Invalid Arguments for piDevicesGet of esimd_emultor "
507  "(Devices!=nullptr) while querying number of platforms");
508  return PI_ERROR_INVALID_VALUE;
509  }
510  return PI_SUCCESS;
511  }
512 
513  if (DeviceCount == 0) {
515  return PI_SUCCESS;
516  }
517 
518  if (Devices) {
519  *Devices = Platform->PiDeviceCache.get();
520  }
521  return PI_SUCCESS;
522 }
523 
524 // Check the device cache and load it if necessary.
526  std::lock_guard<std::mutex> Lock(PiDeviceCacheMutex);
527 
528  if (DeviceCachePopulated) {
529  return PI_SUCCESS;
530  }
531  cm_support::CmDevice *CmDevice = nullptr;
532  // TODO FIXME Implement proper version checking and reporting:
533  // - version passed to cm_support::CreateCmDevice
534  // - CmEmuVersion
535  // - PluginVersion
536  // - ESIMDEmuPluginOpaqueData::version
537  //
538  // PI_DEVICE_INFO_DRIVER_VERSION could report the ESIMDDeviceInterface
539  // version, PI_PLATFORM_INFO_VERSION - the underlying libCM library version.
540  unsigned int Version = 0;
541 
542  int Result = cm_support::CreateCmDevice(CmDevice, Version);
543 
544  if (Result != cm_support::CM_SUCCESS) {
545  return PI_ERROR_INVALID_DEVICE;
546  }
547 
548  // CM Device version info consists of two decimal numbers - major
549  // and minor. Minor is single-digit. Version info is encoded into a
550  // unsigned integer value = 100 * major + minor. Second from right
551  // digit in decimal must be zero as it is used as 'dot'
552  // REF - $CM_EMU/common/cm_version_defs.h - 'CURRENT_CM_VERSION'
553  // e.g. CM version 7.3 => Device version = 703
554 
555  if (((Version / 10) % 10) != 0) {
556  PiTrace("Invalid Arguments for piPlatformsGet of "
557  "esimd_emulator (Platforms!=nullptr) "
558  "while querying number of platforms");
559  return PI_ERROR_INVALID_DEVICE;
560  }
561 
562  std::ostringstream StrFormat;
563  StrFormat << (int)(Version / 100) << "." << (int)(Version % 10);
564 
565  std::unique_ptr<_pi_device> Device(
566  new _pi_device(this, CmDevice, StrFormat.str()));
567  PiDeviceCache = std::move(Device);
568  DeviceCachePopulated = true;
569  return PI_SUCCESS;
570 }
571 
573  if (Device == nullptr) {
574  return PI_ERROR_INVALID_DEVICE;
575  }
576 
577  // CM supports only single device, which is root-device. 'Retain' is
578  // No-op.
579  return PI_SUCCESS;
580 }
581 
583  if (Device == nullptr) {
584  return PI_ERROR_INVALID_DEVICE;
585  }
586 
587  // CM supports only single device, which is root-device. 'Release'
588  // is No-op.
589  return PI_SUCCESS;
590 }
591 
593  size_t ParamValueSize, void *ParamValue,
594  size_t *ParamValueSizeRet) {
595  ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet);
596 
597  switch (ParamName) {
598  case PI_DEVICE_INFO_TYPE:
599  return ReturnValue(PI_DEVICE_TYPE_GPU);
601  return ReturnValue(pi_device{0});
603  return ReturnValue(Device->Platform);
604  case PI_DEVICE_INFO_NAME:
605  return ReturnValue("ESIMD_EMULATOR");
607  return ReturnValue(pi_bool{true});
615  return ReturnValue(ESimdEmuVersionString);
617  return ReturnValue("Intel(R) Corporation");
619  return ReturnValue(size_t{8192});
621  return ReturnValue(size_t{8192});
623  return ReturnValue(pi_bool{1});
625  // TODO : Populate return string accordingly - e.g. cl_khr_fp16,
626  // cl_khr_fp64, cl_khr_int64_base_atomics,
627  // cl_khr_int64_extended_atomics
628  return ReturnValue("cl_khr_fp64");
630  return ReturnValue(Device->VersionStr.c_str());
631  case PI_DEVICE_INFO_BUILD_ON_SUBDEVICE: // emulator doesn't support partition
632  return ReturnValue(pi_bool{true});
634  return ReturnValue(pi_bool{false});
636  return ReturnValue(pi_bool{false});
638  return ReturnValue(pi_uint32{256});
640  return ReturnValue(pi_uint32{0});
642  return ReturnValue(pi_device_partition_property{0});
644  // '0x8086' : 'Intel HD graphics vendor ID'
645  return ReturnValue(pi_uint32{0x8086});
647  // Default SLM_MAX_SIZE from CM_EMU
648  return ReturnValue(pi_uint32{65536});
650  return ReturnValue(size_t{256});
652  // Imported from level_zero
653  return ReturnValue(pi_uint32{8});
657  // Default minimum values required by the SYCL specification.
658  return ReturnValue(size_t{2048});
660  return ReturnValue(pi_uint32{3});
662  return ReturnValue(pi_device_partition_property{0});
664  return ReturnValue("");
666  return ReturnValue(pi_queue_properties{PI_QUEUE_ON_DEVICE});
668  struct {
669  size_t Arr[3];
670  } MaxGroupSize = {{256, 256, 1}};
671  return ReturnValue(MaxGroupSize);
672  }
687  return ReturnValue(pi_uint32{1});
688 
689  // Imported from level_zero
695  pi_uint64 Supported = 0;
696  // TODO[1.0]: how to query for USM support now?
697  if (true) {
698  // TODO: Use ze_memory_access_capabilities_t
699  Supported = PI_USM_ACCESS | PI_USM_ATOMIC_ACCESS |
701  }
702  return ReturnValue(Supported);
703  }
705  return ReturnValue(
706  pi_uint32{sizeof(void *) * std::numeric_limits<unsigned char>::digits});
708  return ReturnValue(pi_uint32{1000});
710  return ReturnValue(pi_bool{true});
712  return ReturnValue(pi_bool{true});
716  return ReturnValue(pi_uint32{0});
719  return ReturnValue(size_t{0x80000000});
722  return ReturnValue(size_t{0});
725  return ReturnValue(pi_uint32{16});
728  return ReturnValue(size_t{32});
733  uint64_t FPValue = PI_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT |
736  PI_FP_FMA;
737  return ReturnValue(pi_uint64{FPValue});
738  }
740  return ReturnValue(PI_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE);
742  // TODO : CHECK
743  return ReturnValue(pi_uint32{64});
745  // TODO : CHECK
746  return ReturnValue(pi_uint64{0});
748  // TODO : CHECK
749  return ReturnValue(pi_uint64{0});
751  // TODO : CHECK
752  return ReturnValue(pi_uint64{0});
754  // TODO : CHECK
755  return ReturnValue(pi_uint32{64});
757  // TODO : CHECK
758  return ReturnValue(PI_DEVICE_LOCAL_MEM_TYPE_LOCAL);
760  return ReturnValue(pi_bool{false});
762  // TODO : CHECK
763  return ReturnValue(size_t{0});
765  // TODO : CHECK
766  return ReturnValue("");
768  // TODO : CHECK
769  return ReturnValue(size_t{1024});
771  return ReturnValue(pi_bool{false});
773  return ReturnValue(pi_device_affinity_domain{0});
775  // TODO : CHECK
776  return ReturnValue(pi_uint64{0});
778  // TODO : CHECK
779  return ReturnValue(
782  return ReturnValue("FULL_PROFILE");
784  // TODO : CHECK
785  return ReturnValue(pi_uint32{0});
786 
791 
792  // Intel-specific extensions
807 
808  default:
810  }
811  return PI_SUCCESS;
812 }
813 
815  pi_uint32, pi_device *, pi_uint32 *) {
817 }
818 
821 }
822 
824  pi_device *) {
826 }
827 
829  pi_uint32 NumDevices, const pi_device *Devices,
830  void (*PFnNotify)(const char *ErrInfo,
831  const void *PrivateInfo, size_t CB,
832  void *UserData),
833  void *UserData, pi_context *RetContext) {
834  ARG_UNUSED(Properties);
835  ARG_UNUSED(PFnNotify);
836  ARG_UNUSED(UserData);
837 
838  if (NumDevices != 1) {
839  return PI_ERROR_INVALID_VALUE;
840  }
841  if (Devices == nullptr) {
842  return PI_ERROR_INVALID_DEVICE;
843  }
844  if (RetContext == nullptr) {
845  return PI_ERROR_INVALID_VALUE;
846  }
847 
848  try {
850  *RetContext = new _pi_context(Devices[0]);
851  } catch (const std::bad_alloc &) {
852  return PI_ERROR_OUT_OF_HOST_MEMORY;
853  } catch (...) {
854  return PI_ERROR_UNKNOWN;
855  }
856  return PI_SUCCESS;
857 }
858 
860  size_t *) {
862 }
863 
865  pi_context_extended_deleter, void *) {
867 }
868 
871 }
872 
874  const pi_device *, bool,
875  pi_context *) {
877 }
878 
880  if (Context == nullptr) {
881  return PI_ERROR_INVALID_CONTEXT;
882  }
883 
884  ++(Context->RefCount);
885 
886  return PI_SUCCESS;
887 }
888 
890  if (Context == nullptr || (Context->RefCount <= 0)) {
891  return PI_ERROR_INVALID_CONTEXT;
892  }
893 
894  if (--(Context->RefCount) == 0) {
897  std::lock_guard<std::mutex> Lock(Context->Addr2CmBufferSVMLock);
898  for (auto &Entry : Context->Addr2CmBufferSVM) {
899  Context->Device->CmDevicePtr->DestroyBufferSVM(Entry.second);
900  }
901  delete Context;
902  }
903 
904  return PI_SUCCESS;
905 }
906 
909  if (HostPtr == nullptr) {
910  PiTrace("HostPtr argument is required for "
911  "PI_MEM_FLAGS_HOST_PTR_USE/COPY");
912  return false;
913  }
914  // COPY and USE are mutually exclusive
917  PiTrace("PI_MEM_FLAGS_HOST_PTR_USE and _COPY cannot be used together");
918  return false;
919  }
920  }
921  return true;
922 }
923 
925  pi_queue_properties Properties, pi_queue *Queue) {
927 
928  if (Properties & PI_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {
929  // TODO : Support Out-of-order Queue
930  *Queue = nullptr;
931  return PI_ERROR_INVALID_QUEUE_PROPERTIES;
932  }
933 
934  cm_support::CmQueue *CmQueue;
935 
936  int Result = Context->Device->CmDevicePtr->CreateQueue(CmQueue);
937  if (Result != cm_support::CM_SUCCESS) {
938  return PI_ERROR_INVALID_CONTEXT;
939  }
940 
941  try {
942  *Queue = new _pi_queue(Context, CmQueue);
943  } catch (const std::bad_alloc &) {
944  return PI_ERROR_OUT_OF_HOST_MEMORY;
945  } catch (...) {
946  return PI_ERROR_UNKNOWN;
947  }
948 
949  return PI_SUCCESS;
950 }
951 
952 pi_result piQueueGetInfo(pi_queue, pi_queue_info, size_t, void *, size_t *) {
954 }
955 
957  if (Queue == nullptr) {
958  return PI_ERROR_INVALID_QUEUE;
959  }
960  ++(Queue->RefCount);
961  return PI_SUCCESS;
962 }
963 
965  if ((Queue == nullptr) || (Queue->CmQueuePtr == nullptr)) {
966  return PI_ERROR_INVALID_QUEUE;
967  }
968 
969  if (--(Queue->RefCount) == 0) {
970  // CM's 'DestoryQueue' is no-op
971  // Queue->Context->Device->CmDevicePTr->DestroyQueue(Queue->CmQueuePtr);
972  delete Queue;
973  }
974 
975  return PI_SUCCESS;
976 }
977 
979  // No-op as enqueued commands with ESIMD_EMULATOR plugin are blocking
980  // ones that do not return until their completion - kernel execution
981  // and memory read.
983 }
984 
986  // No-op as enqueued commands with ESIMD_EMULATOR plugin are blocking
987  // ones that do not return until their completion - kernel execution
988  // and memory read.
990 }
991 
994 }
995 
997  pi_device, bool, pi_queue *) {
999 }
1000 
1002  void *HostPtr, pi_mem *RetMem,
1003  const pi_mem_properties *properties) {
1004  ARG_UNUSED(properties);
1005 
1006  if ((Flags & PI_MEM_FLAGS_ACCESS_RW) == 0) {
1007  PiTrace("Invalid memory attribute for piMemBufferCreate");
1008  return PI_ERROR_INVALID_OPERATION;
1009  }
1010 
1011  if (Context == nullptr) {
1012  return PI_ERROR_INVALID_CONTEXT;
1013  }
1014  if (RetMem == nullptr) {
1015  return PI_ERROR_INVALID_VALUE;
1016  }
1017 
1018  // Flag & HostPtr argument sanity check
1019  if (!Context->checkSurfaceArgument(Flags, HostPtr)) {
1020  return PI_ERROR_INVALID_OPERATION;
1021  }
1022 
1023  char *MapBasePtr = nullptr;
1024  cm_surface_ptr_t CmBuf;
1025  cm_support::SurfaceIndex *CmIndex;
1026  int Status = cm_support::CM_FAILURE;
1027 
1028  if (Flags & PI_MEM_FLAGS_HOST_PTR_USE) {
1030  Status = Context->Device->CmDevicePtr->CreateBufferUP(
1031  static_cast<unsigned int>(Size), HostPtr, CmBuf.UPBufPtr);
1032  CmBuf.UPBufPtr->GetIndex(CmIndex);
1033  } else {
1035  Status = Context->Device->CmDevicePtr->CreateBuffer(
1036  static_cast<unsigned int>(Size), CmBuf.RegularBufPtr);
1037  CmBuf.RegularBufPtr->GetIndex(CmIndex);
1038 
1039  if (Flags & PI_MEM_FLAGS_HOST_PTR_COPY) {
1040  CmBuf.RegularBufPtr->WriteSurface(
1041  reinterpret_cast<const unsigned char *>(HostPtr), nullptr,
1042  static_cast<unsigned int>(Size));
1043  }
1044  }
1045 
1046  if (Status != cm_support::CM_SUCCESS) {
1047  return PI_ERROR_INVALID_OPERATION;
1048  }
1049 
1050  MapBasePtr =
1051  pi_cast<char *>(cm_support::get_surface_base_addr(CmIndex->get_data()));
1052 
1053  try {
1054  *RetMem =
1055  new _pi_buffer(Context, MapBasePtr, CmBuf, CmIndex->get_data(), Size);
1056  } catch (const std::bad_alloc &) {
1057  return PI_ERROR_OUT_OF_HOST_MEMORY;
1058  } catch (...) {
1059  return PI_ERROR_UNKNOWN;
1060  }
1061 
1062  std::lock_guard<std::mutex> Lock{*PiESimdSurfaceMapLock};
1063  if (PiESimdSurfaceMap->find((*RetMem)->SurfaceIndex) !=
1064  PiESimdSurfaceMap->end()) {
1065  PiTrace("Failure from CM-managed buffer creation");
1066  return PI_ERROR_INVALID_MEM_OBJECT;
1067  }
1068 
1069  (*PiESimdSurfaceMap)[(*RetMem)->SurfaceIndex] = *RetMem;
1070 
1071  return PI_SUCCESS;
1072 }
1073 
1074 pi_result piMemGetInfo(pi_mem, pi_mem_info, size_t, void *, size_t *) {
1076 }
1077 
1079  if (Mem == nullptr) {
1080  return PI_ERROR_INVALID_MEM_OBJECT;
1081  }
1082  ++(Mem->RefCount);
1083  return PI_SUCCESS;
1084 }
1085 
1087  if ((Mem == nullptr) || (Mem->RefCount == 0)) {
1088  return PI_ERROR_INVALID_MEM_OBJECT;
1089  }
1090 
1091  if (--(Mem->RefCount) == 0) {
1092  // Removing Surface-map entry
1093  std::lock_guard<std::mutex> Lock{*PiESimdSurfaceMapLock};
1094  auto MapEntryIt = PiESimdSurfaceMap->find(Mem->SurfaceIndex);
1095  if (MapEntryIt == PiESimdSurfaceMap->end()) {
1096  PiTrace("Failure from Buffer/Image deletion");
1097  return PI_ERROR_INVALID_MEM_OBJECT;
1098  }
1099  PiESimdSurfaceMap->erase(MapEntryIt);
1100  delete Mem;
1101  }
1102  return PI_SUCCESS;
1103 }
1104 
1106  int Status = cm_support::CM_FAILURE;
1107 
1108  cm_support::CmDevice *CmDevice = Context->Device->CmDevicePtr;
1109 
1111  Status = CmDevice->DestroyBufferUP(SurfacePtr.UPBufPtr);
1113  Status = CmDevice->DestroySurface(SurfacePtr.RegularBufPtr);
1115  Status = CmDevice->DestroySurface2DUP(SurfacePtr.UPImgPtr);
1117  Status = CmDevice->DestroySurface(SurfacePtr.RegularImgPtr);
1118  }
1119 
1120  sycl::detail::pi::assertion(Status == cm_support::CM_SUCCESS &&
1121  "Surface Deletion Failure from CM_EMU");
1122 
1123  for (auto mapit = Mappings.begin(); mapit != Mappings.end();) {
1124  mapit = Mappings.erase(mapit);
1125  }
1126 }
1127 
1128 cm_support::CM_SURFACE_FORMAT
1130  using ULongPair = std::pair<unsigned long, unsigned long>;
1131  using FmtMap = std::map<ULongPair, cm_support::CM_SURFACE_FORMAT>;
1132  static const FmtMap pi2cm = {
1134  cm_support::CM_SURFACE_FORMAT_A8R8G8B8},
1135 
1137  cm_support::CM_SURFACE_FORMAT_A8R8G8B8},
1138 
1140  cm_support::CM_SURFACE_FORMAT_A8R8G8B8},
1141 
1143  cm_support::CM_SURFACE_FORMAT_R32G32B32A32F},
1144  };
1145  auto Result = pi2cm.find(
1146  {PiFormat->image_channel_data_type, PiFormat->image_channel_order});
1147  if (Result != pi2cm.end()) {
1148  return Result->second;
1149  }
1150  return cm_support::CM_SURFACE_FORMAT_UNKNOWN;
1151 }
1152 
1154  const pi_image_format *ImageFormat,
1155  const pi_image_desc *ImageDesc, void *HostPtr,
1156  pi_mem *RetImage) {
1157  if ((Flags & PI_MEM_FLAGS_ACCESS_RW) == 0) {
1158  PiTrace("Invalid memory attribute for piMemImageCreate");
1159  return PI_ERROR_INVALID_OPERATION;
1160  }
1161 
1162  if (ImageFormat == nullptr || ImageDesc == nullptr)
1163  return PI_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR;
1164 
1165  switch (ImageDesc->image_type) {
1166  case PI_MEM_TYPE_IMAGE2D:
1167  break;
1168 
1174 
1175  default:
1176  return PI_ERROR_INVALID_MEM_OBJECT;
1177  }
1178 
1179  auto BytesPerPixel = 4;
1180  switch (ImageFormat->image_channel_data_type) {
1182  BytesPerPixel = 16;
1183  break;
1186  BytesPerPixel = 4;
1187  break;
1200  default:
1201  return PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED;
1202  }
1203 
1204  // Flag & HostPtr argument sanity check
1205  if (!Context->checkSurfaceArgument(Flags, HostPtr)) {
1206  return PI_ERROR_INVALID_OPERATION;
1207  }
1208 
1209  cm_support::CM_SURFACE_FORMAT CmSurfFormat =
1210  ConvertPiImageFormatToCmFormat(ImageFormat);
1211  if (CmSurfFormat == cm_support::CM_SURFACE_FORMAT_UNKNOWN) {
1212  return PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED;
1213  }
1214 
1215  char *MapBasePtr = nullptr;
1216  cm_surface_ptr_t CmImg;
1217  cm_support::SurfaceIndex *CmIndex;
1218  int Status = cm_support::CM_SUCCESS;
1219 
1220  if (Flags & PI_MEM_FLAGS_HOST_PTR_USE) {
1222  Status = Context->Device->CmDevicePtr->CreateSurface2DUP(
1223  static_cast<unsigned int>(ImageDesc->image_width),
1224  static_cast<unsigned int>(ImageDesc->image_height), CmSurfFormat,
1225  HostPtr, CmImg.UPImgPtr);
1226  CmImg.UPImgPtr->GetIndex(CmIndex);
1227  } else {
1229  Status = Context->Device->CmDevicePtr->CreateSurface2D(
1230  static_cast<unsigned int>(ImageDesc->image_width),
1231  static_cast<unsigned int>(ImageDesc->image_height), CmSurfFormat,
1232  CmImg.RegularImgPtr);
1233  CmImg.RegularImgPtr->GetIndex(CmIndex);
1234 
1235  if (Flags & PI_MEM_FLAGS_HOST_PTR_COPY) {
1236  CmImg.RegularImgPtr->WriteSurface(
1237  reinterpret_cast<const unsigned char *>(HostPtr), nullptr,
1238  static_cast<unsigned int>(ImageDesc->image_width *
1239  ImageDesc->image_height * BytesPerPixel));
1240  }
1241  }
1242 
1243  if (Status != cm_support::CM_SUCCESS) {
1244  return PI_ERROR_INVALID_OPERATION;
1245  }
1246 
1247  MapBasePtr =
1248  pi_cast<char *>(cm_support::get_surface_base_addr(CmIndex->get_data()));
1249 
1250  try {
1251  *RetImage = new _pi_image(Context, MapBasePtr, CmImg, CmIndex->get_data(),
1252  ImageDesc->image_width, ImageDesc->image_height,
1253  BytesPerPixel);
1254  } catch (const std::bad_alloc &) {
1255  return PI_ERROR_OUT_OF_HOST_MEMORY;
1256  } catch (...) {
1257  return PI_ERROR_UNKNOWN;
1258  }
1259 
1260  std::lock_guard<std::mutex> Lock{*PiESimdSurfaceMapLock};
1261  if (PiESimdSurfaceMap->find((*RetImage)->SurfaceIndex) !=
1262  PiESimdSurfaceMap->end()) {
1263  PiTrace("Failure from CM-managed image creation");
1264  return PI_ERROR_INVALID_VALUE;
1265  }
1266 
1267  (*PiESimdSurfaceMap)[(*RetImage)->SurfaceIndex] = *RetImage;
1268 
1269  return PI_SUCCESS;
1270 }
1271 
1274 }
1275 
1277  pi_mem *) {
1279 }
1280 
1281 pi_result piProgramCreate(pi_context, const void *, size_t, pi_program *) {
1283 }
1284 
1286  const size_t *, const unsigned char **,
1287  size_t, const pi_device_binary_property *,
1288  pi_int32 *, pi_program *) {
1290 }
1291 
1293  const size_t *, const unsigned char **,
1294  pi_int32 *, pi_program *) {
1296 }
1297 
1299  const size_t *, pi_program *) {
1301 }
1302 
1304  size_t *) {
1306 }
1307 
1309  pi_uint32, const pi_program *,
1310  void (*)(pi_program, void *), void *, pi_program *) {
1312 }
1313 
1315  const char *, pi_uint32, const pi_program *,
1316  const char **, void (*)(pi_program, void *),
1317  void *) {
1319 }
1320 
1322  void (*)(pi_program, void *), void *) {
1324 }
1325 
1327  size_t, void *, size_t *) {
1329 }
1330 
1332 
1334 
1337 }
1338 
1340  pi_program *) {
1342 }
1343 
1346 }
1347 
1348 pi_result piKernelSetArg(pi_kernel, pi_uint32, size_t, const void *) {
1350 }
1351 
1354 }
1355 
1356 // Special version of piKernelSetArg to accept pi_sampler.
1359 }
1360 
1361 pi_result piKernelGetInfo(pi_kernel, pi_kernel_info, size_t, void *, size_t *) {
1363 }
1364 
1366  size_t, void *, size_t *) {
1368 }
1369 
1371  pi_kernel_sub_group_info, size_t,
1372  const void *, size_t, void *, size_t *) {
1374 }
1375 
1377 
1379 
1381 
1382 pi_result piEventGetInfo(pi_event, pi_event_info, size_t, void *, size_t *) {
1384 }
1385 
1387  size_t ParamValueSize, void *ParamValue,
1388  size_t *ParamValueSizeRet) {
1389  ARG_UNUSED(Event);
1390  ARG_UNUSED(ParamName);
1391  ARG_UNUSED(ParamValueSize);
1392  ARG_UNUSED(ParamValue);
1393  ARG_UNUSED(ParamValueSizeRet);
1394 
1395  PiTrace("Warning : Profiling Not supported under PI_ESIMD_EMULATOR");
1396  return PI_SUCCESS;
1397 }
1398 
1399 pi_result piEventsWait(pi_uint32 NumEvents, const pi_event *EventList) {
1400  for (int i = 0; i < (int)NumEvents; i++) {
1401  if (EventList[i]->IsDummyEvent) {
1402  // Dummy event is already completed ones done by CM. Skip
1403  // waiting.
1404  continue;
1405  }
1406  if (EventList[i]->CmEventPtr == nullptr) {
1407  return PI_ERROR_INVALID_EVENT;
1408  }
1409  int Result = EventList[i]->CmEventPtr->WaitForTaskFinished();
1410  if (Result != cm_support::CM_SUCCESS) {
1411  return PI_ERROR_OUT_OF_RESOURCES;
1412  }
1413  }
1414  return PI_SUCCESS;
1415 }
1416 
1418  void (*)(pi_event, pi_int32, void *), void *) {
1420 }
1421 
1423 
1425  if (Event == nullptr) {
1426  return PI_ERROR_INVALID_EVENT;
1427  }
1428 
1429  ++(Event->RefCount);
1430 
1431  return PI_SUCCESS;
1432 }
1433 
1435  if (Event == nullptr || (Event->RefCount <= 0)) {
1436  return PI_ERROR_INVALID_EVENT;
1437  }
1438 
1439  if (--(Event->RefCount) == 0) {
1440  if (!Event->IsDummyEvent) {
1441  if ((Event->CmEventPtr == nullptr) || (Event->OwnerQueue == nullptr)) {
1442  return PI_ERROR_INVALID_EVENT;
1443  }
1444  int Result = Event->OwnerQueue->DestroyEvent(Event->CmEventPtr);
1445  if (Result != cm_support::CM_SUCCESS) {
1446  return PI_ERROR_INVALID_EVENT;
1447  }
1448  }
1449  delete Event;
1450  }
1451 
1452  return PI_SUCCESS;
1453 }
1454 
1457 }
1458 
1460  pi_event *) {
1462 }
1464  pi_sampler *) {
1466 }
1467 
1469  size_t *) {
1471 }
1472 
1474 
1476 
1478  pi_event *) {
1480 }
1481 
1483  pi_event *) {
1485 }
1486 
1488  pi_bool BlockingRead, size_t Offset,
1489  size_t Size, void *Dst,
1490  pi_uint32 NumEventsInWaitList,
1491  const pi_event *EventWaitList,
1492  pi_event *Event) {
1493  ARG_UNUSED(Queue);
1494  ARG_UNUSED(EventWaitList);
1495 
1497  if (BlockingRead) {
1498  PiTrace(
1499  "ESIMD_EMULATOR support for blocking piEnqueueMemBufferRead is NYI");
1500  return PI_ERROR_INVALID_OPERATION;
1501  }
1502 
1503  if (Offset != 0) {
1504  PiTrace("ESIMD_EMULATOR does not support buffer reading with offsets");
1505  return PI_ERROR_INVALID_ARG_VALUE;
1506  }
1507 
1508  if (NumEventsInWaitList != 0) {
1509  return PI_ERROR_INVALID_EVENT_WAIT_LIST;
1510  }
1511 
1512  _pi_buffer *buf = static_cast<_pi_buffer *>(Src);
1513 
1514  std::unique_ptr<_pi_event> RetEv{nullptr};
1515  if (Event) {
1516  RetEv = std::unique_ptr<_pi_event>(new _pi_event());
1517  RetEv->IsDummyEvent = true;
1518  }
1519 
1521  // CM does not provide 'ReadSurface' call for 'User-Provided'
1522  // Surface. memcpy is used for BufferRead PI_API call.
1523  memcpy(Dst, buf->MapHostPtr, Size);
1524  } else {
1526  return PI_ERROR_INVALID_MEM_OBJECT;
1527  }
1528  int Status = buf->SurfacePtr.RegularBufPtr->ReadSurface(
1529  reinterpret_cast<unsigned char *>(Dst),
1530  nullptr, // event
1531  static_cast<uint64_t>(Size));
1532 
1533  if (Status != cm_support::CM_SUCCESS) {
1534  return PI_ERROR_INVALID_MEM_OBJECT;
1535  }
1536  }
1537 
1538  if (Event) {
1539  *Event = RetEv.release();
1540  }
1541 
1542  return PI_SUCCESS;
1543 }
1544 
1547  pi_buff_rect_region, size_t, size_t,
1548  size_t, size_t, void *, pi_uint32,
1549  const pi_event *, pi_event *) {
1551 }
1552 
1554  const void *, pi_uint32, const pi_event *,
1555  pi_event *) {
1557 }
1558 
1561  pi_buff_rect_region, size_t, size_t,
1562  size_t, size_t, const void *, pi_uint32,
1563  const pi_event *, pi_event *) {
1565 }
1566 
1568  size_t, pi_uint32, const pi_event *,
1569  pi_event *) {
1571 }
1572 
1575  pi_buff_rect_region, size_t, size_t,
1576  size_t, size_t, pi_uint32,
1577  const pi_event *, pi_event *) {
1579 }
1580 
1581 pi_result piEnqueueMemBufferFill(pi_queue, pi_mem, const void *, size_t, size_t,
1582  size_t, pi_uint32, const pi_event *,
1583  pi_event *) {
1585 }
1586 
1588  pi_bool BlockingMap, pi_map_flags MapFlags,
1589  size_t Offset, size_t Size,
1590  pi_uint32 NumEventsInWaitList,
1591  const pi_event *EventWaitList, pi_event *Event,
1592  void **RetMap) {
1593  ARG_UNUSED(Queue);
1594  ARG_UNUSED(BlockingMap);
1595  ARG_UNUSED(MapFlags);
1596  ARG_UNUSED(NumEventsInWaitList);
1597  ARG_UNUSED(EventWaitList);
1598 
1599  std::unique_ptr<_pi_event> RetEv{nullptr};
1600  pi_result ret = PI_SUCCESS;
1601 
1602  if (Event) {
1603  RetEv = std::unique_ptr<_pi_event>(new _pi_event());
1604  RetEv->IsDummyEvent = true;
1605  }
1606 
1607  // Real mapping does not occur here and CPU-accessible address is
1608  // returned as the actual memory space for the buffer is located in
1609  // CPU memory and the plug-in know its base address
1610  // ('_pi_mem::MapHostPtr')
1611  *RetMap = MemObj->MapHostPtr + Offset;
1612 
1613  {
1614  std::lock_guard<std::mutex> Lock{MemObj->MappingsMutex};
1615  auto Res = MemObj->Mappings.insert({*RetMap, {Offset, Size}});
1616  // False as the second value in pair means that mapping was not inserted
1617  // because mapping already exists.
1618  if (!Res.second) {
1619  ret = PI_ERROR_INVALID_VALUE;
1620  PiTrace("piEnqueueMemBufferMap: duplicate mapping detected");
1621  }
1622  }
1623 
1624  if (Event) {
1625  *Event = RetEv.release();
1626  }
1627  return ret;
1628 }
1629 
1630 pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
1631  pi_uint32 NumEventsInWaitList,
1632  const pi_event *EventWaitList, pi_event *Event) {
1633  ARG_UNUSED(Queue);
1634  ARG_UNUSED(NumEventsInWaitList);
1635  ARG_UNUSED(EventWaitList);
1636 
1637  std::unique_ptr<_pi_event> RetEv{nullptr};
1638  pi_result ret = PI_SUCCESS;
1639 
1640  if (Event) {
1641  RetEv = std::unique_ptr<_pi_event>(new _pi_event());
1642  RetEv->IsDummyEvent = true;
1643  }
1644 
1645  // Real unmapping does not occur here and CPU-accessible address is
1646  // returned as the actual memory space for the buffer is located in
1647  // CPU memory and the plug-in knows its base address
1648  // ('_pi_mem::MapHostPtr')
1649  {
1650  std::lock_guard<std::mutex> Lock(MemObj->MappingsMutex);
1651  auto It = MemObj->Mappings.find(MappedPtr);
1652  if (It == MemObj->Mappings.end()) {
1653  ret = PI_ERROR_INVALID_VALUE;
1654  PiTrace("piEnqueueMemUnmap: unknown memory mapping");
1655  }
1656  MemObj->Mappings.erase(It);
1657  }
1658 
1659  if (Event) {
1660  *Event = RetEv.release();
1661  }
1662 
1663  return ret;
1664 }
1665 
1666 pi_result piMemImageGetInfo(pi_mem, pi_image_info, size_t, void *, size_t *) {
1668 }
1669 
1671  pi_bool BlockingRead, pi_image_offset Origin,
1672  pi_image_region Region, size_t RowPitch,
1673  size_t SlicePitch, void *Ptr,
1674  pi_uint32 NumEventsInWaitList,
1675  const pi_event *EventWaitList,
1676  pi_event *Event) {
1677  ARG_UNUSED(CommandQueue);
1678  ARG_UNUSED(NumEventsInWaitList);
1679  ARG_UNUSED(EventWaitList);
1680 
1682  if (BlockingRead) {
1683  PiTrace("ESIMD_EMULATOR support for blocking piEnqueueMemImageRead is NYI");
1684  return PI_ERROR_INVALID_OPERATION;
1685  }
1686 
1687  // SlicePitch is for 3D image while ESIMD_EMULATOR does not
1688  // support. For 2D surfaces, SlicePitch must be 0.
1689  if (SlicePitch != 0) {
1690  PiTrace("ESIMD_EMULATOR does not support 3D-image");
1691  return PI_ERROR_INVALID_ARG_VALUE;
1692  }
1693 
1694  // CM_EMU does not support ReadSurface with offset
1695  if (Origin->x != 0 || Origin->y != 0 || Origin->z != 0) {
1696  PiTrace("ESIMD_EMULATOR does not support 2D-image reading with offsets");
1697  return PI_ERROR_INVALID_ARG_VALUE;
1698  }
1699 
1700  _pi_image *PiImg = static_cast<_pi_image *>(Image);
1701 
1702  std::unique_ptr<_pi_event> RetEv{nullptr};
1703 
1704  if (Event) {
1705  RetEv = std::unique_ptr<_pi_event>(new _pi_event());
1706  RetEv->IsDummyEvent = true;
1707  }
1708 
1709  size_t Size = RowPitch * (Region->height);
1711  // CM does not provide 'ReadSurface' call for 'User-Provided'
1712  // Surface. memcpy is used for ImageRead PI_API call.
1713  memcpy(Ptr, PiImg->MapHostPtr, Size);
1714  } else {
1716  return PI_ERROR_INVALID_MEM_OBJECT;
1717  }
1718  int Status = PiImg->SurfacePtr.RegularImgPtr->ReadSurface(
1719  reinterpret_cast<unsigned char *>(Ptr),
1720  nullptr, // event
1721  static_cast<uint64_t>(Size));
1722 
1723  if (Status != cm_support::CM_SUCCESS) {
1724  return PI_ERROR_INVALID_MEM_OBJECT;
1725  }
1726  }
1727 
1728  if (Event) {
1729  *Event = RetEv.release();
1730  }
1731 
1732  return PI_SUCCESS;
1733 }
1734 
1736  pi_image_region, size_t, size_t, const void *,
1737  pi_uint32, const pi_event *, pi_event *) {
1739 }
1740 
1743  const pi_event *, pi_event *) {
1745 }
1746 
1747 pi_result piEnqueueMemImageFill(pi_queue, pi_mem, const void *, const size_t *,
1748  const size_t *, pi_uint32, const pi_event *,
1749  pi_event *) {
1751 }
1752 
1754  void *, pi_mem *) {
1756 }
1757 
1758 pi_result
1760  const size_t *GlobalWorkOffset,
1761  const size_t *GlobalWorkSize, const size_t *LocalWorkSize,
1762  pi_uint32 NumEventsInWaitList,
1763  const pi_event *EventWaitList, pi_event *Event) {
1764  ARG_UNUSED(Queue);
1765  ARG_UNUSED(NumEventsInWaitList);
1766  ARG_UNUSED(EventWaitList);
1767 
1768  const size_t LocalWorkSz[] = {1, 1, 1};
1769 
1770  if (Kernel == nullptr) {
1771  return PI_ERROR_INVALID_KERNEL;
1772  }
1773 
1774  if (WorkDim > 3 || WorkDim == 0) {
1775  return PI_ERROR_INVALID_WORK_GROUP_SIZE;
1776  }
1777 
1778  if (isNull(WorkDim, LocalWorkSize)) {
1779  LocalWorkSize = LocalWorkSz;
1780  }
1781 
1782  for (pi_uint32 I = 0; I < WorkDim; I++) {
1783  if ((GlobalWorkSize[I] % LocalWorkSize[I]) != 0) {
1784  return PI_ERROR_INVALID_WORK_GROUP_SIZE;
1785  }
1786  }
1787 
1788  std::unique_ptr<_pi_event> RetEv{nullptr};
1789 
1790  if (Event) {
1791  RetEv = std::unique_ptr<_pi_event>(new _pi_event());
1792  RetEv->IsDummyEvent = true;
1793  }
1794 
1795  switch (WorkDim) {
1796  case 1:
1797  InvokeImpl<1>::invoke(Kernel, GlobalWorkOffset, GlobalWorkSize,
1798  LocalWorkSize);
1799  break;
1800  case 2:
1801  InvokeImpl<2>::invoke(Kernel, GlobalWorkOffset, GlobalWorkSize,
1802  LocalWorkSize);
1803  break;
1804  case 3:
1805  InvokeImpl<3>::invoke(Kernel, GlobalWorkOffset, GlobalWorkSize,
1806  LocalWorkSize);
1807  break;
1808  default:
1810  break;
1811  }
1812 
1813  if (Event) {
1814  *Event = RetEv.release();
1815  }
1816 
1817  return PI_SUCCESS;
1818 }
1819 
1821  pi_program, bool, pi_kernel *) {
1823 }
1824 
1827 }
1828 
1829 pi_result piEnqueueNativeKernel(pi_queue, void (*)(void *), void *, size_t,
1830  pi_uint32, const pi_mem *, const void **,
1831  pi_uint32, const pi_event *, pi_event *) {
1833 }
1834 
1836  pi_uint64 *) {
1838 }
1839 
1841  size_t, pi_uint32) {
1843 }
1844 
1846  pi_usm_mem_properties *, size_t, pi_uint32) {
1848 }
1849 
1850 pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
1851  pi_device Device,
1852  pi_usm_mem_properties *Properties, size_t Size,
1853  pi_uint32 Alignment) {
1854  ARG_UNUSED(Properties);
1855  ARG_UNUSED(Alignment);
1856 
1857  if (Context == nullptr || (Device != Context->Device)) {
1858  return PI_ERROR_INVALID_CONTEXT;
1859  }
1860 
1861  if (ResultPtr == nullptr) {
1862  return PI_ERROR_INVALID_OPERATION;
1863  }
1864 
1865  // 'Size' must be power of two in order to prevent memory corruption
1866  // error
1867  if ((Size & (Size - 1)) != 0) {
1868  Size = sycl::detail::getNextPowerOfTwo(Size);
1869  }
1870 
1871  cm_support::CmBufferSVM *Buf = nullptr;
1872  void *SystemMemPtr = nullptr;
1873  int32_t Result = Context->Device->CmDevicePtr->CreateBufferSVM(
1874  Size, SystemMemPtr, CM_SVM_ACCESS_FLAG_DEFAULT, Buf);
1875 
1876  if (Result != cm_support::CM_SUCCESS) {
1877  return PI_ERROR_OUT_OF_HOST_MEMORY;
1878  }
1879  *ResultPtr = SystemMemPtr;
1880  std::lock_guard<std::mutex> Lock(Context->Addr2CmBufferSVMLock);
1881  auto Iter = Context->Addr2CmBufferSVM.find(SystemMemPtr);
1882  if (Context->Addr2CmBufferSVM.end() != Iter) {
1883  return PI_ERROR_INVALID_MEM_OBJECT;
1884  }
1885  Context->Addr2CmBufferSVM[SystemMemPtr] = Buf;
1886  return PI_SUCCESS;
1887 }
1888 
1889 pi_result piextUSMFree(pi_context Context, void *Ptr) {
1890  if (Context == nullptr) {
1891  return PI_ERROR_INVALID_CONTEXT;
1892  }
1893  if (Ptr == nullptr) {
1894  return PI_ERROR_INVALID_OPERATION;
1895  }
1896 
1897  std::lock_guard<std::mutex> Lock(Context->Addr2CmBufferSVMLock);
1898  cm_support::CmBufferSVM *Buf = Context->Addr2CmBufferSVM[Ptr];
1899  if (Buf == nullptr) {
1900  return PI_ERROR_INVALID_MEM_OBJECT;
1901  }
1902  auto Count = Context->Addr2CmBufferSVM.erase(Ptr);
1903  if (Count != 1) {
1904  return PI_ERROR_INVALID_MEM_OBJECT;
1905  }
1906  int32_t Result = Context->Device->CmDevicePtr->DestroyBufferSVM(Buf);
1907  if (cm_support::CM_SUCCESS != Result) {
1908  return PI_ERROR_UNKNOWN;
1909  }
1910  return PI_SUCCESS;
1911 }
1912 
1915 }
1916 
1918  const pi_event *, pi_event *) {
1920 }
1921 
1922 pi_result piextUSMEnqueueMemcpy(pi_queue, pi_bool, void *, const void *, size_t,
1923  pi_uint32, const pi_event *, pi_event *) {
1925 }
1926 
1928  pi_mem_advice, pi_event *) {
1930 }
1931 
1933  size_t, void *, size_t *) {
1935 }
1936 
1938  const void *) {
1940 }
1941 
1943  const void *) {
1945 }
1946 
1948  pi_uint32 RawImgSize, pi_uint32 *ImgInd) {
1951  if (RawImgSize != 1) {
1952  PiTrace("Only single device binary image is supported in ESIMD_EMULATOR");
1953  return PI_ERROR_INVALID_VALUE;
1954  }
1955  *ImgInd = 0;
1956  return PI_SUCCESS;
1957 }
1958 
1961  const pi_event *, pi_event *) {
1963 }
1964 
1965 pi_result piextPluginGetOpaqueData(void *, void **OpaqueDataReturn) {
1966  *OpaqueDataReturn = reinterpret_cast<void *>(PiESimdDeviceAccess);
1967  return PI_SUCCESS;
1968 }
1969 
1971  delete reinterpret_cast<sycl::detail::ESIMDEmuPluginOpaqueData *>(
1972  PiESimdDeviceAccess->data);
1973  delete PiESimdDeviceAccess;
1974 
1975  for (auto it = PiESimdSurfaceMap->begin(); it != PiESimdSurfaceMap->end();) {
1976  auto Mem = it->second;
1977  if (Mem != nullptr) {
1978  delete Mem;
1979  } // else { /* Null-entry for SLM_BTI */ }
1980  it = PiESimdSurfaceMap->erase(it);
1981  }
1982  return PI_SUCCESS;
1983 }
1984 
1986 
1988  if (PluginInit == nullptr) {
1989  return PI_ERROR_INVALID_VALUE;
1990  }
1991 
1992  // Check that the major version matches in PiVersion and SupportedVersion
1994 
1995  size_t PluginVersionSize = sizeof(PluginInit->PluginVersion);
1996  if (strlen(_PI_H_VERSION_STRING) >= PluginVersionSize) {
1997  return PI_ERROR_INVALID_VALUE;
1998  }
1999  strncpy(PluginInit->PluginVersion, SupportedVersion, PluginVersionSize);
2000 
2001  PiESimdDeviceAccess = new sycl::detail::ESIMDEmuPluginOpaqueData();
2002  // 'version' to be compared with 'ESIMD_EMULATOR_DEVICE_REQUIRED_VER' defined
2003  // in device interface file
2005  PiESimdDeviceAccess->data =
2006  reinterpret_cast<void *>(new sycl::detail::ESIMDDeviceInterface());
2007 
2008  // Registering pre-defined surface index dedicated for SLM
2009  (*PiESimdSurfaceMap)[__ESIMD_DNS::SLM_BTI] = nullptr;
2010 
2011 #define _PI_API(api) \
2012  (PluginInit->PiFunctionTable).api = (decltype(&::api))(&api);
2013 #include <sycl/detail/pi.def>
2014 
2015  return PI_SUCCESS;
2016 }
2017 
2018 } // extern C
sycl::_V1::ext::intel::esimd::fence
__ESIMD_API void fence()
esimd::fence sets the memory read/write order.
Definition: memory.hpp:901
piextDeviceSelectBinary
pi_result piextDeviceSelectBinary(pi_device, pi_device_binary *, pi_uint32 RawImgSize, pi_uint32 *ImgInd)
Selects the most appropriate device binary based on runtime information and the IR characteristics.
Definition: pi_esimd_emulator.cpp:1947
setErrorMessage
static void setErrorMessage(const char *message, pi_result error_code)
Definition: pi_esimd_emulator.cpp:157
PI_DEVICE_INFO_HOST_UNIFIED_MEMORY
@ PI_DEVICE_INFO_HOST_UNIFIED_MEMORY
Definition: pi.h:229
cm_surface_ptr_t::TypeUserProvidedImage
@ TypeUserProvidedImage
Definition: pi_esimd_emulator.hpp:127
piextUSMSharedAlloc
pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, pi_device Device, pi_usm_mem_properties *Properties, size_t Size, pi_uint32 Alignment)
Allocates memory accessible on both host and device.
Definition: pi_esimd_emulator.cpp:1850
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR
Definition: pi.h:190
PI_DEVICE_INFO_OPENCL_C_VERSION
@ PI_DEVICE_INFO_OPENCL_C_VERSION
Definition: pi.h:247
pi_image_region_struct::height
size_t height
Definition: pi.h:852
_pi_mem
PI Mem mapping to CUDA memory allocations, both data and texture/surface.
Definition: pi_cuda.hpp:222
SupportedVersion
const char SupportedVersion[]
Definition: pi_esimd_emulator.cpp:1985
piPluginInit
pi_result piPluginInit(pi_plugin *PluginInit)
Definition: pi_esimd_emulator.cpp:1987
_pi_buffer::MapHostPtr
char * MapHostPtr
Definition: pi_level_zero.hpp:1220
PI_USM_ACCESS
@ PI_USM_ACCESS
Definition: pi.h:1597
PI_DEVICE_INFO_PROFILE
@ PI_DEVICE_INFO_PROFILE
Definition: pi.h:245
piextPluginGetOpaqueData
pi_result piextPluginGetOpaqueData(void *, void **OpaqueDataReturn)
API to get Plugin internal data, opaque to SYCL RT.
Definition: pi_esimd_emulator.cpp:1965
PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH
@ PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH
Definition: pi.h:212
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR
Definition: pi.h:197
_pi_device::CmDevicePtr
cm_support::CmDevice * CmDevicePtr
Definition: pi_esimd_emulator.hpp:89
piProgramGetInfo
pi_result piProgramGetInfo(pi_program, pi_program_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1303
PI_DEVICE_INFO_DOUBLE_FP_CONFIG
@ PI_DEVICE_INFO_DOUBLE_FP_CONFIG
Definition: pi.h:188
piDeviceGetInfo
pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
Returns requested info for provided native device Return PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT fo...
Definition: pi_esimd_emulator.cpp:592
_pi_context_info
_pi_context_info
Definition: pi.h:304
PI_MEM_TYPE_IMAGE1D
@ PI_MEM_TYPE_IMAGE1D
Definition: pi.h:406
pi_buff_rect_offset_struct
Definition: pi.h:823
piContextCreate
pi_result piContextCreate(const pi_context_properties *Properties, pi_uint32 NumDevices, const pi_device *Devices, void(*PFnNotify)(const char *ErrInfo, const void *PrivateInfo, size_t CB, void *UserData), void *UserData, pi_context *RetContext)
Definition: pi_esimd_emulator.cpp:828
_pi_image::Width
size_t Width
Definition: pi_esimd_emulator.hpp:196
piextProgramCreateWithNativeHandle
pi_result piextProgramCreateWithNativeHandle(pi_native_handle, pi_context, bool, pi_program *)
Creates PI program object from a native handle.
Definition: pi_esimd_emulator.cpp:1339
PI_DEVICE_INFO_DRIVER_VERSION
@ PI_DEVICE_INFO_DRIVER_VERSION
Definition: pi.h:244
piProgramCreate
pi_result piProgramCreate(pi_context, const void *, size_t, pi_program *)
Definition: pi_esimd_emulator.cpp:1281
piextUSMFree
pi_result piextUSMFree(pi_context Context, void *Ptr)
Indicates that the allocated USM memory is no longer needed on the runtime side.
Definition: pi_esimd_emulator.cpp:1889
InvokeKernel
void InvokeKernel(KernelInvocationContext< NDims > *ctx)
Definition: pi_esimd_emulator.cpp:211
PI_DEVICE_INFO_GPU_EU_COUNT
@ PI_DEVICE_INFO_GPU_EU_COUNT
Definition: pi.h:268
pi_bool
pi_uint32 pi_bool
Definition: pi.h:101
PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565
@ PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565
Definition: pi.h:450
IDBuilder
sycl::detail::Builder IDBuilder
Definition: pi_esimd_emulator.cpp:170
PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT
@ PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT
Definition: pi.h:459
PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC
@ PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC
Definition: pi.h:250
_pi_image_format::image_channel_data_type
pi_image_channel_type image_channel_data_type
Definition: pi.h:901
ErrorMessage
thread_local char ErrorMessage[MaxMessageSize]
Definition: pi_esimd_emulator.cpp:154
piextKernelSetArgSampler
pi_result piextKernelSetArgSampler(pi_kernel, pi_uint32, const pi_sampler *)
Definition: pi_esimd_emulator.cpp:1357
sycl_get_cm_image_params
void sycl_get_cm_image_params(unsigned int IndexInput, char **BaseAddr, uint32_t *Width, uint32_t *Height, uint32_t *Bpp, std::mutex **ImgMtxLock)
Definition: pi_esimd_emulator.cpp:298
piQueueFinish
pi_result piQueueFinish(pi_queue)
Definition: pi_esimd_emulator.cpp:978
ARG_UNUSED
#define ARG_UNUSED(x)
Definition: pi_esimd_emulator.cpp:47
type_traits.hpp
PI_DEVICE_INFO_NAME
@ PI_DEVICE_INFO_NAME
Definition: pi.h:242
piProgramCreateWithBinary
pi_result piProgramCreateWithBinary(pi_context, pi_uint32, const pi_device *, const size_t *, const unsigned char **, size_t, const pi_device_binary_property *, pi_int32 *, pi_program *)
Creates a PI program for a context and loads the given binary into it.
Definition: pi_esimd_emulator.cpp:1285
KernelInvocationContext::Func
KernelFunc< NDims > Func
Definition: pi_esimd_emulator.cpp:180
PI_DEVICE_INFO_IL_VERSION
@ PI_DEVICE_INFO_IL_VERSION
Definition: pi.h:241
_pi_mem::Mappings
std::unordered_map< void *, Mapping > Mappings
Definition: pi_esimd_emulator.hpp:163
PI_IMAGE_CHANNEL_TYPE_UNORM_INT8
@ PI_IMAGE_CHANNEL_TYPE_UNORM_INT8
Definition: pi.h:448
piclProgramCreateWithBinary
pi_result piclProgramCreateWithBinary(pi_context, pi_uint32, const pi_device *, const size_t *, const unsigned char **, pi_int32 *, pi_program *)
Definition: pi_esimd_emulator.cpp:1292
_pi_buffer
Definition: pi_esimd_emulator.hpp:179
piextDeviceGetNativeHandle
pi_result piextDeviceGetNativeHandle(pi_device, pi_native_handle *)
Gets the native handle of a PI device object.
Definition: pi_esimd_emulator.cpp:819
_pi_platform::PiDeviceCacheMutex
std::mutex PiDeviceCacheMutex
Definition: pi_esimd_emulator.hpp:71
PI_MEM_FLAGS_HOST_PTR_COPY
constexpr pi_mem_flags PI_MEM_FLAGS_HOST_PTR_COPY
Definition: pi.h:537
piextUSMEnqueueMemcpy
pi_result piextUSMEnqueueMemcpy(pi_queue, pi_bool, void *, const void *, size_t, pi_uint32, const pi_event *, pi_event *)
USM Memcpy API.
Definition: pi_esimd_emulator.cpp:1922
piKernelSetArg
pi_result piKernelSetArg(pi_kernel, pi_uint32, size_t, const void *)
Definition: pi_esimd_emulator.cpp:1348
common.hpp
_pi_image
Definition: pi_esimd_emulator.hpp:188
_pi_image_format::image_channel_order
pi_image_channel_order image_channel_order
Definition: pi.h:900
PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN
@ PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN
Definition: pi.h:254
PI_DEVICE_INFO_IMAGE_SRGB
@ PI_DEVICE_INFO_IMAGE_SRGB
Definition: pi.h:274
_pi_image_desc::image_type
pi_mem_type image_type
Definition: pi.h:905
piEventCreate
pi_result piEventCreate(pi_context, pi_event *)
Definition: pi_esimd_emulator.cpp:1380
_pi_plugin
Definition: pi.h:1784
RangeBuilder
Definition: pi_esimd_emulator.cpp:190
PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE
@ PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE
Definition: pi.h:220
sycl::_V1::ext::intel::experimental::esimd::split_barrier
__ESIMD_API void split_barrier()
Generic work-group split barrier.
Definition: memory.hpp:30
_pi_mem_advice
_pi_mem_advice
Definition: pi.h:411
piSamplerRelease
pi_result piSamplerRelease(pi_sampler)
Definition: pi_esimd_emulator.cpp:1475
piSamplerGetInfo
pi_result piSamplerGetInfo(pi_sampler, pi_sampler_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1468
piDeviceRelease
pi_result piDeviceRelease(pi_device Device)
Definition: pi_esimd_emulator.cpp:582
RangeBuilder< 1 >::create
static sycl::range< 1 > create(Gen G)
Definition: pi_esimd_emulator.cpp:193
libCMBatch::libCMBatch
libCMBatch(const KernelFunc< DIMS > &Kernel)
Definition: pi_esimd_emulator.cpp:252
PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES
@ PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES
Definition: pi.h:184
cm_surface_ptr_t
Definition: pi_esimd_emulator.hpp:118
piEnqueueEventsWaitWithBarrier
pi_result piEnqueueEventsWaitWithBarrier(pi_queue, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1482
PI_DEVICE_INFO_MAX_COMPUTE_UNITS
@ PI_DEVICE_INFO_MAX_COMPUTE_UNITS
Definition: pi.h:182
PrintPiTrace
static bool PrintPiTrace
Definition: pi_esimd_emulator.cpp:114
piEventSetCallback
pi_result piEventSetCallback(pi_event, pi_int32, void(*)(pi_event, pi_int32, void *), void *)
Definition: pi_esimd_emulator.cpp:1417
_pi_plugin::PluginVersion
char PluginVersion[20]
Definition: pi.h:1794
piEnqueueMemUnmap
pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
Definition: pi_esimd_emulator.cpp:1630
_pi_result
_pi_result
Definition: pi.h:110
InvokeImpl
Definition: pi_esimd_emulator.cpp:353
piextProgramGetNativeHandle
pi_result piextProgramGetNativeHandle(pi_program, pi_native_handle *)
Gets the native handle of a PI program object.
Definition: pi_esimd_emulator.cpp:1335
ErrorMessageCode
thread_local pi_result ErrorMessageCode
Definition: pi_esimd_emulator.cpp:153
pi_context_properties
intptr_t pi_context_properties
Definition: pi.h:492
pi_esimd_emulator.hpp
PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8
@ PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8
Definition: pi.h:453
PI_DEVICE_INFO_GPU_SLICES
@ PI_DEVICE_INFO_GPU_SLICES
Definition: pi.h:270
PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE
@ PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE
Definition: pi.h:206
_pi_device_type
_pi_device_type
Definition: pi.h:157
piextPlatformCreateWithNativeHandle
pi_result piextPlatformCreateWithNativeHandle(pi_native_handle, pi_platform *)
Creates PI platform object from a native handle.
Definition: pi_esimd_emulator.cpp:480
_pi_event::CmEventPtr
cm_support::CmEvent * CmEventPtr
Definition: pi_esimd_emulator.hpp:204
piDevicePartition
pi_result piDevicePartition(pi_device, const pi_device_partition_property *, pi_uint32, pi_device *, pi_uint32 *)
Definition: pi_esimd_emulator.cpp:814
PI_DEVICE_INFO_REFERENCE_COUNT
@ PI_DEVICE_INFO_REFERENCE_COUNT
Definition: pi.h:240
PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT
@ PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT
Definition: pi.h:262
PI_DEVICE_INFO_PLATFORM
@ PI_DEVICE_INFO_PLATFORM
Definition: pi.h:239
PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE
@ PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE
Definition: pi.h:272
PI_DEVICE_LOCAL_MEM_TYPE_LOCAL
@ PI_DEVICE_LOCAL_MEM_TYPE_LOCAL
Definition: pi.h:175
helpers.hpp
host_profiling_info.hpp
piEventGetInfo
pi_result piEventGetInfo(pi_event, pi_event_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1382
PI_IMAGE_CHANNEL_TYPE_SNORM_INT16
@ PI_IMAGE_CHANNEL_TYPE_SNORM_INT16
Definition: pi.h:447
PI_DEVICE_INFO_ADDRESS_BITS
@ PI_DEVICE_INFO_ADDRESS_BITS
Definition: pi.h:205
_pi_image_desc::image_height
size_t image_height
Definition: pi.h:907
_pi_platform
A PI platform stores all known PI devices, in the CUDA plugin this is just a vector of available devi...
Definition: pi_cuda.hpp:73
piPluginGetLastError
pi_result piPluginGetLastError(char **message)
API to get Plugin specific warning and error messages.
Definition: pi_esimd_emulator.cpp:165
sycl::_V1::detail::memcpy
void memcpy(void *Dst, const void *Src, std::size_t Size)
CASE_PI_UNSUPPORTED
#define CASE_PI_UNSUPPORTED(not_supported)
Definition: pi_esimd_emulator.cpp:391
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE
Definition: pi.h:195
PI_DEVICE_INFO_MAX_SAMPLERS
@ PI_DEVICE_INFO_MAX_SAMPLERS
Definition: pi.h:217
pi_image_offset_struct::y
size_t y
Definition: pi.h:843
PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS
@ PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS
Definition: pi.h:256
PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN
@ PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN
Definition: pi.h:219
PI_DEVICE_INFO_BUILT_IN_KERNELS
@ PI_DEVICE_INFO_BUILT_IN_KERNELS
Definition: pi.h:238
PI_DEVICE_INFO_USM_DEVICE_SUPPORT
@ PI_DEVICE_INFO_USM_DEVICE_SUPPORT
Definition: pi.h:260
PI_PLATFORM_INFO_NAME
@ PI_PLATFORM_INFO_NAME
Definition: pi.h:127
PI_FP_ROUND_TO_NEAREST
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:633
PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE
@ PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE
Definition: pi.h:216
_pi_device_info
_pi_device_info
Definition: pi.h:179
PI_USM_ATOMIC_ACCESS
@ PI_USM_ATOMIC_ACCESS
Definition: pi.h:1598
PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE
@ PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE
Definition: pi.h:224
pi_image_offset_struct::x
size_t x
Definition: pi.h:842
_pi_image_info
_pi_image_info
Definition: pi.h:344
group.hpp
libCMBatch::runIterationSpace
void runIterationSpace(const sycl::range< DIMS > &LocalSize, const sycl::range< DIMS > &GlobalSize, const sycl::id< DIMS > &GlobalOffset)
Definition: pi_esimd_emulator.cpp:255
piQueueRetain
pi_result piQueueRetain(pi_queue Queue)
Definition: pi_esimd_emulator.cpp:956
piextMemCreateWithNativeHandle
pi_result piextMemCreateWithNativeHandle(pi_native_handle, pi_context, bool, pi_mem *)
Creates PI mem object from a native handle.
Definition: pi_esimd_emulator.cpp:1276
id.hpp
isNull
static bool isNull(int NDims, const size_t *R)
Implementation for Host Kernel Launch used by piEnqueueKernelLaunch.
Definition: pi_esimd_emulator.cpp:341
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT
Definition: pi.h:192
_pi_kernel
Implementation of a PI Kernel for CUDA.
Definition: pi_cuda.hpp:774
PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT
@ PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT
Definition: pi.h:228
piextKernelCreateWithNativeHandle
pi_result piextKernelCreateWithNativeHandle(pi_native_handle, pi_context, pi_program, bool, pi_kernel *)
Creates PI kernel object from a native handle.
Definition: pi_esimd_emulator.cpp:1820
PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT
@ PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT
Definition: pi.h:211
piEventsWait
pi_result piEventsWait(pi_uint32 NumEvents, const pi_event *EventList)
Definition: pi_esimd_emulator.cpp:1399
PI_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
constexpr pi_queue_properties PI_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
Definition: pi.h:567
PiPlatformCachePopulated
static bool PiPlatformCachePopulated
Definition: pi_level_zero.cpp:427
piextQueueGetNativeHandle
pi_result piextQueueGetNativeHandle(pi_queue, pi_native_handle *)
Gets the native handle of a PI queue object.
Definition: pi_esimd_emulator.cpp:992
_pi_plugin::PiVersion
char PiVersion[20]
Definition: pi.h:1792
PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE
@ PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE
Definition: pi.h:222
PI_DEVICE_EXEC_CAPABILITIES_KERNEL
constexpr pi_device_exec_capabilities PI_DEVICE_EXEC_CAPABILITIES_KERNEL
Definition: pi.h:495
piextDeviceCreateWithNativeHandle
pi_result piextDeviceCreateWithNativeHandle(pi_native_handle, pi_platform, pi_device *)
Creates PI device object from a native handle.
Definition: pi_esimd_emulator.cpp:823
piMemBufferPartition
pi_result piMemBufferPartition(pi_mem, pi_mem_flags, pi_buffer_create_type, void *, pi_mem *)
Definition: pi_esimd_emulator.cpp:1753
cm_surface_ptr_t::RegularBufPtr
cm_support::CmBuffer * RegularBufPtr
Definition: pi_esimd_emulator.hpp:132
_pi_mem::Context
pi_context Context
Definition: pi_esimd_emulator.hpp:140
piEnqueueNativeKernel
pi_result piEnqueueNativeKernel(pi_queue, void(*)(void *), void *, size_t, pi_uint32, const pi_mem *, const void **, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1829
_pi_queue_info
_pi_queue_info
Definition: pi.h:315
_pi_mem::~_pi_mem
~_pi_mem()
Definition: pi_cuda.hpp:363
_pi_buffer_create_type
_pi_buffer_create_type
Definition: pi.h:463
piEnqueueMemImageRead
pi_result piEnqueueMemImageRead(pi_queue CommandQueue, pi_mem Image, pi_bool BlockingRead, pi_image_offset Origin, pi_image_region Region, size_t RowPitch, size_t SlicePitch, void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
Definition: pi_esimd_emulator.cpp:1670
piKernelGetSubGroupInfo
pi_result piKernelGetSubGroupInfo(pi_kernel, pi_device, pi_kernel_sub_group_info, size_t, const void *, size_t, void *, size_t *)
API to query information from the sub-group from a kernel.
Definition: pi_esimd_emulator.cpp:1370
piextUSMEnqueueMemAdvise
pi_result piextUSMEnqueueMemAdvise(pi_queue, const void *, size_t, pi_mem_advice, pi_event *)
USM Memadvise API.
Definition: pi_esimd_emulator.cpp:1927
sycl::_V1::ext::intel::esimd::barrier
__ESIMD_API void barrier()
Generic work-group barrier.
Definition: memory.hpp:914
export.hpp
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF
Definition: pi.h:203
piDevicesGet
pi_result piDevicesGet(pi_platform Platform, pi_device_type DeviceType, pi_uint32 NumEntries, pi_device *Devices, pi_uint32 *NumDevices)
Definition: pi_esimd_emulator.cpp:484
cm_surface_ptr_t::RegularImgPtr
cm_support::CmSurface2D * RegularImgPtr
Definition: pi_esimd_emulator.hpp:134
piEnqueueMemBufferReadRect
pi_result piEnqueueMemBufferReadRect(pi_queue, pi_mem, pi_bool, pi_buff_rect_offset, pi_buff_rect_offset, pi_buff_rect_region, size_t, size_t, size_t, size_t, void *, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1545
PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE
@ PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE
Definition: pi.h:215
piEnqueueMemBufferWrite
pi_result piEnqueueMemBufferWrite(pi_queue, pi_mem, pi_bool, size_t, size_t, const void *, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1553
PI_DEVICE_INFO_LOCAL_MEM_SIZE
@ PI_DEVICE_INFO_LOCAL_MEM_SIZE
Definition: pi.h:227
piKernelSetExecInfo
pi_result piKernelSetExecInfo(pi_kernel, pi_kernel_exec_info, size_t, const void *)
API to set attributes controlling kernel execution.
Definition: pi_esimd_emulator.cpp:1937
piSamplerCreate
pi_result piSamplerCreate(pi_context, const pi_sampler_properties *, pi_sampler *)
Definition: pi_esimd_emulator.cpp:1463
piEnqueueMemBufferMap
pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem MemObj, pi_bool BlockingMap, pi_map_flags MapFlags, size_t Offset, size_t Size, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event, void **RetMap)
Definition: pi_esimd_emulator.cpp:1587
_pi_queue
PI queue mapping on to CUstream objects.
Definition: pi_cuda.hpp:393
_pi_context::Addr2CmBufferSVMLock
std::mutex Addr2CmBufferSVMLock
Definition: pi_esimd_emulator.hpp:104
PiPlatformCacheLock
static std::mutex * PiPlatformCacheLock
Definition: pi_esimd_emulator.cpp:132
PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16
@ PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16
Definition: pi.h:454
piextKernelSetArgMemObj
pi_result piextKernelSetArgMemObj(pi_kernel, pi_uint32, const pi_mem *)
Definition: pi_esimd_emulator.cpp:1352
PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32
@ PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32
Definition: pi.h:455
_pi_mem::MapHostPtr
char * MapHostPtr
Definition: pi_esimd_emulator.hpp:143
PI_DEVICE_TYPE_GPU
@ PI_DEVICE_TYPE_GPU
A PI device that is a GPU.
Definition: pi.h:162
pi_uint32
uint32_t pi_uint32
Definition: pi.h:99
piProgramCompile
pi_result piProgramCompile(pi_program, pi_uint32, const pi_device *, const char *, pi_uint32, const pi_program *, const char **, void(*)(pi_program, void *), void *)
Definition: pi_esimd_emulator.cpp:1314
cm_surface_ptr_t::tag
SurfaceType tag
Definition: pi_esimd_emulator.hpp:129
kernel.hpp
pi_buff_rect_region_struct
Definition: pi.h:832
pi_device_binary_struct
This struct is a record of the device binary information.
Definition: pi.h:766
sycl::_V1::ext::intel::esimd::SurfaceIndex
unsigned int SurfaceIndex
Surface index type.
Definition: common.hpp:64
piextMemGetNativeHandle
pi_result piextMemGetNativeHandle(pi_mem, pi_native_handle *)
Gets the native handle of a PI mem object.
Definition: pi_esimd_emulator.cpp:1272
KernelInvocationContext
Definition: pi_esimd_emulator.cpp:179
piextContextGetNativeHandle
pi_result piextContextGetNativeHandle(pi_context, pi_native_handle *)
Gets the native handle of a PI context object.
Definition: pi_esimd_emulator.cpp:869
PI_DEVICE_INFO_LINKER_AVAILABLE
@ PI_DEVICE_INFO_LINKER_AVAILABLE
Definition: pi.h:234
PI_DEVICE_INFO_EXECUTION_CAPABILITIES
@ PI_DEVICE_INFO_EXECUTION_CAPABILITIES
Definition: pi.h:235
piPlatformGetInfo
pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
Definition: pi_esimd_emulator.cpp:444
PiESimdSurfaceMap
static std::unordered_map< unsigned int, _pi_mem * > * PiESimdSurfaceMap
Definition: pi_esimd_emulator.cpp:135
PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION
@ PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION
Definition: pi.h:230
_pi_kernel_exec_info
_pi_kernel_exec_info
Definition: pi.h:1290
_pi_mem::SurfacePtr
cm_surface_ptr_t SurfacePtr
Definition: pi_esimd_emulator.hpp:167
PI_MEM_TYPE_IMAGE2D
@ PI_MEM_TYPE_IMAGE2D
Definition: pi.h:403
_pi_platform::PiDeviceCache
std::unique_ptr< _pi_device > PiDeviceCache
Definition: pi_esimd_emulator.hpp:70
piContextGetInfo
pi_result piContextGetInfo(pi_context, pi_context_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:859
range.hpp
PI_DEVICE_INFO_HALF_FP_CONFIG
@ PI_DEVICE_INFO_HALF_FP_CONFIG
Definition: pi.h:187
piEnqueueMemBufferWriteRect
pi_result piEnqueueMemBufferWriteRect(pi_queue, pi_mem, pi_bool, pi_buff_rect_offset, pi_buff_rect_offset, pi_buff_rect_region, size_t, size_t, size_t, size_t, const void *, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1559
PI_FP_DENORM
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:631
pi_mem_flags
pi_bitfield pi_mem_flags
Definition: pi.h:531
PI_IMAGE_CHANNEL_TYPE_FLOAT
@ PI_IMAGE_CHANNEL_TYPE_FLOAT
Definition: pi.h:460
piextProgramSetSpecializationConstant
pi_result piextProgramSetSpecializationConstant(pi_program, pi_uint32, size_t, const void *)
Sets a specialization constant to a specific value.
Definition: pi_esimd_emulator.cpp:1942
PI_USM_CONCURRENT_ACCESS
@ PI_USM_CONCURRENT_ACCESS
Definition: pi.h:1599
_pi_platform::DeviceCachePopulated
bool DeviceCachePopulated
Definition: pi_esimd_emulator.hpp:72
PI_DEVICE_INFO_VENDOR
@ PI_DEVICE_INFO_VENDOR
Definition: pi.h:243
pi_context_extended_deleter
void(* pi_context_extended_deleter)(void *user_data)
Definition: pi.h:1056
PI_MEM_TYPE_IMAGE1D_ARRAY
@ PI_MEM_TYPE_IMAGE1D_ARRAY
Definition: pi.h:407
piextGetDeviceFunctionPointer
pi_result piextGetDeviceFunctionPointer(pi_device, pi_program, const char *, pi_uint64 *)
Retrieves a device function pointer to a user-defined function.
Definition: pi_esimd_emulator.cpp:1835
piMemGetInfo
pi_result piMemGetInfo(pi_mem, pi_mem_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1074
piextUSMEnqueuePrefetch
pi_result piextUSMEnqueuePrefetch(pi_queue, const void *, size_t, pi_usm_migration_flags, pi_uint32, const pi_event *, pi_event *)
Hint to migrate memory to the device.
Definition: pi_esimd_emulator.cpp:1959
InvokeImpl::invoke
static void invoke(pi_kernel Kernel, const size_t *GlobalWorkOffset, const size_t *GlobalWorkSize, const size_t *LocalWorkSize)
Definition: pi_esimd_emulator.cpp:364
PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT
@ PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT
Definition: pi.h:263
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT
Definition: pi.h:191
Device
@ Device
Definition: usm_allocator.hpp:14
piextUSMGetMemAllocInfo
pi_result piextUSMGetMemAllocInfo(pi_context, const void *, pi_mem_alloc_info, size_t, void *, size_t *)
API to query information about USM allocated pointers Valid Queries: PI_MEM_ALLOC_TYPE returns host/d...
Definition: pi_esimd_emulator.cpp:1932
ESIMDEmuPluginDataVersion
#define ESIMDEmuPluginDataVersion
Definition: pi_esimd_emulator.cpp:142
piKernelGetInfo
pi_result piKernelGetInfo(pi_kernel, pi_kernel_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1361
PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE
@ PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE
Definition: pi.h:221
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG
Definition: pi.h:200
piextKernelSetArgPointer
pi_result piextKernelSetArgPointer(pi_kernel, pi_uint32, size_t, const void *)
Sets up pointer arguments for CL kernels.
Definition: pi_esimd_emulator.cpp:1913
piextEventGetNativeHandle
pi_result piextEventGetNativeHandle(pi_event, pi_native_handle *)
Gets the native handle of a PI event object.
Definition: pi_esimd_emulator.cpp:1455
_pi_platform::CmEmuVersion
std::string CmEmuVersion
Definition: pi_esimd_emulator.hpp:78
common.hpp
piextContextSetExtendedDeleter
pi_result piextContextSetExtendedDeleter(pi_context, pi_context_extended_deleter, void *)
Definition: pi_esimd_emulator.cpp:864
PI_DEVICE_INFO_USM_HOST_SUPPORT
@ PI_DEVICE_INFO_USM_HOST_SUPPORT
Definition: pi.h:259
PI_MEM_FLAGS_HOST_PTR_USE
constexpr pi_mem_flags PI_MEM_FLAGS_HOST_PTR_USE
Definition: pi.h:536
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT
Definition: pi.h:201
piEnqueueMemBufferCopyRect
pi_result piEnqueueMemBufferCopyRect(pi_queue, pi_mem, pi_mem, pi_buff_rect_offset, pi_buff_rect_offset, pi_buff_rect_region, size_t, size_t, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1573
piTearDown
pi_result piTearDown(void *)
API to notify that the plugin should clean up its resources.
Definition: pi_esimd_emulator.cpp:1970
ESIMDEmuPluginInterfaceVersion
#define ESIMDEmuPluginInterfaceVersion
Definition: pi_esimd_emulator.cpp:146
piEnqueueEventsWait
pi_result piEnqueueEventsWait(pi_queue, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1477
PiESimdDeviceAccess
static sycl::detail::ESIMDEmuPluginOpaqueData * PiESimdDeviceAccess
Definition: pi_esimd_emulator.cpp:127
PI_DEVICE_INFO_PARENT_DEVICE
@ PI_DEVICE_INFO_PARENT_DEVICE
Definition: pi.h:251
PI_PLATFORM_INFO_VERSION
@ PI_PLATFORM_INFO_VERSION
Definition: pi.h:130
PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16
@ PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16
Definition: pi.h:457
PI_FP_ROUND_TO_INF
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:635
pi_uint64
uint64_t pi_uint64
Definition: pi.h:100
PI_DEVICE_INFO_PARTITION_TYPE
@ PI_DEVICE_INFO_PARTITION_TYPE
Definition: pi.h:255
sycl::_V1::ext::intel::esimd::detail::SLM_BTI
static constexpr SurfaceIndex SLM_BTI
Definition: common.hpp:98
_pi_event_info
_pi_event_info
Definition: pi.h:361
piMemBufferCreate
pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size, void *HostPtr, pi_mem *RetMem, const pi_mem_properties *properties)
Definition: pi_esimd_emulator.cpp:1001
_pi_image::BytesPerPixel
size_t BytesPerPixel
Definition: pi_esimd_emulator.hpp:198
_pi_sampler_info
_pi_sampler_info
Definition: pi.h:468
_pi_device_binary_property_struct
Definition: pi.h:669
pi_mem_properties
pi_bitfield pi_mem_properties
Definition: pi.h:547
pi_device_exec_capabilities
pi_bitfield pi_device_exec_capabilities
Definition: pi.h:494
_pi_program
Implementation of PI Program on CUDA Module object.
Definition: pi_cuda.hpp:719
_pi_sampler
Implementation of samplers for CUDA.
Definition: pi_cuda.hpp:945
PI_DEVICE_INFO_PRINTF_BUFFER_SIZE
@ PI_DEVICE_INFO_PRINTF_BUFFER_SIZE
Definition: pi.h:249
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE
Definition: pi.h:202
_PI_ESIMD_PLUGIN_VERSION_STRING
#define _PI_ESIMD_PLUGIN_VERSION_STRING
Definition: pi_esimd_emulator.hpp:31
PI_PLATFORM_INFO_PROFILE
@ PI_PLATFORM_INFO_PROFILE
Definition: pi.h:128
PI_DEVICE_INFO_MAX_CONSTANT_ARGS
@ PI_DEVICE_INFO_MAX_CONSTANT_ARGS
Definition: pi.h:225
PI_DEVICE_INFO_PCI_ADDRESS
@ PI_DEVICE_INFO_PCI_ADDRESS
Definition: pi.h:267
pi_native_handle
uintptr_t pi_native_handle
Definition: pi.h:103
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT
Definition: pi.h:198
PI_DEVICE_INFO_GLOBAL_MEM_SIZE
@ PI_DEVICE_INFO_GLOBAL_MEM_SIZE
Definition: pi.h:223
InvokeImpl::get_range
static sycl::range< NDims > get_range(const size_t *Array)
Definition: pi_esimd_emulator.cpp:355
pi_sampler_properties
pi_bitfield pi_sampler_properties
Definition: pi.h:500
piKernelRetain
pi_result piKernelRetain(pi_kernel)
Definition: pi_esimd_emulator.cpp:1376
PI_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE
@ PI_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE
Definition: pi.h:171
PI_MEM_FLAGS_ACCESS_RW
constexpr pi_mem_flags PI_MEM_FLAGS_ACCESS_RW
Definition: pi.h:533
accessor_impl.hpp
_pi_event::release
pi_result release()
Definition: pi_cuda.cpp:602
cm_surface_ptr_t::TypeRegularImage
@ TypeRegularImage
Definition: pi_esimd_emulator.hpp:126
piclProgramCreateWithSource
pi_result piclProgramCreateWithSource(pi_context, pi_uint32, const char **, const size_t *, pi_program *)
Definition: pi_esimd_emulator.cpp:1298
_pi_image::Height
size_t Height
Definition: pi_esimd_emulator.hpp:197
_pi_image_format
Definition: pi.h:899
PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010
@ PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010
Definition: pi.h:452
PI_PLATFORM_INFO_VENDOR
@ PI_PLATFORM_INFO_VENDOR
Definition: pi.h:129
_pi_kernel_info
_pi_kernel_info
Definition: pi.h:324
piKernelRelease
pi_result piKernelRelease(pi_kernel)
Definition: pi_esimd_emulator.cpp:1378
PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT
@ PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT
Definition: pi.h:261
sycl::_V1::detail::pi::die
void die(const char *Message)
Definition: pi.cpp:542
PI_IMAGE_CHANNEL_ORDER_RGBA
@ PI_IMAGE_CHANNEL_ORDER_RGBA
Definition: pi.h:433
cm_surface_ptr_t::UPBufPtr
cm_support::CmBufferUP * UPBufPtr
Definition: pi_esimd_emulator.hpp:133
PI_DEVICE_INFO_QUEUE_PROPERTIES
@ PI_DEVICE_INFO_QUEUE_PROPERTIES
Definition: pi.h:189
PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES
@ PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES
Definition: pi.h:253
sycl::_V1::detail::getNextPowerOfTwo
constexpr size_t getNextPowerOfTwo(size_t Var)
Definition: common.hpp:367
PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D
Definition: pi.h:288
piextPlatformGetNativeHandle
pi_result piextPlatformGetNativeHandle(pi_platform, pi_native_handle *)
Gets the native handle of a PI platform object.
Definition: pi_esimd_emulator.cpp:476
KernelFunc
std::function< void(const sycl::nd_item< NDims > &)> KernelFunc
Definition: pi_esimd_emulator.cpp:173
PI_MEM_TYPE_IMAGE1D_BUFFER
@ PI_MEM_TYPE_IMAGE1D_BUFFER
Definition: pi.h:408
piProgramBuild
pi_result piProgramBuild(pi_program, pi_uint32, const pi_device *, const char *, void(*)(pi_program, void *), void *)
Definition: pi_esimd_emulator.cpp:1321
KernelInvocationContext::GlobalSize
const sycl::range< NDims > & GlobalSize
Definition: pi_esimd_emulator.cpp:182
_pi_image_desc::image_width
size_t image_width
Definition: pi.h:906
piextUSMEnqueueMemset
pi_result piextUSMEnqueueMemset(pi_queue, void *, pi_int32, size_t, pi_uint32, const pi_event *, pi_event *)
USM Memset API.
Definition: pi_esimd_emulator.cpp:1917
PI_DEVICE_INFO_SINGLE_FP_CONFIG
@ PI_DEVICE_INFO_SINGLE_FP_CONFIG
Definition: pi.h:186
_PI_PLUGIN_VERSION_CHECK
#define _PI_PLUGIN_VERSION_CHECK(PI_API_VERSION, PI_PLUGIN_VERSION)
Definition: pi.h:77
piextUSMDeviceAlloc
pi_result piextUSMDeviceAlloc(void **, pi_context, pi_device, pi_usm_mem_properties *, size_t, pi_uint32)
Allocates device memory.
Definition: pi_esimd_emulator.cpp:1845
PI_DEVICE_INFO_BUILD_ON_SUBDEVICE
@ PI_DEVICE_INFO_BUILD_ON_SUBDEVICE
Definition: pi.h:276
_pi_context::Addr2CmBufferSVM
std::unordered_map< void *, cm_support::CmBufferSVM * > Addr2CmBufferSVM
Definition: pi_esimd_emulator.hpp:102
PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS
@ PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS
Definition: pi.h:183
PI_DEVICE_INFO_LOCAL_MEM_TYPE
@ PI_DEVICE_INFO_LOCAL_MEM_TYPE
Definition: pi.h:226
PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH
@ PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH
Definition: pi.h:214
PI_DEVICE_INFO_COMPILER_AVAILABLE
@ PI_DEVICE_INFO_COMPILER_AVAILABLE
Definition: pi.h:233
_PI_H_VERSION_STRING
#define _PI_H_VERSION_STRING
Definition: pi.h:71
PiESimdSurfaceMapLock
static std::mutex * PiESimdSurfaceMapLock
Definition: pi_esimd_emulator.cpp:138
PI_FP_FMA
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:636
pi_image_offset_struct::z
size_t z
Definition: pi.h:844
backend_types.hpp
PI_DEVICE_INFO_VERSION
@ PI_DEVICE_INFO_VERSION
Definition: pi.h:246
PI_DEVICE_INFO_MAX_MEM_BANDWIDTH
@ PI_DEVICE_INFO_MAX_MEM_BANDWIDTH
Definition: pi.h:273
PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8
@ PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8
Definition: pi.h:456
PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32
@ PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32
Definition: pi.h:458
piEnqueueMemBufferFill
pi_result piEnqueueMemBufferFill(pi_queue, pi_mem, const void *, size_t, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1581
pi_queue_properties
pi_bitfield pi_queue_properties
Definition: pi.h:566
PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_2D
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_2D
Definition: pi.h:287
PI_DEVICE_INFO_ATOMIC_64
@ PI_DEVICE_INFO_ATOMIC_64
Definition: pi.h:278
PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS
@ PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS
Definition: pi.h:209
_pi_platform_info
_pi_platform_info
Definition: pi.h:125
MaxMessageSize
constexpr size_t MaxMessageSize
Definition: pi_esimd_emulator.cpp:152
piEnqueueMemBufferCopy
pi_result piEnqueueMemBufferCopy(pi_queue, pi_mem, pi_mem, size_t, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1567
piProgramGetBuildInfo
pi_result piProgramGetBuildInfo(pi_program, pi_device, pi_program_build_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1326
piEnqueueMemBufferRead
pi_result piEnqueueMemBufferRead(pi_queue Queue, pi_mem Src, pi_bool BlockingRead, size_t Offset, size_t Size, void *Dst, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
Definition: pi_esimd_emulator.cpp:1487
PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555
@ PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555
Definition: pi.h:451
PI_IMAGE_CHANNEL_ORDER_ARGB
@ PI_IMAGE_CHANNEL_ORDER_ARGB
Definition: pi.h:435
_pi_image_desc
Definition: pi.h:904
PI_DEVICE_INFO_ENDIAN_LITTLE
@ PI_DEVICE_INFO_ENDIAN_LITTLE
Definition: pi.h:231
piQueueCreate
pi_result piQueueCreate(pi_context Context, pi_device Device, pi_queue_properties Properties, pi_queue *Queue)
Definition: pi_esimd_emulator.cpp:924
_pi_queue::CmQueuePtr
cm_support::CmQueue * CmQueuePtr
Definition: pi_esimd_emulator.hpp:115
piContextRelease
pi_result piContextRelease(pi_context Context)
Definition: pi_esimd_emulator.cpp:889
piQueueFlush
pi_result piQueueFlush(pi_queue)
Definition: pi_esimd_emulator.cpp:985
kernel_desc.hpp
_pi_event
PI Event mapping to CUevent.
Definition: pi_cuda.hpp:591
piQueueRelease
pi_result piQueueRelease(pi_queue Queue)
Definition: pi_esimd_emulator.cpp:964
DIE_NO_IMPLEMENTATION
#define DIE_NO_IMPLEMENTATION
Definition: pi_esimd_emulator.cpp:375
PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT
Definition: pi.h:199
PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS
@ PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS
Definition: pi.h:208
_pi_mem::MappingsMutex
std::mutex MappingsMutex
Definition: pi_esimd_emulator.hpp:165
PI_FP_INF_NAN
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:632
PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE
@ PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE
Definition: pi.h:271
piKernelCreate
pi_result piKernelCreate(pi_program, const char *, pi_kernel *)
Definition: pi_esimd_emulator.cpp:1344
piEventRelease
pi_result piEventRelease(pi_event Event)
Definition: pi_esimd_emulator.cpp:1434
ESimdEmuVersionString
static char ESimdEmuVersionString[32]
Definition: pi_esimd_emulator.cpp:149
PI_MEM_TYPE_IMAGE2D_ARRAY
@ PI_MEM_TYPE_IMAGE2D_ARRAY
Definition: pi.h:405
piMemRetain
pi_result piMemRetain(pi_mem Mem)
Definition: pi_esimd_emulator.cpp:1078
piKernelGetGroupInfo
pi_result piKernelGetGroupInfo(pi_kernel, pi_device, pi_kernel_group_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1365
_pi_mem_info
_pi_mem_info
Definition: pi.h:920
pi_image_offset_struct
Definition: pi.h:841
piMemRelease
pi_result piMemRelease(pi_mem Mem)
Definition: pi_esimd_emulator.cpp:1086
sycl::_V1::detail::pi::assertion
void assertion(bool Condition, const char *Message=nullptr)
Definition: pi.cpp:547
PiPlatformCache
static pi_platform PiPlatformCache
Definition: pi_esimd_emulator.cpp:130
cm_surface_ptr_t::TypeRegularBuffer
@ TypeRegularBuffer
Definition: pi_esimd_emulator.hpp:124
PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_1D
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_1D
Definition: pi.h:286
PI_DEVICE_INFO_VENDOR_ID
@ PI_DEVICE_INFO_VENDOR_ID
Definition: pi.h:181
piextEventCreateWithNativeHandle
pi_result piextEventCreateWithNativeHandle(pi_native_handle, pi_context, bool, pi_event *)
Creates PI event object from a native handle.
Definition: pi_esimd_emulator.cpp:1459
pi_image_region_struct
Definition: pi.h:850
piDeviceRetain
pi_result piDeviceRetain(pi_device Device)
Definition: pi_esimd_emulator.cpp:572
PI_DEVICE_INFO_EXTENSIONS
@ PI_DEVICE_INFO_EXTENSIONS
Definition: pi.h:248
piextUSMHostAlloc
pi_result piextUSMHostAlloc(void **, pi_context, pi_usm_mem_properties *, size_t, pi_uint32)
Allocates host memory accessible by the device.
Definition: pi_esimd_emulator.cpp:1840
piProgramRetain
pi_result piProgramRetain(pi_program)
Definition: pi_esimd_emulator.cpp:1331
KernelInvocationContext::LocalSize
const sycl::range< NDims > & LocalSize
Definition: pi_esimd_emulator.cpp:181
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT
Definition: pi.h:194
cm_surface_ptr_t::UPImgPtr
cm_support::CmSurface2DUP * UPImgPtr
Definition: pi_esimd_emulator.hpp:135
_pi_mem::SurfaceIndex
unsigned int SurfaceIndex
Definition: pi_esimd_emulator.hpp:149
_pi_usm_migration_flags
_pi_usm_migration_flags
Definition: pi.h:1620
KernelInvocationContext::GlobalOffset
const sycl::id< NDims > & GlobalOffset
Definition: pi_esimd_emulator.cpp:183
cm_surface_ptr_t::TypeUserProvidedBuffer
@ TypeUserProvidedBuffer
Definition: pi_esimd_emulator.hpp:125
piextContextCreateWithNativeHandle
pi_result piextContextCreateWithNativeHandle(pi_native_handle, pi_uint32, const pi_device *, bool, pi_context *)
Creates PI context object from a native handle.
Definition: pi_esimd_emulator.cpp:873
piEnqueueKernelLaunch
pi_result piEnqueueKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim, const size_t *GlobalWorkOffset, const size_t *GlobalWorkSize, const size_t *LocalWorkSize, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
Definition: pi_esimd_emulator.cpp:1759
PI_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
static constexpr pi_device_fp_config PI_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
Definition: pi.h:638
sycl_get_cm_surface_index
unsigned int sycl_get_cm_surface_index(void *PtrInput)
Definition: pi_esimd_emulator.cpp:273
_pi_platform::populateDeviceCacheIfNeeded
pi_result populateDeviceCacheIfNeeded()
Definition: pi_esimd_emulator.cpp:525
_pi_event::IsDummyEvent
bool IsDummyEvent
Definition: pi_esimd_emulator.hpp:207
nd_item.hpp
PI_DEVICE_INFO_TYPE
@ PI_DEVICE_INFO_TYPE
Definition: pi.h:180
piMemImageGetInfo
pi_result piMemImageGetInfo(pi_mem, pi_image_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:1666
PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE
@ PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE
Definition: pi.h:185
piPlatformsGet
pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms, pi_uint32 *NumPlatforms)
Definition: pi_esimd_emulator.cpp:401
_pi_program_info
_pi_program_info
Definition: pi.h:292
_pi_profiling_info
_pi_profiling_info
Definition: pi.h:520
RangeBuilder< 3 >::create
static sycl::range< 3 > create(Gen G)
Definition: pi_esimd_emulator.cpp:203
pi_device_affinity_domain
pi_bitfield pi_device_affinity_domain
Definition: pi.h:615
CONTINUE_NO_IMPLEMENTATION
#define CONTINUE_NO_IMPLEMENTATION
Definition: pi_esimd_emulator.cpp:383
PI_DEVICE_INFO_IMAGE_SUPPORT
@ PI_DEVICE_INFO_IMAGE_SUPPORT
Definition: pi.h:207
piMemImageCreate
pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, void *HostPtr, pi_mem *RetImage)
Definition: pi_esimd_emulator.cpp:1153
PI_QUEUE_ON_DEVICE
constexpr pi_queue_properties PI_QUEUE_ON_DEVICE
Definition: pi.h:569
PI_DEVICE_INFO_MAX_PARAMETER_SIZE
@ PI_DEVICE_INFO_MAX_PARAMETER_SIZE
Definition: pi.h:218
libCMBatch
Definition: pi_esimd_emulator.cpp:246
_pi_kernel_group_info
_pi_kernel_group_info
Definition: pi.h:333
PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL
@ PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL
Definition: pi.h:258
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF
Definition: pi.h:196
piEnqueueMemImageCopy
pi_result piEnqueueMemImageCopy(pi_queue, pi_mem, pi_mem, pi_image_offset, pi_image_offset, pi_image_region, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1741
_pi_mem::SurfaceLock
std::mutex SurfaceLock
Definition: pi_esimd_emulator.hpp:145
piProgramRelease
pi_result piProgramRelease(pi_program)
Definition: pi_esimd_emulator.cpp:1333
std::cout
__SYCL_EXTERN_STREAM_ATTRS ostream cout
Linked to standard output.
piContextRetain
pi_result piContextRetain(pi_context Context)
Definition: pi_esimd_emulator.cpp:879
_pi_mem_alloc_info
_pi_mem_alloc_info
Definition: pi.h:1603
PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY
@ PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY
Definition: pi.h:204
piEventSetStatus
pi_result piEventSetStatus(pi_event, pi_int32)
Definition: pi_esimd_emulator.cpp:1422
_pi_context::Device
pi_device Device
Definition: pi_esimd_emulator.hpp:98
PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH
@ PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH
Definition: pi.h:210
PI_DEVICE_INFO_AVAILABLE
@ PI_DEVICE_INFO_AVAILABLE
Definition: pi.h:232
sycl_get_cm_buffer_params
void sycl_get_cm_buffer_params(unsigned int IndexInput, char **BaseAddr, uint32_t *Width, std::mutex **BufMtxLock)
Definition: pi_esimd_emulator.cpp:281
pi_usm_mem_properties
pi_bitfield pi_usm_mem_properties
Definition: pi.h:553
pi_map_flags
pi_bitfield pi_map_flags
Definition: pi.h:541
piEventGetProfilingInfo
pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
Definition: pi_esimd_emulator.cpp:1386
PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT
@ PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT
Definition: pi.h:213
PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH
@ PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH
Definition: pi.h:269
_pi_program_build_info
_pi_program_build_info
Definition: pi.h:133
PI_MEM_TYPE_IMAGE3D
@ PI_MEM_TYPE_IMAGE3D
Definition: pi.h:404
_pi_event::OwnerQueue
cm_support::CmQueue * OwnerQueue
Definition: pi_esimd_emulator.hpp:205
piEnqueueMemImageWrite
pi_result piEnqueueMemImageWrite(pi_queue, pi_mem, pi_bool, pi_image_offset, pi_image_region, size_t, size_t, const void *, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1735
piQueueGetInfo
pi_result piQueueGetInfo(pi_queue, pi_queue_info, size_t, void *, size_t *)
Definition: pi_esimd_emulator.cpp:952
piSamplerRetain
pi_result piSamplerRetain(pi_sampler)
Definition: pi_esimd_emulator.cpp:1473
PI_USM_CONCURRENT_ATOMIC_ACCESS
@ PI_USM_CONCURRENT_ATOMIC_ACCESS
Definition: pi.h:1600
RangeBuilder< 2 >::create
static sycl::range< 2 > create(Gen G)
Definition: pi_esimd_emulator.cpp:198
piProgramLink
pi_result piProgramLink(pi_context, pi_uint32, const pi_device *, const char *, pi_uint32, const pi_program *, void(*)(pi_program, void *), void *, pi_program *)
Definition: pi_esimd_emulator.cpp:1308
PI_IMAGE_CHANNEL_TYPE_SNORM_INT8
@ PI_IMAGE_CHANNEL_TYPE_SNORM_INT8
Definition: pi.h:446
PiTrace
static void PiTrace(std::string TraceString)
Definition: pi_esimd_emulator.cpp:116
pi_device_partition_property
intptr_t pi_device_partition_property
Definition: pi.h:604
PI_FP_ROUND_TO_ZERO
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:634
PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG
Definition: pi.h:193
ConvertPiImageFormatToCmFormat
cm_support::CM_SURFACE_FORMAT ConvertPiImageFormatToCmFormat(const pi_image_format *PiFormat)
Definition: pi_esimd_emulator.cpp:1129
piextKernelGetNativeHandle
pi_result piextKernelGetNativeHandle(pi_kernel, pi_native_handle *)
Gets the native handle of a PI kernel object.
Definition: pi_esimd_emulator.cpp:1825
piEnqueueMemImageFill
pi_result piEnqueueMemImageFill(pi_queue, pi_mem, const void *, const size_t *, const size_t *, pi_uint32, const pi_event *, pi_event *)
Definition: pi_esimd_emulator.cpp:1747
pi_int32
int32_t pi_int32
Definition: pi.h:98
_pi_context
PI context mapping to a CUDA context object.
Definition: pi_cuda.hpp:160
piEventRetain
pi_result piEventRetain(pi_event Event)
Definition: pi_esimd_emulator.cpp:1424
PI_IMAGE_CHANNEL_TYPE_UNORM_INT16
@ PI_IMAGE_CHANNEL_TYPE_UNORM_INT16
Definition: pi.h:449
_pi_device
PI device mapping to a CUdevice.
Definition: pi_cuda.hpp:83
PI_DEVICE_INFO_PARTITION_PROPERTIES
@ PI_DEVICE_INFO_PARTITION_PROPERTIES
Definition: pi.h:252
_pi_kernel_sub_group_info
_pi_kernel_sub_group_info
Definition: pi.h:354
PI_PLATFORM_INFO_EXTENSIONS
@ PI_PLATFORM_INFO_EXTENSIONS
Definition: pi.h:126
_pi_context::checkSurfaceArgument
bool checkSurfaceArgument(pi_mem_flags Flags, void *HostPtr)
Definition: pi_esimd_emulator.cpp:907
piextQueueCreateWithNativeHandle
pi_result piextQueueCreateWithNativeHandle(pi_native_handle, pi_context, pi_device, bool, pi_queue *)
Creates PI queue object from a native handle.
Definition: pi_esimd_emulator.cpp:996
PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
@ PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
Definition: pi.h:257
_pi_buffer::Size
size_t Size
Definition: pi_esimd_emulator.hpp:185
PI_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES
@ PI_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES
Definition: pi.h:279
PI_EXT_ONEAPI_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS
Definition: pi.h:285