Blender  V3.3
oneapi/device_impl.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2021-2022 Intel Corporation */
3 
4 #ifdef WITH_ONEAPI
5 
6 # include "device/device.h"
7 # include "device/oneapi/device.h"
8 # include "device/oneapi/queue.h"
9 
10 # include "util/map.h"
11 
13 
14 class DeviceQueue;
15 
16 class OneapiDevice : public Device {
17  private:
18  SyclQueue *device_queue_;
19 
20  using ConstMemMap = map<string, device_vector<uchar> *>;
21  ConstMemMap const_mem_map_;
22  device_vector<TextureInfo> texture_info_;
23  bool need_texture_info_;
24  void *kg_memory_;
25  void *kg_memory_device_;
26  size_t kg_memory_size_ = (size_t)0;
27  size_t max_memory_on_device_ = (size_t)0;
28  OneAPIDLLInterface oneapi_dll_;
29  std::string oneapi_error_string_;
30 
31  public:
32  virtual BVHLayoutMask get_bvh_layout_mask() const override;
33 
34  OneapiDevice(const DeviceInfo &info,
35  OneAPIDLLInterface &oneapi_dll_object,
36  Stats &stats,
37  Profiler &profiler);
38 
39  virtual ~OneapiDevice();
40 
41  bool check_peer_access(Device *peer_device) override;
42 
43  bool load_kernels(const uint requested_features) override;
44 
45  void load_texture_info();
46 
47  void generic_alloc(device_memory &mem);
48 
49  void generic_copy_to(device_memory &mem);
50 
51  void generic_free(device_memory &mem);
52 
53  SyclQueue *sycl_queue();
54 
55  string oneapi_error_message();
56 
57  OneAPIDLLInterface oneapi_dll_object();
58 
59  void *kernel_globals_device_pointer();
60 
61  void mem_alloc(device_memory &mem) override;
62 
63  void mem_copy_to(device_memory &mem) override;
64 
65  void mem_copy_from(device_memory &mem, size_t y, size_t w, size_t h, size_t elem) override;
66 
67  void mem_copy_from(device_memory &mem)
68  {
69  mem_copy_from(mem, 0, 0, 0, 0);
70  }
71 
72  void mem_zero(device_memory &mem) override;
73 
74  void mem_free(device_memory &mem) override;
75 
76  device_ptr mem_alloc_sub_ptr(device_memory &mem, size_t offset, size_t /*size*/) override;
77 
78  virtual void const_copy_to(const char *name, void *host, size_t size) override;
79 
80  void global_alloc(device_memory &mem);
81 
82  void global_free(device_memory &mem);
83 
84  void tex_alloc(device_texture &mem);
85 
86  void tex_free(device_texture &mem);
87 
88  /* Graphics resources interoperability. */
89  virtual bool should_use_graphics_interop() override;
90 
91  virtual unique_ptr<DeviceQueue> gpu_queue_create() override;
92 
93  int get_num_multiprocessors();
94  int get_max_num_threads_per_multiprocessor();
95 
96  /* NOTE(@nsirgien): Create this methods to avoid some compilation problems on Windows with host
97  * side compilation (MSVC). */
98  void *usm_aligned_alloc_host(size_t memory_size, size_t alignment);
99  void usm_free(void *usm_ptr);
100 };
101 
103 
104 #endif
unsigned int uint
Definition: BLI_sys_types.h:67
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
virtual BVHLayoutMask get_bvh_layout_mask() const =0
virtual void const_copy_to(const char *name, void *host, size_t size)=0
virtual void mem_zero(device_memory &mem)=0
virtual void mem_copy_from(device_memory &mem, size_t y, size_t w, size_t h, size_t elem)=0
virtual unique_ptr< DeviceQueue > gpu_queue_create()
virtual bool load_kernels(uint)
virtual bool check_peer_access(Device *)
virtual void mem_free(device_memory &mem)=0
virtual void mem_copy_to(device_memory &mem)=0
virtual device_ptr mem_alloc_sub_ptr(device_memory &, size_t, size_t)
virtual void mem_alloc(device_memory &mem)=0
virtual bool should_use_graphics_interop()
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
int BVHLayoutMask
Definition: params.h:47
uint64_t device_ptr
Definition: util/types.h:43