DPC++ Runtime
Runtime libraries for oneAPI DPC++
context_info.hpp
Go to the documentation of this file.
1 //==---------------- context_info.hpp - SYCL context -----------*- C++ -*---==//
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 
9 #pragma once
10 
11 #include <detail/context_impl.hpp>
12 #include <sycl/detail/common.hpp>
14 #include <sycl/info/info_desc.hpp>
15 
16 namespace sycl {
18 namespace detail {
19 
20 template <typename Param>
21 typename Param::return_type get_context_info(RT::PiContext Ctx,
22  const plugin &Plugin) {
24  "Invalid context information descriptor");
25  typename Param::return_type Result = 0;
26  // TODO catch an exception and put it to list of asynchronous exceptions
28  sizeof(Result), &Result, nullptr);
29  return Result;
30 }
31 
32 // Specialization for atomic_memory_order_capabilities, PI returns a bitfield
33 template <>
34 std::vector<sycl::memory_order>
35 get_context_info<info::context::atomic_memory_order_capabilities>(
36  RT::PiContext Ctx, const plugin &Plugin) {
38  Plugin.call<PiApiKind::piContextGetInfo>(
39  Ctx, PiInfoCode<info::context::atomic_memory_order_capabilities>::value,
40  sizeof(Result), &Result, nullptr);
41  return readMemoryOrderBitfield(Result);
42 }
43 } // namespace detail
44 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
45 } // namespace sycl
The plugin class provides a unified interface to the underlying low-level runtimes for the device-agn...
Definition: plugin.hpp:90
void call(ArgsT... Args) const
Calls the API, traces the call, checks the result.
Definition: plugin.hpp:217
#define __SYCL_INLINE_VER_NAMESPACE(X)
::pi_context PiContext
Definition: pi.hpp:114
Param::return_type get_context_info(RT::PiContext Ctx, const plugin &Plugin)
std::vector< memory_order > readMemoryOrderBitfield(pi_memory_order_capabilities bits)
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
pi_result piContextGetInfo(pi_context context, pi_context_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
pi_bitfield pi_memory_order_capabilities
Definition: pi.h:524