DPC++ Runtime
Runtime libraries for oneAPI DPC++
sampler_impl.hpp
Go to the documentation of this file.
1 //==----------------- sampler_impl.hpp - SYCL standard header 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 
9 #pragma once
10 
12 #include <CL/sycl/context.hpp>
15 
16 #include <unordered_map>
17 
19 namespace sycl {
20 
21 enum class addressing_mode : unsigned int;
22 enum class filtering_mode : unsigned int;
23 enum class coordinate_normalization_mode : unsigned int;
24 
25 namespace detail {
26 class __SYCL_EXPORT sampler_impl {
27 public:
29  addressing_mode addressingMode, filtering_mode filteringMode,
30  const property_list &propList);
31 
32  sampler_impl(cl_sampler clSampler, const context &syclContext);
33 
34  addressing_mode get_addressing_mode() const;
35 
36  filtering_mode get_filtering_mode() const;
37 
38  coordinate_normalization_mode get_coordinate_normalization_mode() const;
39 
40  RT::PiSampler getOrCreateSampler(const context &Context);
41 
45  template <typename propertyT> bool has_property() const {
46  return MPropList.has_property<propertyT>();
47  }
48 
55  template <typename propertyT> propertyT get_property() const {
56  return MPropList.get_property<propertyT>();
57  }
58 
59  ~sampler_impl();
60 
61 private:
63  std::mutex MMutex;
64 
65  std::unordered_map<context, RT::PiSampler> MContextToSampler;
66 
67  coordinate_normalization_mode MCoordNormMode;
68  addressing_mode MAddrMode;
69  filtering_mode MFiltMode;
70  property_list MPropList;
71 };
72 
73 } // namespace detail
74 } // namespace sycl
75 } // __SYCL_INLINE_NAMESPACE(cl)
property_list.hpp
context.hpp
sycl
Definition: invoke_simd.hpp:68
cl::sycl::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:26
cl::sycl::detail::sampler_impl::has_property
bool has_property() const
Checks if this sampler_impl has a property of type propertyT.
Definition: sampler_impl.hpp:45
export.hpp
cl::sycl::detail::sampler_impl
Definition: sampler_impl.hpp:26
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
_pi_sampler
Implementation of samplers for CUDA.
Definition: pi_cuda.hpp:795
cl::sycl::coordinate_normalization_mode
coordinate_normalization_mode
Definition: sampler.hpp:32
cl::sycl::addressing_mode
addressing_mode
Definition: sampler.hpp:19
cl::sycl::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:35
cl::sycl::detail::sampler_impl::get_property
propertyT get_property() const
Gets the specified property of this sampler_impl.
Definition: sampler_impl.hpp:55
cl::sycl::filtering_mode
filtering_mode
Definition: sampler.hpp:27
spirv_types.hpp
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12