DPC++ Runtime
Runtime libraries for oneAPI DPC++
fpga_dsp_control.hpp
Go to the documentation of this file.
1 //==------------ fpga_dsp_control.hpp --- SYCL FPGA DSP Control ------------==//
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 #pragma once
9 
10 namespace sycl {
11 inline namespace _V1 {
12 namespace ext {
13 namespace intel {
14 
16 enum class Propagate { On, Off };
17 
18 template <typename Function>
19 #ifdef __SYCL_DEVICE_ONLY__
20 [[intel::prefer_dsp]]
21 [[intel::propagate_dsp_preference]]
22 #endif // __SYCL_DEVICE_ONLY__
23 void math_prefer_dsp_propagate(Function f)
24 {
25  f();
26 }
27 
28 template <typename Function>
29 #ifdef __SYCL_DEVICE_ONLY__
30 [[intel::prefer_dsp]]
31 #endif // __SYCL_DEVICE_ONLY__
33 {
34  f();
35 }
36 
37 template <typename Function>
38 #ifdef __SYCL_DEVICE_ONLY__
39 [[intel::prefer_softlogic]]
40 [[intel::propagate_dsp_preference]]
41 #endif // __SYCL_DEVICE_ONLY__
43 {
44  f();
45 }
46 
47 template <typename Function>
48 #ifdef __SYCL_DEVICE_ONLY__
49 [[intel::prefer_softlogic]]
50 #endif // __SYCL_DEVICE_ONLY__
52 {
53  f();
54 }
55 
70 template <Preference my_preference = Preference::DSP,
71  Propagate my_propagate = Propagate::On, typename Function>
72 void math_dsp_control(Function f) {
73  if (my_preference == Preference::DSP) {
74  if (my_propagate == Propagate::On) {
76  } else {
78  }
79  } else if (my_preference == Preference::Softlogic) {
80  if (my_propagate == Propagate::On) {
82  } else {
84  }
85  } else { // my_preference == Preference::Compiler_default
86  math_prefer_dsp_no_propagate([&]() { f(); });
87  }
88 }
89 
90 } // namespace intel
91 } // namespace ext
92 } // namespace _V1
93 } // namespace sycl
void math_prefer_softlogic_no_propagate(Function f)
void math_prefer_dsp_propagate(Function f)
void math_dsp_control(Function f)
Preference: Control the hardware implementation of math operations in the lambda expression.
void math_prefer_dsp_no_propagate(Function f)
void math_prefer_softlogic_propagate(Function f)
Definition: access.hpp:18