File tree Expand file tree Collapse file tree 5 files changed +145
-0
lines changed
doc/extensions/intel_fpga Expand file tree Collapse file tree 5 files changed +145
-0
lines changed Original file line number Diff line number Diff line change
1
+ # FPGA reg
2
+
3
+ Intel FPGA extension fpga_reg() is implemented in header file
4
+ ` #include <CL/sycl/intel/fpga_extensions.hpp> ` .
5
+
6
+ fpga_reg is used to help compiler infer that at least one register is on the corresponding data path.
7
+
8
+ ## Implementation
9
+
10
+ The implementation is a wrapper class to map fpga_reg function call to built-in \_\_ builtin_intel_fpga_reg()
11
+ only when parsing for SYCL device code.
12
+ ``` c++
13
+ #if defined(__clang__) && __has_builtin(__builtin_intel_fpga_reg)
14
+ return __ builtin_intel_fpga_reg(t);
15
+ #else
16
+ return t;
17
+ #endif
18
+
19
+ ```
20
+
21
+
22
+ ## Usage
23
+
24
+ ``` c++
25
+ #include < CL/sycl/intel/fpga_extensions.hpp>
26
+ ...
27
+ // force at least one register on data path
28
+ int a = cl::sycl::intel::fpga_reg(a[k]) + b[k];
29
+
30
+ ...
31
+ ```
Original file line number Diff line number Diff line change
1
+ # FPGA selector
2
+
3
+ Intel FPGA users can use header file: ` #include<CL/sycl/intel/fpga_device_selector.hpp> ` to simplify their code
4
+ when they want to specify FPGA hardware device or FPGA emulation device.
5
+
6
+ ## Implementation
7
+
8
+ Current implementation is based on platform name. This is useful in the most common case when user have
9
+ one FPGA board installed in their system (one device per platform).
10
+
11
+ ## Usage: select FPGA hardware device
12
+ ``` c++
13
+ #include < CL/sycl/intel/fpga_device_selector.hpp>
14
+ ...
15
+ // force FPGA hardware device
16
+ cl::sycl::queue deviceQueue (cl::sycl::intel::fpga_selector{});
17
+ ...
18
+ ```
19
+
20
+ ## Usage: select FPGA emulator device
21
+ ```c++
22
+ #include <CL/sycl/intel/fpga_device_selector.hpp>
23
+ ...
24
+ // force FPGA emulation device
25
+ cl::sycl::queue deviceQueue(cl::sycl::intel::fpga_emulator_selector{});
26
+ ...
27
+ ```
Original file line number Diff line number Diff line change
1
+ // ==- fpga_device_selector.hpp --- SYCL FPGA device selector shortcut -----==//
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 < CL/sycl.hpp>
12
+
13
+ namespace cl {
14
+ namespace sycl {
15
+ namespace intel {
16
+
17
+ class platform_selector : public default_selector {
18
+ private:
19
+ std::string device_platform_name;
20
+
21
+ public:
22
+ platform_selector (const std::string &platform_name)
23
+ : device_platform_name(platform_name){}
24
+
25
+ virtual int operator ()(const device &device) const {
26
+ const platform &pf = device.get_platform ();
27
+ const std::string &platform_name = pf.get_info <info::platform::name>();
28
+ if (platform_name == device_platform_name) {
29
+ return 10000 ;
30
+ }
31
+ return -1 ;
32
+ }
33
+ };
34
+
35
+ const std::string EMULATION_PLATFORM_NAME =
36
+ " Intel(R) FPGA Emulation Platform for OpenCL(TM)" ;
37
+ const std::string HARDWARE_PLATFORM_NAME = " Intel(R) FPGA SDK for OpenCL(TM)" ;
38
+
39
+ class fpga_selector : public platform_selector {
40
+ public:
41
+ fpga_selector () : platform_selector(HARDWARE_PLATFORM_NAME){}
42
+ };
43
+
44
+ class fpga_emulator_selector : public platform_selector {
45
+ public:
46
+ fpga_emulator_selector () : platform_selector(EMULATION_PLATFORM_NAME){}
47
+ };
48
+
49
+ } // namespace intel
50
+ } // namespace sycl
51
+ } // namespace cl
Original file line number Diff line number Diff line change
1
+ // ==----------- fpga_extensions.hpp --- SYCL FPGA Extensions ---------------==//
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
+ #include < CL/sycl/intel/fpga_device_selector.hpp>
11
+ #include < CL/sycl/intel/fpga_reg.hpp>
Original file line number Diff line number Diff line change
1
+ // ==-------------- fpga_reg.hpp --- SYCL FPGA Reg Extensions ---------------==//
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
+ namespace cl {
12
+ namespace sycl {
13
+ namespace intel {
14
+
15
+ template <typename T> T fpga_reg (const T &t) {
16
+ #if defined(__clang__) && __has_builtin(__builtin_intel_fpga_reg)
17
+ return __builtin_intel_fpga_reg (t);
18
+ #else
19
+ return t;
20
+ #endif
21
+ }
22
+
23
+ } // namespace intel
24
+ } // namespace sycl
25
+ } // namespace cl
You can’t perform that action at this time.
0 commit comments