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 
13 #include <detail/context_impl.hpp>
14 
16 namespace sycl {
17 namespace detail {
18 
19 template <info::context param> struct get_context_info {
20  using RetType =
22 
23  static RetType get(RT::PiContext ctx, const plugin &Plugin) {
24  RetType Result = 0;
25  // TODO catch an exception and put it to list of asynchronous exceptions
27  pi::cast<pi_context_info>(param),
28  sizeof(Result), &Result, nullptr);
29  return Result;
30  }
31 };
32 
33 // Specialization for atomic_memory_order_capabilities, PI returns a bitfield
34 template <>
35 struct get_context_info<info::context::atomic_memory_order_capabilities> {
36  using RetType = typename info::param_traits<
38  info::context::atomic_memory_order_capabilities>::return_type;
39 
40  static RetType get(RT::PiContext ctx, const plugin &Plugin) {
43  ctx,
44  pi::cast<pi_context_info>(
45  info::context::atomic_memory_order_capabilities),
46  sizeof(Result), &Result, nullptr);
47  return readMemoryOrderBitfield(Result);
48  }
49 };
50 
51 } // namespace detail
52 } // namespace sycl
53 } // __SYCL_INLINE_NAMESPACE(cl)
context_impl.hpp
cl::sycl::info::param_traits
Definition: info_desc.hpp:310
cl::sycl::detail::get_context_info< info::context::atomic_memory_order_capabilities >::get
static RetType get(RT::PiContext ctx, const plugin &Plugin)
Definition: context_info.hpp:40
piContextGetInfo
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)
Definition: pi_esimd_emulator.cpp:858
cl::sycl::detail::get_context_info::get
static RetType get(RT::PiContext ctx, const plugin &Plugin)
Definition: context_info.hpp:23
sycl
Definition: invoke_simd.hpp:68
cl::sycl::detail::get_context_info::RetType
typename info::param_traits< info::context, param >::return_type RetType
Definition: context_info.hpp:21
cl::sycl::detail::plugin::call
void call(ArgsT... Args) const
Calls the API, traces the call, checks the result.
Definition: plugin.hpp:217
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::detail::readMemoryOrderBitfield
std::vector< memory_order > readMemoryOrderBitfield(pi_memory_order_capabilities bits)
Definition: memory_enums.hpp:51
cl::sycl::detail::plugin
The plugin class provides a unified interface to the underlying low-level runtimes for the device-agn...
Definition: plugin.hpp:90
cl::sycl::detail::get_context_info< info::context::atomic_memory_order_capabilities >::RetType
typename info::param_traits< info::context, info::context::atomic_memory_order_capabilities >::return_type RetType
Definition: context_info.hpp:38
info_desc.hpp
common.hpp
cl::sycl::info::context
context
Definition: info_desc.hpp:42
pi_memory_order_capabilities
pi_bitfield pi_memory_order_capabilities
Definition: pi.h:557
_pi_context
PI context mapping to a CUDA context object.
Definition: pi_cuda.hpp:150
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12
cl::sycl::detail::get_context_info
Definition: context_info.hpp:19