Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
sycl_builtins.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
19#include "shambase/integer.hpp"
20#include "shambase/vectors.hpp"
21#include "shambackends/math.hpp"
22#include "shambackends/sycl.hpp"
23#include "shambackends/vec.hpp"
24
25namespace shambase {
26
37 template<class T, int n, std::enable_if_t<std::is_integral_v<T>, int> = 0>
38 i32 any(sycl::vec<T, n> v) {
39#ifdef SYCL_COMP_INTEL_LLVM
40 return sycl::any(v);
41#else
42 return sham::sum_accumulate(
43 (v & sycl::vec<T, n>{most_sig_bit_mask<T>()}) >> sycl::vec<T, n>{4});
44#endif
45 }
46
47} // namespace shambase
std::int32_t i32
32 bit integer
namespace for basic c++ utilities
i32 any(sycl::vec< T, n > v)
Fallback function for sycl::any SYCL std : Returns 1 if the most significant bit in any component of ...
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.