Skip to content

Commit beafc8a

Browse files
authored
FPGA: Private copies - removes warning - removes simulation support (#1214)
* Revert "FPGA: Private copies sim support (#1210)" This reverts commit c2e5673. * Prevent warning, about optimizing away key array
1 parent e01bbb5 commit beafc8a

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

DirectProgramming/DPC++FPGA/Tutorials/Features/private_copies/README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ for (size_t i = 0; i < kMaxIter; i++) {
2525
for (size_t j = 0; j < kSize; j++) {
2626
a[j] = accessor_array[(i * 4 + j) % kSize] * shift;
2727
}
28-
for (size_t j = 0; j < kSize/2; j++)
28+
for (size_t j = 0; j < kSize / 2; j++)
2929
r += a[j];
3030
}
3131
```
@@ -122,10 +122,6 @@ When compiling for FPGA hardware, it is recommended to increase the job timeout
122122
```
123123
make report
124124
```
125-
* Compile for simulation (fast compile time, targets simulated FPGA device, reduced data size):
126-
```
127-
make fpga_sim
128-
```
129125
* Compile for FPGA hardware (longer compile time, targets FPGA device):
130126
```
131127
make fpga
@@ -163,10 +159,6 @@ When compiling for FPGA hardware, it is recommended to increase the job timeout
163159
```
164160
nmake report
165161
```
166-
* Compile for simulation (fast compile time, targets simulated FPGA device, reduced data size):
167-
```
168-
nmake fpga_sim
169-
```
170162
* Compile for FPGA hardware (longer compile time, targets FPGA device):
171163
```
172164
nmake fpga
@@ -202,12 +194,7 @@ On the main report page, scroll down to the section titled "Estimated Resource U
202194
./private_copies.fpga_emu (Linux)
203195
private_copies.fpga_emu.exe (Windows)
204196
```
205-
2. Run the sample on the FPGA simulator device:
206-
```
207-
./private_copies.fpga (Linux)
208-
private_copies.fpga.exe (Windows)
209-
```
210-
3. Run the sample on the FPGA device:
197+
2. Run the sample on the FPGA device:
211198
```
212199
./private_copies.fpga (Linux)
213200
private_copies.fpga.exe (Windows)
@@ -238,7 +225,7 @@ When run on the Intel&reg; PAC with Intel Arria10&reg; 10 GX FPGA hardware board
238225
239226
Setting the `private_copies` attribute to 0 (or equivalently omitting the attribute entirely) produced good throughput, and the reports show us that the compiler selected 3 private copies. This does produce the optimal throughput, but in this case it probably makes sense to save some area in exchange for a very small throughput loss by specifying 2 private copies instead.
240227
241-
When run on the FPGA emulator or simulator, the `private_copies` attribute has no effect on kernel time. You may actually notice that the emulator achieved higher throughput than the FPGA in this example. This is because this trivial example uses only a tiny fraction of the spatial compute resources available on the FPGA.
228+
When run on the FPGA emulator, the `private_copies` attribute has no effect on kernel time. You may actually notice that the emulator achieved higher throughput than the FPGA in this example. This is because this trivial example uses only a tiny fraction of the spatial compute resources available on the FPGA.
242229
243230
## License
244231
Code samples are licensed under the MIT license. See

DirectProgramming/DPC++FPGA/Tutorials/Features/private_copies/src/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
set(SOURCE_FILE private_copies.cpp)
22
set(TARGET_NAME private_copies)
33
set(EMULATOR_TARGET ${TARGET_NAME}.fpga_emu)
4-
set(SIMULATOR_TARGET ${TARGET_NAME}.fpga_sim)
54
set(FPGA_TARGET ${TARGET_NAME}.fpga)
65

76
# FPGA board selection
@@ -25,8 +24,6 @@ endif()
2524
# For this reason, FPGA backend flags must be passed as link flags in CMake.
2625
set(EMULATOR_COMPILE_FLAGS "-Wall ${WIN_FLAG} -fsycl -fintelfpga -DFPGA_EMULATOR")
2726
set(EMULATOR_LINK_FLAGS "-fsycl -fintelfpga")
28-
set(SIMULATOR_COMPILE_FLAGS "-Wall ${WIN_FLAG} -fsycl -fintelfpga -Xssimulation -DFPGA_SIMULATOR")
29-
set(SIMULATOR_LINK_FLAGS "-fsycl -fintelfpga -Xssimulation -Xstarget=${FPGA_DEVICE} ${USER_HARDWARE_FLAGS}")
3027
set(HARDWARE_COMPILE_FLAGS "-Wall ${WIN_FLAG} -fsycl -fintelfpga")
3128
set(HARDWARE_LINK_FLAGS "-fsycl -fintelfpga -Xshardware -Xstarget=${FPGA_DEVICE} ${USER_HARDWARE_FLAGS}")
3229
# use cmake -D USER_HARDWARE_FLAGS=<flags> to set extra flags for FPGA backend compilation
@@ -59,20 +56,6 @@ set_target_properties(${FPGA_EARLY_IMAGE} PROPERTIES COMPILE_FLAGS "${HARDWARE_C
5956
set_target_properties(${FPGA_EARLY_IMAGE} PROPERTIES LINK_FLAGS "${HARDWARE_LINK_FLAGS} -fsycl-link=early")
6057
# fsycl-link=early stops the compiler after RTL generation, before invoking Quartus®
6158

62-
###############################################################################
63-
### FPGA Simulator
64-
###############################################################################
65-
# To compile in a single command:
66-
# icpx -fsycl -fintelfpga -Xssimulation -DFPGA_SIMULATOR -Xstarget=<FPGA_DEVICE> private_copies.cpp -o private_copies.fpga
67-
# CMake executes:
68-
# [compile] icpx -fsycl -fintelfpga -Xssimulation -DFPGA_SIMULATOR -o private_copies.cpp.o -c private_copies.cpp
69-
# [link] icpx -fsycl -fintelfpga -Xssimulation -Xstarget=<FPGA_DEVICE> private_copies.cpp.o -o private_copies.fpga
70-
add_executable(${SIMULATOR_TARGET} EXCLUDE_FROM_ALL ${SOURCE_FILE})
71-
target_include_directories(${SIMULATOR_TARGET} PRIVATE ../../../../include)
72-
add_custom_target(fpga_sim DEPENDS ${SIMULATOR_TARGET})
73-
set_target_properties(${SIMULATOR_TARGET} PROPERTIES COMPILE_FLAGS "${SIMULATOR_COMPILE_FLAGS}")
74-
set_target_properties(${SIMULATOR_TARGET} PROPERTIES LINK_FLAGS "${SIMULATOR_LINK_FLAGS}")
75-
7659
###############################################################################
7760
### FPGA Hardware
7861
###############################################################################

DirectProgramming/DPC++FPGA/Tutorials/Features/private_copies/src/private_copies.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@
1515

1616
using namespace sycl;
1717

18-
#if defined(FPGA_SIMULATOR)
19-
// Smaller size to keep the runtime reasonable
20-
constexpr size_t kSize = 512; //2^9
21-
constexpr size_t kMaxIter = 100;
22-
#else
23-
constexpr size_t kSize = 8192; //2^13
18+
constexpr size_t kSize = 8192;
2419
constexpr size_t kMaxIter = 50000;
25-
#endif
2620
constexpr size_t kTotalOps = 2 * kMaxIter * kSize;
2721
constexpr size_t kMaxValue = 128;
2822

@@ -40,8 +34,6 @@ template <int num_copies>
4034
void SimpleMathWithShift(const IntArray &array, int shift, IntScalar &result) {
4135
#if defined(FPGA_EMULATOR)
4236
ext::intel::fpga_emulator_selector selector;
43-
#elif defined(FPGA_SIMULATOR)
44-
ext::intel::fpga_simulator_selector selector;
4537
#else
4638
ext::intel::fpga_selector selector;
4739
#endif
@@ -72,7 +64,7 @@ void SimpleMathWithShift(const IntArray &array, int shift, IntScalar &result) {
7264
}
7365
// The trip count of this loop is different from the loop above to
7466
// prevent the compiler optimizing array `a` out.
75-
for (size_t j = 0; j < kSize/2; j++)
67+
for (size_t j = 0; j < kSize / 2; j++)
7668
r += a[j];
7769
}
7870

@@ -122,7 +114,7 @@ int GoldenResult(const IntArray &input_arr, int shift) {
122114
for (size_t j = 0; j < kSize; j++) {
123115
a[j] = input_arr[(i * 4 + j) % kSize] * shift;
124116
}
125-
for (size_t j = 0; j < kSize/2; j++)
117+
for (size_t j = 0; j < kSize / 2; j++)
126118
gr += a[j];
127119
}
128120

0 commit comments

Comments
 (0)