DPC++ Runtime
Runtime libraries for oneAPI DPC++
atomic_intrin.hpp
Go to the documentation of this file.
1 //==-------- atomic_intrin.hpp - Atomic intrinsic definition file ----------==//
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 #pragma once
9 
11 
12 #include <CL/sycl/exception.hpp>
13 
14 // This function implements atomic update of pre-existing variable in the
15 // absense of C++ 20's atomic_ref.
16 template <typename Ty> Ty atomic_add_fetch(Ty *ptr, Ty val) {
17 #ifdef _WIN32
18  // TODO: Windows will be supported soon
19  __ESIMD_UNSUPPORTED_ON_HOST;
20 #else
21  return __atomic_add_fetch(ptr, val, __ATOMIC_RELAXED);
22 #endif
23 }
24 
exception.hpp