MCPcopy Create free account
hub / github.com/blender/cycles / OneapiDevice

Method OneapiDevice

src/device/oneapi/device_impl.cpp:51–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler, bool headless)
52 : GPUDevice(info, stats, profiler, headless)
53{
54 /* Verify that base class types can be used with specific backend types */
55 static_assert(sizeof(texMemObject) ==
56 sizeof(sycl::ext::oneapi::experimental::sampled_image_handle));
57 static_assert(sizeof(arrayMemObject) ==
58 sizeof(sycl::ext::oneapi::experimental::image_mem_handle));
59
60 need_image_info = false;
61 use_hardware_raytracing = info.use_hardware_raytracing;
62
63 oneapi_set_error_cb(queue_error_cb, &oneapi_error_string_);
64
65 bool is_finished_ok = create_queue(device_queue_,
66 info.num,
67# ifdef WITH_EMBREE_GPU
68 use_hardware_raytracing ? (void *)&embree_device : nullptr,
69# else
70 nullptr,
71# endif
72 &is_several_intel_dgpu_devices_detected);
73
74 if (is_finished_ok == false) {
75 set_error("oneAPI queue initialization error: got runtime exception \"" +
76 oneapi_error_string_ + "\"");
77 }
78 else {
79 LOG_TRACE << "oneAPI queue has been successfully created for the device \"" << info.description
80 << "\"";
81 assert(device_queue_);
82 }
83
84# ifdef WITH_EMBREE_GPU
85 use_hardware_raytracing = use_hardware_raytracing && (embree_device != nullptr);
86# else
87 use_hardware_raytracing = false;
88# endif
89
90 if (use_hardware_raytracing) {
91 LOG_INFO << "oneAPI will use hardware ray tracing for intersection acceleration.";
92 }
93
94 size_t globals_segment_size;
95 is_finished_ok = kernel_globals_size(globals_segment_size);
96 if (is_finished_ok == false) {
97 set_error("oneAPI constant memory initialization got runtime exception \"" +
98 oneapi_error_string_ + "\"");
99 }
100 else {
101 LOG_TRACE << "Successfully created global/constant memory segment (kernel globals object)";
102 }
103
104 kg_memory_ = usm_aligned_alloc_host(device_queue_, globals_segment_size, 16);
105 usm_memset(device_queue_, kg_memory_, 0, globals_segment_size);
106
107 kg_memory_device_ = usm_alloc_device(device_queue_, globals_segment_size);
108

Callers

nothing calls this directly

Calls 3

oneapi_set_error_cbFunction · 0.85
set_errorFunction · 0.85

Tested by

no test coverage detected