Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
SyclAcceleratorRuntime.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* SyclAcceleratorRuntime.cc (C) 2000-2026 */
9/* */
10/* Runtime for 'SYCL'. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/accelerator_native/SyclAccelerator.h"
15
16#include "arccore/base/FatalErrorException.h"
17#include "arccore/base/NotImplementedException.h"
18#include "arccore/base/NotSupportedException.h"
19
20#include "arccore/common/AlignedMemoryAllocator.h"
21#include "arccore/common/AllocatedMemoryInfo.h"
22#include "arccore/common/internal/MemoryUtilsInternal.h"
23#include "arccore/common/internal/IMemoryResourceMngInternal.h"
24
25#include "arccore/common/accelerator/RunQueueBuildInfo.h"
26#include "arccore/common/accelerator/Memory.h"
27#include "arccore/common/accelerator/DeviceInfoList.h"
28#include "arccore/common/accelerator/KernelLaunchArgs.h"
29#include "arccore/common/accelerator/RunQueue.h"
30#include "arccore/common/accelerator/DeviceMemoryInfo.h"
31#include "arccore/common/accelerator/NativeStream.h"
32#include "arccore/common/accelerator/internal/IRunnerRuntime.h"
33#include "arccore/common/accelerator/internal/RegisterRuntimeInfo.h"
34#include "arccore/common/accelerator/internal/RunCommandImpl.h"
35#include "arccore/common/accelerator/internal/IRunQueueStream.h"
36#include "arccore/common/accelerator/internal/IRunQueueEventImpl.h"
37
38namespace Arcane::Accelerator::Sycl
39{
40using Arcane::Accelerator::Impl::KernelLaunchArgs;
41
42#define ARCCORE_SYCL_FUNC_NOT_HANDLED \
43 std::cout << "WARNING: SYCL: function not handled " << A_FUNCINFO << "\n"
44
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
50// This file is used for allocations.
51// It must therefore always exist because we do not know when
52// the last deallocation will occur.
53sycl::queue global_default_queue;
54namespace
55{
56 sycl::queue& _defaultQueue()
57 {
58 return global_default_queue;
59 }
60} // namespace
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
68class SyclMemoryAllocatorBase
69: public AlignedMemoryAllocator
70{
71 public:
72
73 SyclMemoryAllocatorBase()
74 : AlignedMemoryAllocator(128)
75 {}
76
77 bool hasRealloc(MemoryAllocationArgs) const override { return true; }
79 {
80 sycl::queue& q = _defaultQueue();
81 void* out = nullptr;
82 _allocate(&out, new_size, args, q);
83 if (!out)
84 ARCCORE_FATAL("Can not allocate memory size={0}", new_size);
85 Int64 a = reinterpret_cast<Int64>(out);
86 if ((a % 128) != 0)
87 ARCCORE_FATAL("Bad alignment for SYCL allocator: offset={0}", (a % 128));
88 return { out, new_size };
89 }
91 {
92 sycl::queue& q = _defaultQueue();
93 AllocatedMemoryInfo a = allocate(args, new_size);
94 q.submit([&](sycl::handler& cgh) {
95 cgh.memcpy(a.baseAddress(), current_ptr.baseAddress(), current_ptr.size());
96 });
97 q.wait();
98
99 deallocate(args, current_ptr);
100 return a;
101 }
103 {
104 sycl::queue& q = _defaultQueue();
105 _deallocate(ptr.baseAddress(), args, q);
106 }
107
108 protected:
109
110 virtual void _allocate(void** ptr, size_t new_size, MemoryAllocationArgs, sycl::queue& q) = 0;
111 virtual void _deallocate(void* ptr, MemoryAllocationArgs, sycl::queue& q) = 0;
112};
113
114/*---------------------------------------------------------------------------*/
115/*---------------------------------------------------------------------------*/
116
118: public SyclMemoryAllocatorBase
119{
120 protected:
121
122 void _allocate(void** ptr, size_t new_size, MemoryAllocationArgs, sycl::queue& q) override
123 {
124 *ptr = sycl::malloc_shared(new_size, q);
125 }
126 void _deallocate(void* ptr, MemoryAllocationArgs, sycl::queue& q) override
127 {
128 sycl::free(ptr, q);
129 }
131};
132
133/*---------------------------------------------------------------------------*/
134/*---------------------------------------------------------------------------*/
135
137: public SyclMemoryAllocatorBase
138{
139 protected:
140
141 void _allocate(void** ptr, size_t new_size, MemoryAllocationArgs, sycl::queue& q) override
142 {
143 // TODO: Make host-pinned
144 *ptr = sycl::malloc_host(new_size, q);
145 }
146 void _deallocate(void* ptr, MemoryAllocationArgs, sycl::queue& q) override
147 {
148 sycl::free(ptr, q);
149 }
151};
152
153/*---------------------------------------------------------------------------*/
154/*---------------------------------------------------------------------------*/
155
157: public SyclMemoryAllocatorBase
158{
159 protected:
160
161 void _allocate(void** ptr, size_t new_size, MemoryAllocationArgs, sycl::queue& q) override
162 {
163 *ptr = sycl::malloc_device(new_size, q);
164 }
165 void _deallocate(void* ptr, MemoryAllocationArgs, sycl::queue& q) override
166 {
167 sycl::free(ptr, q);
168 }
170};
171
172/*---------------------------------------------------------------------------*/
173/*---------------------------------------------------------------------------*/
174
175namespace
176{
177 UnifiedMemorySyclMemoryAllocator unified_memory_sycl_memory_allocator;
178 HostPinnedSyclMemoryAllocator host_pinned_sycl_memory_allocator;
179 DeviceSyclMemoryAllocator device_sycl_memory_allocator;
180} // namespace
181
182/*---------------------------------------------------------------------------*/
183/*---------------------------------------------------------------------------*/
184
185class SyclRunQueueStream
187{
188 public:
189
190 SyclRunQueueStream(SyclRunnerRuntime* runtime, const RunQueueBuildInfo& bi);
191 ~SyclRunQueueStream() override
192 {
193 }
194
195 public:
196
197 void notifyBeginLaunchKernel([[maybe_unused]] Impl::RunCommandImpl& c) override
198 {
199 return m_runtime->notifyBeginLaunchKernel();
200 }
202 {
203 return m_runtime->notifyEndLaunchKernel();
204 }
205 void barrier() override
206 {
207 m_sycl_stream->wait_and_throw();
208 }
209 bool _barrierNoException() override
210 {
211 m_sycl_stream->wait();
212 return false;
213 }
214 void copyMemory(const MemoryCopyArgs& args) override
215 {
216 auto source_bytes = args.source().bytes();
217 m_sycl_stream->memcpy(args.destination().data(), source_bytes.data(),
218 source_bytes.size());
219 if (!args.isAsync())
220 this->barrier();
221 }
222 void prefetchMemory([[maybe_unused]] const MemoryPrefetchArgs& args) override
223 {
224 auto source_bytes = args.source().bytes();
225 Int64 nb_byte = source_bytes.size();
226 if (nb_byte == 0)
227 return;
228 m_sycl_stream->prefetch(source_bytes.data(), nb_byte);
229 if (!args.isAsync())
230 this->barrier();
231 }
233 {
234 return Impl::NativeStream(m_sycl_stream.get());
235 }
236
237 void _setSyclLastCommandEvent([[maybe_unused]] void* sycl_event_ptr) override
238 {
239 sycl::event last_event;
240 if (sycl_event_ptr)
241 last_event = *(reinterpret_cast<sycl::event*>(sycl_event_ptr));
242 m_last_command_event = last_event;
243 }
244
245 public:
246
247 static sycl::async_handler _getAsyncHandler()
248 {
249 auto err_handler = [](const sycl::exception_list& exceptions) {
250 std::ostringstream ostr;
251 ostr << "Error in SYCL runtime\n";
252 for (const std::exception_ptr& e : exceptions) {
253 try {
254 std::rethrow_exception(e);
255 }
256 catch (const sycl::exception& e) {
257 ostr << "SYCL exception: " << e.what() << "\n";
258 }
259 }
260 ARCCORE_FATAL(ostr.str());
261 };
262 return err_handler;
263 }
264
266 sycl::event lastCommandEvent() { return m_last_command_event; }
267
268 public:
269
270 sycl::queue& trueStream() const
271 {
272 return *m_sycl_stream;
273 }
274
275 private:
276
277 Impl::IRunnerRuntime* m_runtime;
278 std::unique_ptr<sycl::queue> m_sycl_stream;
279 sycl::event m_last_command_event;
280};
281
282/*---------------------------------------------------------------------------*/
283/*---------------------------------------------------------------------------*/
284
285class SyclRunQueueEvent
287{
288 public:
289
290 explicit SyclRunQueueEvent([[maybe_unused]] bool has_timer)
291 {
292 }
293 ~SyclRunQueueEvent() override
294 {
295 }
296
297 public:
298
299 // Record the event within a RunQueue
300 void recordQueue([[maybe_unused]] Impl::IRunQueueStream* stream) final
301 {
302 ARCCORE_CHECK_POINTER(stream);
303 auto* rq = static_cast<SyclRunQueueStream*>(stream);
304 m_sycl_event = rq->lastCommandEvent();
305#if defined(__ADAPTIVECPP__)
306 m_recorded_stream = stream;
307 // TODO: Check if anything needs to be done
308#elif defined(__INTEL_LLVM_COMPILER)
309 //m_sycl_event = rq->trueStream().ext_oneapi_submit_barrier();
310#else
311 ARCCORE_THROW(NotSupportedException, "Only supported for AdaptiveCpp and Intel DPC++ implementation");
312#endif
313 }
314
315 void wait() final
316 {
317 //ARCCORE_SYCL_FUNC_NOT_HANDLED;
318 // TODO: Check exactly what this means
319 m_sycl_event.wait();
320 }
321
322 void waitForEvent([[maybe_unused]] Impl::IRunQueueStream* stream) final
323 {
324#if defined(__ADAPTIVECPP__)
325 auto* rq = static_cast<SyclRunQueueStream*>(stream);
326 m_sycl_event.wait(rq->trueStream().get_wait_list());
327#elif defined(__INTEL_LLVM_COMPILER)
328 std::vector<sycl::event> events;
329 events.push_back(m_sycl_event);
330 auto* rq = static_cast<SyclRunQueueStream*>(stream);
331 rq->trueStream().ext_oneapi_submit_barrier(events);
332#else
333 ARCCORE_THROW(NotSupportedException, "Only supported for AdaptiveCpp and Intel DPC++ implementation");
334#endif
335 }
336
337 Int64 elapsedTime([[maybe_unused]] IRunQueueEventImpl* start_event) final
338 {
339 ARCCORE_CHECK_POINTER(start_event);
340 // We must take the start event because we are certain it contains
341 // the correct 'sycl::event' value.
342 sycl::event event = (static_cast<SyclRunQueueEvent*>(start_event))->m_sycl_event;
343 // If there is no associated event, we do nothing to avoid an exception
344 if (event == sycl::event())
345 return 0;
346
347 bool is_submitted = event.get_info<sycl::info::event::command_execution_status>() == sycl::info::event_command_status::complete;
348 if (!is_submitted)
349 return 0;
350 Int64 start = event.get_profiling_info<sycl::info::event_profiling::command_start>();
351 Int64 end = event.get_profiling_info<sycl::info::event_profiling::command_end>();
352 return (end - start);
353 }
354
355 bool hasPendingWork() final
356 {
357 ARCCORE_THROW(NotImplementedException, "hasPendingWork()");
358 }
359
360 private:
361
362 sycl::event m_sycl_event;
363 Impl::IRunQueueStream* m_recorded_stream = nullptr;
364};
365
366/*---------------------------------------------------------------------------*/
367/*---------------------------------------------------------------------------*/
368
371{
372 friend class SyclRunQueueStream;
373
374 public:
375
376 void notifyBeginLaunchKernel() override
377 {
378 }
379 void notifyEndLaunchKernel() override
380 {
381 }
382 void barrier() override
383 {
384 // TODO Waiting on the default queue is not strictly equivalent
385 // to the CUDA barrier which synchronizes the entire device.
386 m_default_queue->wait();
387 }
388 eExecutionPolicy executionPolicy() const override
389 {
391 }
392 Impl::IRunQueueStream* createStream(const RunQueueBuildInfo& bi) override
393 {
394 return new SyclRunQueueStream(this, bi);
395 }
396 Impl::IRunQueueEventImpl* createEventImpl() override
397 {
398 return new SyclRunQueueEvent(false);
399 }
400 Impl::IRunQueueEventImpl* createEventImplWithTimer() override
401 {
402 return new SyclRunQueueEvent(true);
403 }
404 void setMemoryAdvice([[maybe_unused]] ConstMemoryView buffer, [[maybe_unused]] eMemoryAdvice advice,
405 [[maybe_unused]] DeviceId device_id) override
406 {
407 }
408 void unsetMemoryAdvice([[maybe_unused]] ConstMemoryView buffer,
409 [[maybe_unused]] eMemoryAdvice advice, [[maybe_unused]] DeviceId device_id) override
410 {
411 }
412
413 void setCurrentDevice([[maybe_unused]] DeviceId device_id) final
414 {
415 ARCCORE_SYCL_FUNC_NOT_HANDLED;
416 }
417 const IDeviceInfoList* deviceInfoList() override { return &m_device_info_list; }
418
419 void getPointerAttribute(PointerAttribute& attribute, const void* ptr) override
420 {
421 sycl::usm::alloc sycl_mem_type = sycl::get_pointer_type(ptr, *m_default_context);
422 ePointerMemoryType mem_type = ePointerMemoryType::Unregistered;
423 const void* host_ptr = nullptr;
424 const void* device_ptr = nullptr;
425 if (sycl_mem_type == sycl::usm::alloc::host) {
426 // HostPinned. Must be accessible from the device but
427 //
428 mem_type = ePointerMemoryType::Host;
429 host_ptr = ptr;
430 // TODO: Look into how to retrieve the value
431 device_ptr = ptr;
432 }
433 else if (sycl_mem_type == sycl::usm::alloc::device) {
434 mem_type = ePointerMemoryType::Device;
435 device_ptr = ptr;
436 }
437 else if (sycl_mem_type == sycl::usm::alloc::shared) {
438 mem_type = ePointerMemoryType::Managed;
439 // TODO: for now we fill it with the pointer because we don't
440 // know how to retrieve the info.
441 host_ptr = ptr;
442 device_ptr = ptr;
443 }
444 // TODO: to be corrected
445 Int32 device_id = 0;
446 _fillPointerAttribute(attribute, mem_type, device_id, ptr, device_ptr, host_ptr);
447 }
448
449 DeviceMemoryInfo getDeviceMemoryInfo([[maybe_unused]] DeviceId device_id) override
450 {
451 return {};
452 }
453
454 KernelLaunchArgs computeKernalLaunchArgs(const KernelLaunchArgs& orig_args,
455 const void* kernel_ptr,
456 Int64 total_loop_size) override
457 {
458 Int32 shared_memory = orig_args.sharedMemorySize();
459 if (orig_args.isCooperative()) {
460 // In cooperative mode, ensures that we do not launch more blocks
461 // than the maximum that can reside on the GPU.
462 // Int32 nb_thread = orig_args.nbThreadPerBlock();
463 Int32 nb_block = orig_args.nbBlockPerGrid();
464 // With Sycl, there is no way to retrieve the maximum number
465 // of active blocks for a given function and number of threads.
466 // We assume we can take a maximum of 4 blocks per SM.
467 int nb_block_per_sm = 4;
468 int max_block = nb_block_per_sm * m_multi_processor_count;
469 if (nb_block > max_block) {
470 KernelLaunchArgs modified_args(orig_args);
471 modified_args.setNbBlockPerGrid(max_block);
472 return modified_args;
473 }
474 }
475 return orig_args;
476 }
477
478 void fillDevicesAndSetDefaultQueue(bool is_verbose);
479 sycl::queue& defaultQueue() const { return *m_default_queue; }
480 sycl::device& defaultDevice() const { return *m_default_device; }
481
482 void finalize(ITraceMng*) override
483 {
484 // Removes the global queue used for allocations.
485 global_default_queue = sycl::queue{};
486 }
487
488 private:
489
490 Impl::DeviceInfoList m_device_info_list;
491 std::unique_ptr<sycl::device> m_default_device;
492 std::unique_ptr<sycl::context> m_default_context;
493 std::unique_ptr<sycl::queue> m_default_queue;
494 int m_multi_processor_count = 0;
495
496 private:
497
498 void _init(sycl::device& device)
499 {
500 m_default_device = std::make_unique<sycl::device>(device);
501 m_default_queue = std::make_unique<sycl::queue>(device);
502 m_default_context = std::make_unique<sycl::context>(device);
503 }
504};
505
506/*---------------------------------------------------------------------------*/
507/*---------------------------------------------------------------------------*/
508
509SyclRunQueueStream::
510SyclRunQueueStream(SyclRunnerRuntime* runtime, const RunQueueBuildInfo& bi)
511: m_runtime(runtime)
512{
513 sycl::device& d = runtime->defaultDevice();
514 // Indicates that the launched commands are implicitly executed one after
515 // the other.
516 auto queue_property = sycl::property::queue::in_order();
517 // For profiling
518 auto profiling_property = sycl::property::queue::enable_profiling();
519 sycl::property_list queue_properties(queue_property, profiling_property);
520
521 // Error handler.
522 sycl::async_handler err_handler;
523 err_handler = _getAsyncHandler();
524 if (bi.isDefault())
525 m_sycl_stream = std::make_unique<sycl::queue>(d, err_handler, queue_properties);
526 else {
527 ARCCORE_SYCL_FUNC_NOT_HANDLED;
528 m_sycl_stream = std::make_unique<sycl::queue>(d, err_handler, queue_properties);
529 }
530}
531
532/*---------------------------------------------------------------------------*/
533/*---------------------------------------------------------------------------*/
534
535void SyclRunnerRuntime::
536fillDevicesAndSetDefaultQueue(bool is_verbose)
537{
538 if (is_verbose) {
539 for (auto platform : sycl::platform::get_platforms()) {
540 std::cout << "Platform: "
541 << platform.get_info<sycl::info::platform::name>()
542 << std::endl;
543 }
544 }
545
546 sycl::device device{ sycl::gpu_selector_v };
547 if (is_verbose)
548 std::cout << "\nDevice: " << device.get_info<sycl::info::device::name>()
549 << "\nVersion=" << device.get_info<sycl::info::device::version>()
550 << "\nDriverVersion=" << device.get_info<sycl::info::device::driver_version>()
551 << "\nMaxComputeUnits=" << device.get_info<sycl::info::device::max_compute_units>()
552 << "\nMaxWorkGroupSize=" << device.get_info<sycl::info::device::max_work_group_size>()
553 << "\nLocalMemSize=" << device.get_info<sycl::info::device::local_mem_size>()
554 << "\nGlobalMemSize=" << device.get_info<sycl::info::device::global_mem_size>()
555 << "\nMaxMemAllocSize=" << device.get_info<sycl::info::device::max_mem_alloc_size>()
556 << "\n";
557 m_multi_processor_count = device.get_info<sycl::info::device::max_compute_units>();
558 // For now, we take the first found queue as the default and only
559 // consider one accessible device.
560 _init(device);
561
562 DeviceInfo device_info;
563 device_info.setDescription("No description info");
564 device_info.setDeviceId(DeviceId(0));
565 device_info.setName(device.get_info<sycl::info::device::name>());
566 m_device_info_list.addDevice(device_info);
567}
568
569/*---------------------------------------------------------------------------*/
570/*---------------------------------------------------------------------------*/
571
573: public IMemoryCopier
574{
575 void copy(ConstMemoryView from, eMemoryResource from_mem,
577 const RunQueue* queue) override;
578};
579
580/*---------------------------------------------------------------------------*/
581/*---------------------------------------------------------------------------*/
582
583} // namespace Arcane::Accelerator::Sycl
584
585namespace
586{
588Arcane::Accelerator::Sycl::SyclMemoryCopier global_sycl_memory_copier;
589} // namespace
590
591/*---------------------------------------------------------------------------*/
592/*---------------------------------------------------------------------------*/
593
594namespace Arcane::Accelerator::Sycl
595{
596
597/*---------------------------------------------------------------------------*/
598/*---------------------------------------------------------------------------*/
599
600void SyclMemoryCopier::
601copy(ConstMemoryView from, [[maybe_unused]] eMemoryResource from_mem,
602 MutableMemoryView to, [[maybe_unused]] eMemoryResource to_mem,
603 const RunQueue* queue)
604{
605 if (queue) {
606 queue->copyMemory(MemoryCopyArgs(to.bytes(), from.bytes()).addAsync(queue->isAsync()));
607 return;
608 }
609 sycl::queue& q = global_sycl_runtime.defaultQueue();
610 q.memcpy(to.data(), from.data(), from.bytes().size()).wait();
611}
612
613} // namespace Arcane::Accelerator::Sycl
614
615/*---------------------------------------------------------------------------*/
616/*---------------------------------------------------------------------------*/
617
618// This function is the entry point used during the dynamic loading
619// of this library
620extern "C" ARCCORE_EXPORT void
621arcaneRegisterAcceleratorRuntimesycl(Arcane::Accelerator::RegisterRuntimeInfo& init_info)
622{
623 using namespace Arcane;
624 using namespace Arcane::Accelerator::Sycl;
625 Arcane::Accelerator::Impl::setUsingSYCLRuntime(true);
626 Arcane::Accelerator::Impl::setSYCLRunQueueRuntime(&global_sycl_runtime);
627 MemoryUtils::setAcceleratorHostMemoryAllocator(&unified_memory_sycl_memory_allocator);
630 mrm->setIsAccelerator(true);
631 mrm->setAllocator(eMemoryResource::UnifiedMemory, &unified_memory_sycl_memory_allocator);
632 mrm->setAllocator(eMemoryResource::HostPinned, &host_pinned_sycl_memory_allocator);
633 mrm->setAllocator(eMemoryResource::Device, &device_sycl_memory_allocator);
634 mrm->setCopier(&global_sycl_memory_copier);
635 global_sycl_runtime.fillDevicesAndSetDefaultQueue(init_info.isVerbose());
636 global_default_queue = global_sycl_runtime.defaultQueue();
637}
638
639/*---------------------------------------------------------------------------*/
640/*---------------------------------------------------------------------------*/
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
#define ARCCORE_THROW(exception_class,...)
Macro to throw an exception with formatting.
#define ARCCORE_CHECK_POINTER(ptr)
Macro that returns the pointer ptr if it is not null or throws an exception if it is null.
Interface for event implementation.
Interface of an execution stream for a RunQueue.
Interface of the runtime associated with an accelerator.
bool isCooperative() const
Indicates if running in cooperative mode (i.e. cudaLaunchCooperativeKernel).
Information to initialize the accelerator runtime.
bool isDefault() const
Indicates if the instance only has default values.
bool isAsync() const
Indicates if the execution queue is asynchronous.
Definition RunQueue.cc:320
void copyMemory(const MemoryCopyArgs &args) const
Copies information between two memory regions.
Definition RunQueue.cc:237
eMemoryResource memoryResource() const override
Memory resource provided by the allocator.
eMemoryResource memoryResource() const override
Memory resource provided by the allocator.
bool hasRealloc(MemoryAllocationArgs) const override
Indicates whether the allocator supports realloc semantics.
AllocatedMemoryInfo reallocate(MemoryAllocationArgs args, AllocatedMemoryInfo current_ptr, Int64 new_size) override
Reallocates memory for new_size bytes and returns the pointer.
AllocatedMemoryInfo allocate(MemoryAllocationArgs args, Int64 new_size) override
void deallocate(MemoryAllocationArgs args, AllocatedMemoryInfo ptr) override
Frees the memory whose base address is ptr.
void copy(ConstMemoryView from, eMemoryResource from_mem, MutableMemoryView to, eMemoryResource to_mem, const RunQueue *queue) override
Copies the data from from to to with the queue queue.
void notifyBeginLaunchKernel(Impl::RunCommandImpl &c) override
Notification before command launch.
void barrier() override
Blocks until all actions associated with this queue are finished.
sycl::event lastCommandEvent()
Event corresponding to the last command.
void prefetchMemory(const MemoryPrefetchArgs &args) override
Performs a prefetch of a memory region.
Impl::NativeStream nativeStream() override
Pointer to the internal structure dependent on the implementation.
void copyMemory(const MemoryCopyArgs &args) override
Performs a copy between two memory regions.
bool _barrierNoException() override
Barrier without exception. Returns true in case of error.
void _setSyclLastCommandEvent(void *sycl_event_ptr) override
For SYCL, positions the event associated with the last executed command.
void notifyEndLaunchKernel(Impl::RunCommandImpl &) override
Notification of command launch completion.
eMemoryResource memoryResource() const override
Memory resource provided by the allocator.
Information about an allocated memory region.
void * baseAddress() const
Address of the start of the allocated region.
Int64 size() const
Size in bytes of the used memory region. (-1) if unknown.
Constant view on a contiguous memory region containing fixed-size elements.
constexpr SpanType bytes() const
View in byte form.
constexpr const std::byte * data() const
Pointer to the memory region.
Interface for memory copies with accelerator support.
Internal part of Arcane's 'IMemoryResourceMng'.
virtual void setAllocator(eMemoryResource r, IMemoryAllocator *allocator)=0
Sets the allocator for resource r.
virtual void setIsAccelerator(bool v)=0
Indicates if an accelerator is available.
virtual void setCopier(IMemoryCopier *copier)=0
Sets the copying instance.
virtual IMemoryResourceMngInternal * _internal()=0
Internal interface.
Class containing information to specialize allocations.
Mutable view on a contiguous memory region containing fixed-size elements.
constexpr std::byte * data() const
Pointer to the memory region.
constexpr SpanType bytes() const
View in byte form.
constexpr __host__ __device__ SizeType size() const noexcept
Returns the size of the array.
Definition Span.h:327
ePointerMemoryType
Memory type for a pointer.
eExecutionPolicy
Execution policy for a Runner.
@ SYCL
Execution policy using the SYCL environment.
IMemoryRessourceMng * getDataMemoryResourceMng()
Memory resource manager for data.
IMemoryAllocator * setAcceleratorHostMemoryAllocator(IMemoryAllocator *a)
Sets the specific allocator for accelerators.
void setDefaultDataMemoryResource(eMemoryResource mem_resource)
Sets the memory resource used for the data memory allocator.
Namespace for platform-dependent functions.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
eMemoryResource
List of available memory resources.
@ HostPinned
Allocates on the host.
@ UnifiedMemory
Allocates using unified memory.
@ Device
Allocates on the device.
std::int32_t Int32
Signed integer type of 32 bits.