sycl-local-accessor-helpers.hh
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Jonas deLacour
3#pragma once
4
5/// @file
6/// @brief util::get_raw_ptr() for `sycl::local_accessor`, used to pass device-BLAS workspaces.
7///
8/// Installed with the rest of `include/batchlas` (the install rule copies the
9/// tree wholesale); no public header includes it. Not a stable interface.
10/// @ingroup api_internal_helpers
11
12#include <sycl/sycl.hpp>
13
14namespace batchlas {
15namespace util {
16
17/**
18 * @brief Helper function to get a raw pointer from a SYCL local accessor.
19 *
20 * This function provides a convenient wrapper around the verbose
21 * local_accessor::get_multi_ptr<sycl::access::decorated::no>().get() syntax,
22 * avoiding the deprecation warning for get_pointer().
23 *
24 * @tparam T The element type of the local accessor
25 * @tparam Dims The dimensionality of the accessor
26 * @param accessor The local accessor to get a pointer from
27 * @return T* Raw pointer to the local accessor's storage
28 * @ingroup api_internal_helpers
29 */
30template <typename T, int Dims = 1>
31inline T* get_raw_ptr(const sycl::local_accessor<T, Dims>& accessor) {
32 return accessor.template get_multi_ptr<sycl::access::decorated::no>().get();
33}
34
35} // namespace util
36} // namespace batchlas
T * get_raw_ptr(const sycl::local_accessor< T, Dims > &accessor)
Helper function to get a raw pointer from a SYCL local accessor.