Skip to content

FPGA: Batch PR - sim support - selectors update - readme rework #1280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
898c01a
add sim to simple and vector add
yuguen Dec 8, 2022
cc41ceb
update selector names
yuguen Dec 8, 2022
f521310
fix default usm board in simple_add
yuguen Dec 9, 2022
66d2bea
fixing default board for vector add usm
yuguen Dec 9, 2022
26cf6fa
add sim support to buffered_host_streaming
yuguen Dec 12, 2022
e5b3ad2
add sim to anr - 153min
yuguen Dec 12, 2022
e87ab50
add db and decompress sim support
yuguen Dec 12, 2022
c664830
add sim support to explicit data movement:
yuguen Dec 12, 2022
05a8c3f
update decompress readme
yuguen Dec 12, 2022
9659881
sim support to compute_units
yuguen Dec 13, 2022
03634ad
sim support to fast_recompile
yuguen Dec 13, 2022
9884b97
sim support to fpga_compile
yuguen Dec 13, 2022
0d29c71
sim support to io_streaming
yuguen Dec 13, 2022
117b3c5
sim support to shannonization
yuguen Dec 13, 2022
6c07970
sim support to merge_sort
yuguen Dec 13, 2022
d2bc810
fix existing READMEs with sim support
yuguen Dec 13, 2022
6b60700
sim support for mvdr
yuguen Dec 13, 2022
421dbf9
reducing decompress time
yuguen Dec 13, 2022
db66fed
update selectors on ref designs
yuguen Dec 13, 2022
a6c10a7
updating selectors in Design patterns
yuguen Dec 14, 2022
f62c0f0
updated selectors to part of the Features
yuguen Dec 14, 2022
b00c9c7
updated selectors on all remaining samples
yuguen Dec 14, 2022
b811f03
ac_fixed readme update
yuguen Dec 14, 2022
e6acaf8
simplify Features readmes
yuguen Dec 14, 2022
3a465ee
simplify the Tools and getting started readmes
yuguen Dec 14, 2022
6ad5a7a
simply part of the design patterns readmes
yuguen Dec 14, 2022
e6b83d0
Merge branch 'master' of https://github.com/oneapi-src/oneAPI-samples…
yuguen Dec 14, 2022
204c58b
simplified readmes of remaining READMEs
yuguen Dec 14, 2022
2e3b625
fix win flags
yuguen Dec 14, 2022
5fedecc
add env variable for sim in reference design readmes
yuguen Dec 14, 2022
e989c46
Merge branch 'master' of https://github.com/oneapi-src/oneAPI-samples…
yuguen Dec 15, 2022
685fd53
update remaining readmes with sim instructions due to selector change
yuguen Dec 15, 2022
6f5403e
update sim documentation for DCP++ samples
yuguen Dec 15, 2022
ec2db4e
fix FPGA_HARDWARE ifdef
yuguen Dec 15, 2022
aa558e3
reduce anr sim problem size
yuguen Dec 16, 2022
591eb55
reduce problem size for db1
yuguen Dec 16, 2022
bdaa6d4
Passing all Linux regtests acl-test 7553146d0e
yuguen Dec 16, 2022
02a5803
updating simulator software requirements
yuguen Dec 19, 2022
0913473
updating simulator software requirements in DPC++ samples
yuguen Dec 19, 2022
0cb9341
Merge branch 'master' of https://github.com/oneapi-src/oneAPI-samples…
yuguen Jan 4, 2023
fc08b32
remove sim for crr
yuguen Jan 4, 2023
ae0a8eb
Merge branch 'master' of https://github.com/oneapi-src/oneAPI-samples…
yuguen Jan 4, 2023
a67b946
Merge branch 'master' of https://github.com/oneapi-src/oneAPI-samples…
yuguen Jan 6, 2023
603badc
Merge branch 'development' of https://github.com/oneapi-src/oneAPI-sa…
yuguen Jan 6, 2023
3ddcb01
Merge branch 'development' of https://github.com/oneapi-src/oneAPI-sa…
yuguen Jan 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions DirectProgramming/C++SYCL/DenseLinearAlgebra/simple-add/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ USM, buffer, accessor, kernel, and command groups.
| Hardware | GEN9 or newer <br> Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA (Intel® PAC with Intel® Arria® 10 GX FPGA)
| Software | Intel® oneAPI DPC++/C++ Compiler

> **Note**: Even though the Intel DPC++/C++ OneAPI compiler is enough to compile for CPU, GPU, FPGA emulation, generating FPGA reports and generating RTL for FPGAs, there are extra software requirements for the FPGA simulation flow and FPGA compiles.
>
> For using the simulator flow, Intel® Quartus® Prime Pro Edition and one of the following simulators must be installed and accessible through your PATH:
> - Questa*-Intel® FPGA Edition
> - Questa*-Intel® FPGA Starter Edition
> - ModelSim® SE
>
> When using the hardware compile flow, Intel® Quartus® Prime Pro Edition must be installed and accessible through your PATH.

## Key Implementation Details

This sample provides examples of both buffers and USM implementations for simple side-by-side comparison.
Expand Down Expand Up @@ -111,19 +120,23 @@ To learn more about the extensions and how to configure the oneAPI environment,
```
make fpga_emu
```
2. Generate HTML performance reports.
2. Compile for simulation (fast compile time, targets simulator FPGA device):
```
make fpga_sim
```
3. Generate HTML performance reports.
```
make report
```
The reports reside at `simple-add_report.prj/reports/report.html`.

3. Compile the program for FPGA hardware. (Compiling for hardware can take a long
4. Compile the program for FPGA hardware. (Compiling for hardware can take a long
time.)
```
make fpga
```

4. Clean the program. (Optional)
5. Clean the program. (Optional)
```
make clean
```
Expand Down Expand Up @@ -168,19 +181,23 @@ time.)
```
nmake fpga_emu
```
2. Generate HTML performance reports.
2. Compile for simulation (fast compile time, targets simulator FPGA device):
```
nmake fpga_sim
```
3. Generate HTML performance reports.
```
nmake report
```
The reports reside at `simple-add_report.prj/reports/report.html`.

3. Compile the program for FPGA hardware. (Compiling for hardware can take a long
4. Compile the program for FPGA hardware. (Compiling for hardware can take a long
time.)
```
nmake fpga
```

4. Clean the program. (Optional)
5. Clean the program. (Optional)
```
nmake clean
```
Expand Down Expand Up @@ -216,7 +233,12 @@ If you receive an error message, troubleshoot the problem using the **Diagnostic
./simple-add-buffers.fpga_emu
./simple-add-usm.fpga_emu
```
3. Run on FPGA hardware.
3. Run on FPGA simulator.
```
CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1 ./simple-add-buffers.fpga_sim
CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1 ./simple-add-usm.fpga_sim
```
4. Run on FPGA hardware.
```
./simple-add-buffers.fpga
./simple-add-usm.fpga
Expand All @@ -243,7 +265,14 @@ If you receive an error message, troubleshoot the problem using the **Diagnostic
simple-add-buffers.fpga_emu.exe
simple-add-usm.fpga_emu.exe
```
3. Run on FPGA hardware.
3. Run on FPGA simulator.
```
set CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1
simple-add-buffers.fpga_sim.exe
simple-add-usm.fpga_sim.exe
set CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=
```
4. Run on FPGA hardware.
```
simple-add-buffers.fpga.exe
simple-add-usm.fpga.exe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,33 @@ add_custom_target(cpu-gpu DEPENDS ${TARGET_NAME})

# FPGA device selection
if(NOT DEFINED FPGA_DEVICE)
set(FPGA_DEVICE "intel_a10gx_pac:pac_a10")
if(DEFINED USM AND (NOT(USM EQUAL 0)))
set(FPGA_DEVICE "intel_s10sx_pac:pac_s10_usm")
set(DEFAULT_BOARD_STR "Intel Stratix(R) 10 SX with USM support")
else()
set(FPGA_DEVICE "intel_a10gx_pac:pac_a10")
set(DEFAULT_BOARD_STR "Intel Arria(R) 10 GX")
endif()
message(STATUS "FPGA_DEVICE was not specified.\
\nConfiguring the design to run on the default FPGA device ${FPGA_DEVICE} (Intel(R) PAC with Intel Arria(R) 10 GX FPGA). \
\nPlease refer to the README for information on device selection.")
\nConfiguring the design to run on the default FPGA board ${FPGA_DEVICE} (Intel(R) PAC with ${DEFAULT_BOARD_STR} FPGA). \
\nPlease refer to the README for information on board selection.")
else()
message(STATUS "Configuring the design to run on FPGA device ${FPGA_DEVICE}")
endif()

set(EMULATOR_TARGET ${TARGET_NAME}.fpga_emu)
set(SIMULATOR_TARGET ${TARGET_NAME}.fpga_sim)
set(FPGA_TARGET ${TARGET_NAME}.fpga)

# A DPC++ ahead-of-time (AoT) compile processes the device code in two stages.
# 1. The "compile" stage compiles the device code to an intermediate representation (SPIR-V).
# 2. The "link" stage invokes the compiler's FPGA backend before linking.
# For this reason, FPGA backend flags must be passed as link flags in CMake.
set(EMULATOR_COMPILE_FLAGS "-fsycl -Wall -fintelfpga ${WIN_FLAG} -DFPGA_EMULATOR")
set(EMULATOR_COMPILE_FLAGS "-fsycl -fintelfpga -Wall ${WIN_FLAG} -DFPGA_EMULATOR")
set(EMULATOR_LINK_FLAGS "-fsycl -fintelfpga")
set(HARDWARE_COMPILE_FLAGS "-fsycl -Wall -fintelfpga ${WIN_FLAG}")
set(SIMULATOR_COMPILE_FLAGS "-fsycl -fintelfpga -Wall ${WIN_FLAG} -Xssimulation -DFPGA_SIMULATOR")
set(SIMULATOR_LINK_FLAGS "-fsycl -fintelfpga -Xssimulation -Xsghdl -Xstarget=${FPGA_DEVICE} ${USER_HARDWARE_FLAGS}")
set(HARDWARE_COMPILE_FLAGS "-fsycl -fintelfpga -Wall ${WIN_FLAG} -DFPGA_HARDWARE")
set(HARDWARE_LINK_FLAGS "-fsycl -fintelfpga -Xshardware -Xstarget=${FPGA_DEVICE} ${USER_HARDWARE_FLAGS}")
# use cmake -D USER_HARDWARE_FLAGS=<flags> to set extra flags for FPGA backend compilation

Expand All @@ -82,6 +91,19 @@ set_target_properties(${EMULATOR_TARGET} PROPERTIES COMPILE_FLAGS "${EMULATOR_CO
set_target_properties(${EMULATOR_TARGET} PROPERTIES LINK_FLAGS "${EMULATOR_LINK_FLAGS}")
add_custom_target(fpga_emu DEPENDS ${EMULATOR_TARGET})

###############################################################################
### FPGA Simulator
###############################################################################
# To compile in a single command:
# icpx -fsycl -fintelfpga -Xssimulation -Xsghdl -Xstarget=<FPGA_DEVICE> -DFPGA_SIMULATOR <file>.cpp -o <file>.fpga_sim
# CMake executes:
# [compile] icpx -fsycl -fintelfpga -Xssimulation -DFPGA_SIMULATOR -o <file>.cpp.o -c <file>.cpp
# [link] icpx -fsycl -fintelfpga -Xssimulation -Xsghdl -Xstarget=<FPGA_DEVICE> <file>.cpp.o -o <file>.fpga_sim
add_executable(${SIMULATOR_TARGET} ${SOURCE_FILE})
set_target_properties(${SIMULATOR_TARGET} PROPERTIES COMPILE_FLAGS "${SIMULATOR_COMPILE_FLAGS}")
set_target_properties(${SIMULATOR_TARGET} PROPERTIES LINK_FLAGS "${SIMULATOR_LINK_FLAGS}")
add_custom_target(fpga_sim DEPENDS ${SIMULATOR_TARGET})

###############################################################################
### Generate Report
###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <array>
#include <iostream>

#if FPGA || FPGA_EMULATOR
#if FPGA_HARDWARE || FPGA_EMULATOR || FPGA_SIMULATOR
#include <sycl/ext/intel/fpga_extensions.hpp>
#endif

Expand Down Expand Up @@ -84,13 +84,16 @@ int main() {
// Create device selector for the device of your interest.
#if FPGA_EMULATOR
// Intel extension: FPGA emulator selector on systems without FPGA card.
ext::intel::fpga_emulator_selector d_selector;
#elif FPGA
auto selector = sycl::ext::intel::fpga_emulator_selector_v;
#elif FPGA_SIMULATOR
// Intel extension: FPGA simulator selector on systems without FPGA card.
auto selector = sycl::ext::intel::fpga_simulator_selector_v;
#elif FPGA_HARDWARE
// Intel extension: FPGA selector on systems with FPGA card.
ext::intel::fpga_selector d_selector;
auto selector = sycl::ext::intel::fpga_selector_v;
#else
// The default device selector will select the most performant device.
auto d_selector{default_selector_v};
auto selector = default_selector_v;
#endif

// Create array objects with "array_size" to store data.
Expand All @@ -101,7 +104,7 @@ int main() {
for (size_t i = 0; i < sequential.size(); i++) sequential[i] = value + i;

try {
queue q(d_selector, exception_handler);
queue q(selector, exception_handler);

// Print out the device information used for the kernel code.
cout << "Running on device: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <array>
#include <iostream>

#if FPGA || FPGA_EMULATOR
#if FPGA_HARDWARE || FPGA_EMULATOR || FPGA_SIMULATOR
#include <sycl/ext/intel/fpga_extensions.hpp>
#endif

Expand Down Expand Up @@ -75,13 +75,16 @@ int main() {
// Create device selector for the device of your interest.
#if FPGA_EMULATOR
// Intel extension: FPGA emulator selector on systems without FPGA card.
ext::intel::fpga_emulator_selector selector;
#elif FPGA
auto selector = sycl::ext::intel::fpga_emulator_selector_v;
#elif FPGA_SIMULATOR
// Intel extension: FPGA simulator selector on systems without FPGA card.
auto selector = sycl::ext::intel::fpga_simulator_selector_v;
#elif FPGA_HARDWARE
// Intel extension: FPGA selector on systems with FPGA card.
ext::intel::fpga_selector selector;
auto selector = sycl::ext::intel::fpga_selector_v;
#else
// The default device selector will select the most performant device.
auto selector{default_selector_v};
auto selector = default_selector_v;
#endif

constexpr int value = 100000;
Expand Down
45 changes: 37 additions & 8 deletions DirectProgramming/C++SYCL/DenseLinearAlgebra/vector-add/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ This sample provides example implementations of both Unified Shared Memory (USM)
| Hardware | GEN9 or newer <br> Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA (Intel® PAC with Intel® Arria® 10 GX FPGA)
| Software | Intel® oneAPI DPC++/C++ Compiler

> **Note**: Even though the Intel DPC++/C++ OneAPI compiler is enough to compile for CPU, GPU, FPGA emulation, generating FPGA reports and generating RTL for FPGAs, there are extra software requirements for the FPGA simulation flow and FPGA compiles.
>
> For using the simulator flow, Intel® Quartus® Prime Pro Edition and one of the following simulators must be installed and accessible through your PATH:
> - Questa*-Intel® FPGA Edition
> - Questa*-Intel® FPGA Starter Edition
> - ModelSim® SE
>
> When using the hardware compile flow, Intel® Quartus® Prime Pro Edition must be installed and accessible through your PATH.

## Key Implementation Details

The basic SYCL implementation explained in the code includes device selector, USM, buffer, accessor, kernel, and command groups.
Expand Down Expand Up @@ -111,19 +120,23 @@ To learn more about the extensions and how to configure the oneAPI environment,
```
make fpga_emu
```
2. Generate HTML performance reports.
2. Compile for simulation (fast compile time, targets simulator FPGA device):
```
make fpga_sim
```
3. Generate HTML performance reports.
```
make report
```
The reports reside at `simple-add_report.prj/reports/report.html`.

3. Compile the program for FPGA hardware. (Compiling for hardware can take a long
4. Compile the program for FPGA hardware. (Compiling for hardware can take a long
time.)
```
make fpga
```

4. Clean the program. (Optional)
5. Clean the program. (Optional)
```
make clean
```
Expand Down Expand Up @@ -168,19 +181,23 @@ time.)
```
nmake fpga_emu
```
2. Generate HTML performance reports.
2. Compile for simulation (fast compile time, targets simulator FPGA device):
```
nmake fpga_sim
```
3. Generate HTML performance reports.
```
nmake report
```
The reports reside at `simple-add_report.prj/reports/report.html`.

3. Compile the program for FPGA hardware. (Compiling for hardware can take a long
4. Compile the program for FPGA hardware. (Compiling for hardware can take a long
time.)
```
nmake fpga
```

4. Clean the program. (Optional)
5. Clean the program. (Optional)
```
nmake clean
```
Expand Down Expand Up @@ -221,7 +238,12 @@ The source files (`vector-add-buffers.cpp` and `vector-add-usm.cpp`) specify the
./vector-add-buffers.fpga_emu
./vector-add-usm.fpga_emu
```
3. Run on FPGA hardware.
3. Run on FPGA simulator.
```
CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1 ./vector-add-buffers.fpga_sim
CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1 ./vector-add-usm.fpga_sim
```
4. Run on FPGA hardware.
```
./vector-add-buffers.fpga
./vector-add-usm.fpga
Expand All @@ -248,7 +270,14 @@ The source files (`vector-add-buffers.cpp` and `vector-add-usm.cpp`) specify the
vector-add-buffers.fpga_emu.exe
vector-add-usm.fpga_emu.exe
```
3. Run on FPGA hardware.
3. Run on FPGA simulator.
```
set CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1
vector-add-buffers.fpga_sim.exe
vector-add-usm.fpga_sim.exe
set CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=
```
4. Run on FPGA hardware.
```
vector-add-buffers.fpga.exe
vector-add-usm.fpga.exe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,34 @@ add_custom_target(cpu-gpu DEPENDS ${TARGET_NAME})

# FPGA device selection
if(NOT DEFINED FPGA_DEVICE)
set(FPGA_DEVICE "intel_a10gx_pac:pac_a10")
if(DEFINED USM AND (NOT(USM EQUAL 0)))
set(FPGA_DEVICE "intel_s10sx_pac:pac_s10_usm")
set(DEFAULT_BOARD_STR "Intel Stratix(R) 10 SX with USM support")
else()
set(FPGA_DEVICE "intel_a10gx_pac:pac_a10")
set(DEFAULT_BOARD_STR "Intel Arria(R) 10 GX")
endif()
message(STATUS "FPGA_DEVICE was not specified.\
\nConfiguring the design to run on the default FPGA device ${FPGA_DEVICE} (Intel(R) PAC with Intel Arria(R) 10 GX FPGA). \
\nPlease refer to the README for information on device selection.")
\nConfiguring the design to run on the default FPGA board ${FPGA_DEVICE} (Intel(R) PAC with ${DEFAULT_BOARD_STR} FPGA). \
\nPlease refer to the README for information on board selection.")
else()
message(STATUS "Configuring the design to run on FPGA device ${FPGA_DEVICE}")
endif()


set(EMULATOR_TARGET ${TARGET_NAME}.fpga_emu)
set(SIMULATOR_TARGET ${TARGET_NAME}.fpga_sim)
set(FPGA_TARGET ${TARGET_NAME}.fpga)

# A DPC++ ahead-of-time (AoT) compile processes the device code in two stages.
# 1. The "compile" stage compiles the device code to an intermediate representation (SPIR-V).
# 2. The "link" stage invokes the compiler's FPGA backend before linking.
# For this reason, FPGA backend flags must be passed as link flags in CMake.
set(EMULATOR_COMPILE_FLAGS "-fsycl -Wall -fintelfpga -DFPGA_EMULATOR ${WIN_FLAG}")
set(EMULATOR_COMPILE_FLAGS "-fsycl -fintelfpga -Wall ${WIN_FLAG} -DFPGA_EMULATOR")
set(EMULATOR_LINK_FLAGS "-fsycl -fintelfpga")
set(HARDWARE_COMPILE_FLAGS "-fsycl -Wall -fintelfpga -DFPGA ${WIN_FLAG}")
set(SIMULATOR_COMPILE_FLAGS "-fsycl -fintelfpga -Wall ${WIN_FLAG} -Xssimulation -DFPGA_SIMULATOR")
set(SIMULATOR_LINK_FLAGS "-fsycl -fintelfpga -Xssimulation -Xsghdl -Xstarget=${FPGA_DEVICE} ${USER_HARDWARE_FLAGS}")
set(HARDWARE_COMPILE_FLAGS "-fsycl -fintelfpga -Wall ${WIN_FLAG} -DFPGA_HARDWARE")
set(HARDWARE_LINK_FLAGS "-fsycl -fintelfpga -Xshardware -Xstarget=${FPGA_DEVICE} ${USER_HARDWARE_FLAGS}")
# use cmake -D USER_HARDWARE_FLAGS=<flags> to set extra flags for FPGA backend compilation

Expand All @@ -82,6 +92,19 @@ set_target_properties(${EMULATOR_TARGET} PROPERTIES COMPILE_FLAGS "${EMULATOR_CO
set_target_properties(${EMULATOR_TARGET} PROPERTIES LINK_FLAGS "${EMULATOR_LINK_FLAGS}")
add_custom_target(fpga_emu DEPENDS ${EMULATOR_TARGET})

###############################################################################
### FPGA Simulator
###############################################################################
# To compile in a single command:
# icpx -fsycl -fintelfpga -Xssimulation -Xsghdl -Xstarget=<FPGA_DEVICE> -DFPGA_SIMULATOR <file>.cpp -o <file>.fpga_sim
# CMake executes:
# [compile] icpx -fsycl -fintelfpga -Xssimulation -DFPGA_SIMULATOR -o <file>.cpp.o -c <file>.cpp
# [link] icpx -fsycl -fintelfpga -Xssimulation -Xsghdl -Xstarget=<FPGA_DEVICE> <file>.cpp.o -o <file>.fpga_sim
add_executable(${SIMULATOR_TARGET} ${SOURCE_FILE})
set_target_properties(${SIMULATOR_TARGET} PROPERTIES COMPILE_FLAGS "${SIMULATOR_COMPILE_FLAGS}")
set_target_properties(${SIMULATOR_TARGET} PROPERTIES LINK_FLAGS "${SIMULATOR_LINK_FLAGS}")
add_custom_target(fpga_sim DEPENDS ${SIMULATOR_TARGET})

###############################################################################
### Generate Report
###############################################################################
Expand Down
Loading