Skip to content

Commit 86c4aa8

Browse files
FPGA: Remove db query 9 in 2023.0 (#1257)
1 parent 01cbd7c commit 86c4aa8

File tree

10 files changed

+14
-1160
lines changed

10 files changed

+14
-1160
lines changed

DirectProgramming/DPC++FPGA/ReferenceDesigns/db/README.md

+6-18
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,12 @@ This design leverages concepts discussed in the [FPGA tutorials](/DirectProgramm
6767

6868
### Query Implementations
6969

70-
The following sections describe at a high level how queries 1, 9, 11 and 12 are implemented on the FPGA using a set of generalized database operators (found in `db_utils/`). In the block diagrams below, the blocks are oneAPI kernels, and the arrows represent `pipes` that shows the flow of data from one kernel to another.
70+
The following sections describe at a high level how queries 1, 11 and 12 are implemented on the FPGA using a set of generalized database operators (found in `db_utils/`). In the block diagrams below, the blocks are oneAPI kernels, and the arrows represent `pipes` that shows the flow of data from one kernel to another.
7171

7272
#### Query 1
7373

7474
Query 1 is the simplest of the four queries and only uses the `Accumulator` database operator. The query streams in each row of the LINEITEM table and performs computation on each row.
7575

76-
#### Query 9
77-
78-
Query 9 is the most complicated of the four queries and utilizes all database operators (`LikeRegex`, `Accumulator`, `MapJoin`, `MergeJoin`, `DuplicateMergeJoin`, and `FifoSort`). The block diagram of the design is shown below.
79-
80-
![](assets/q9.png)
81-
8276
#### Query 11
8377

8478
Query 11 showcases the `MapJoin` and `FifoSort` database operators. The block diagram of the design is shown below.
@@ -98,8 +92,6 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
9892
|`dbdata.cpp` | Contains code to parse the database input files and validate the query output
9993
|`dbdata.hpp` | Definitions of database related data structures and parsing functions
10094
|`query1/query1_kernel.cpp` | Contains the kernel for Query 1
101-
|`query9/query9_kernel.cpp` | Contains the kernel for Query 9
102-
|`query9/pipe_types.cpp` | All data types and instantiations for pipes used in query 9
10395
|`query11/query11_kernel.cpp` | Contains the kernel for Query 11
10496
|`query11/pipe_types.cpp` | All data types and instantiations for pipes used in query 11
10597
|`query12/query12_kernel.cpp` | Contains the kernel for Query 12
@@ -141,7 +133,7 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
141133
cd build
142134
cmake .. -DQUERY=1
143135
```
144-
`-DQUERY=<QUERY_NUMBER>` can be any of the following query numbers: `1`, `9`, `11` or `12`.
136+
`-DQUERY=<QUERY_NUMBER>` can be any of the following query numbers: `1`, `11` or `12`.
145137

146138
3. Compile the design. (The provided targets match the recommended development flow.)
147139

@@ -155,14 +147,12 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
155147
```
156148
The report resides at `db_report.prj/reports/report.html`.
157149
158-
>**Note**: If you are compiling Query 9 (`-DQUERY=9`), expect a long report generation time. You can download pre-generated reports from [https://iotdk.intel.com/fpga-precompiled-binaries/latest/db.fpga.tar.gz](https://iotdk.intel.com/fpga-precompiled-binaries/latest/db.fpga.tar.gz).
159-
160150
3. Compile for FPGA hardware (longer compile time, targets FPGA device).
161151
162152
```
163153
make fpga
164154
```
165-
When building for hardware, the default scale factor is **1**. To use the smaller scale factor of 0.01, add the flag `-DSF_SMALL=1` to the original `cmake` command. For example: `cmake .. -DQUERY=9 -DSF_SMALL=1`. See the [Database files](#database-files) for more information.
155+
When building for hardware, the default scale factor is **1**. To use the smaller scale factor of 0.01, add the flag `-DSF_SMALL=1` to the original `cmake` command. For example: `cmake .. -DQUERY=11 -DSF_SMALL=1`. See the [Database files](#database-files) for more information.
166156
167157
(Optional) The hardware compile may take several hours to complete. You can download a pre-compiled binary (compatible with Linux* Ubuntu* 18.04) for an Intel® FPGA PAC D5005 (with Intel Stratix® 10 SX) from [https://iotdk.intel.com/fpga-precompiled-binaries/latest/db.fpga.tar.gz](https://iotdk.intel.com/fpga-precompiled-binaries/latest/db.fpga.tar.gz).
168158
@@ -177,7 +167,7 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
177167
cd build
178168
cmake -G "NMake Makefiles" -DQUERY=1
179169
```
180-
`-DQUERY=<QUERY_NUMBER>` can be any of the following query numbers: `1`, `9`, `11` or `12`.
170+
`-DQUERY=<QUERY_NUMBER>` can be any of the following query numbers: `1`, `11` or `12`.
181171
182172
3. Compile the design. (The provided targets match the recommended development flow.)
183173
@@ -192,8 +182,6 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
192182
```
193183
The report resides at `db_report.prj/reports/report.html` directory.
194184
195-
>**Note**: If you are compiling Query 9 (`-DQUERY=9`), expect a long report generation time.
196-
197185
3. Compile for FPGA hardware (longer compile time, targets FPGA device):
198186
```
199187
nmake fpga
@@ -219,7 +207,7 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
219207
```
220208
./db.fpga_emu --dbroot=../data/sf0.01 --test
221209
```
222-
(Optional) Run the design for queries `9`, `11` and `12`.
210+
(Optional) Run the design for queries `11` and `12`.
223211
224212
2. Run the design on an FPGA device.
225213
```
@@ -232,7 +220,7 @@ Query 12 showcases the `MergeJoin` database operator. The block diagram of the d
232220
```
233221
db.fpga_emu.exe --dbroot=../data/sf0.01 --test
234222
```
235-
(Optional) Run the design for queries `9`, `11` and `12`.
223+
(Optional) Run the design for queries `11` and `12`.
236224
237225
2. Run the sample on an FPGA device.
238226
```
Binary file not shown.

DirectProgramming/DPC++FPGA/ReferenceDesigns/db/sample.json

-24
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@
3030
"./db.fpga_emu --dbroot=../data/sf0.01 --test"
3131
]
3232
},
33-
{
34-
"id": "fpga_emu_q9",
35-
"steps": [
36-
"icpx --version",
37-
"mkdir build-q9",
38-
"cd build-q9",
39-
"cmake .. -DQUERY=9",
40-
"make fpga_emu",
41-
"./db.fpga_emu --dbroot=../data/sf0.01 --test"
42-
]
43-
},
4433
{
4534
"id": "fpga_emu_q11",
4635
"steps": [
@@ -108,19 +97,6 @@
10897
"db.fpga_emu.exe --dbroot=../data/sf0.01 --test"
10998
]
11099
},
111-
{
112-
"id": "fpga_emu_q9",
113-
"steps": [
114-
"icpx --version",
115-
"cd ../..",
116-
"mkdir build-q9",
117-
"cd build-q9",
118-
"xcopy /E ..\\ReferenceDesigns\\db\\data ..\\data\\",
119-
"cmake -G \"NMake Makefiles\" ../ReferenceDesigns/db -DQUERY=9",
120-
"nmake fpga_emu",
121-
"db.fpga_emu.exe --dbroot=../data/sf0.01 --test"
122-
]
123-
},
124100
{
125101
"id": "fpga_emu_q11",
126102
"steps": [

DirectProgramming/DPC++FPGA/ReferenceDesigns/db/src/CMakeLists.txt

+6-18
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ endif()
1515
if(${QUERY} EQUAL 1)
1616
set(DEFAULT_BOARD "intel_a10gx_pac:pac_a10")
1717
set(DEFAULT_BOARD_STR "Intel Arria(R) 10 GX")
18-
elseif(${QUERY} EQUAL 9)
19-
set(DEFAULT_BOARD "intel_s10sx_pac:pac_s10")
20-
set(DEFAULT_BOARD_STR "Intel Stratix(R) 10 SX")
2118
elseif(${QUERY} EQUAL 11)
2219
set(DEFAULT_BOARD "intel_s10sx_pac:pac_s10")
2320
set(DEFAULT_BOARD_STR "Intel Stratix(R) 10 SX")
@@ -45,8 +42,8 @@ else()
4542
endif()
4643

4744
# ensure a supported query was requested
48-
if(NOT ${QUERY} EQUAL 1 AND NOT ${QUERY} EQUAL 9 AND NOT ${QUERY} EQUAL 11 AND NOT ${QUERY} EQUAL 12)
49-
message(FATAL_ERROR "\tQUERY ${QUERY} not supported (supported queries are 1, 9, 11 and 12)")
45+
if(NOT ${QUERY} EQUAL 1 AND NOT ${QUERY} EQUAL 11 AND NOT ${QUERY} EQUAL 12)
46+
message(FATAL_ERROR "\tQUERY ${QUERY} not supported (supported queries are 1, 11 and 12)")
5047
endif()
5148

5249
# Pick the default seed if the user did not specify one to CMake.
@@ -55,8 +52,6 @@ if(NOT DEFINED SEED)
5552
if(${FPGA_DEVICE} MATCHES ".*a10.*")
5653
if(${QUERY} EQUAL 1)
5754
set(SEED "-Xsseed=2")
58-
elseif(${QUERY} EQUAL 9)
59-
set(SEED "-Xsseed=2")
6055
elseif(${QUERY} EQUAL 11)
6156
set(SEED "-Xsseed=4")
6257
elseif(${QUERY} EQUAL 12)
@@ -65,8 +60,6 @@ if(NOT DEFINED SEED)
6560
elseif(${FPGA_DEVICE} MATCHES ".*s10.*")
6661
if(${QUERY} EQUAL 1)
6762
set(SEED "-Xsseed=3")
68-
elseif(${QUERY} EQUAL 9)
69-
set(SEED "-Xsseed=2")
7063
elseif(${QUERY} EQUAL 11)
7164
set(SEED "-Xsseed=3")
7265
elseif(${QUERY} EQUAL 12)
@@ -75,8 +68,6 @@ if(NOT DEFINED SEED)
7568
elseif(${FPGA_DEVICE} MATCHES ".*agilex.*")
7669
if(${QUERY} EQUAL 1)
7770
set(SEED "-Xsseed=2")
78-
elseif(${QUERY} EQUAL 9)
79-
set(SEED "-Xsseed=2")
8071
elseif(${QUERY} EQUAL 11)
8172
set(SEED "-Xsseed=4")
8273
elseif(${QUERY} EQUAL 12)
@@ -91,10 +82,10 @@ if(IGNORE_DEFAULT_SEED)
9182
set(SEED "")
9283
endif()
9384

94-
# Error out if trying to run Q9 or Q11 on Arria 10
85+
# Error out if trying to run Q11 on Arria 10
9586
if (${FPGA_DEVICE} MATCHES ".*a10.*")
96-
if(${QUERY} EQUAL 9 OR ${QUERY} EQUAL 11)
97-
message(FATAL_ERROR "Queries 9 and 11 are not supported on Arria 10 devices")
87+
if(${QUERY} EQUAL 11)
88+
message(FATAL_ERROR "Query 11 is not supported on Arria 10 devices")
9889
endif()
9990
endif()
10091

@@ -115,17 +106,14 @@ endif()
115106
if(${QUERY} EQUAL 1)
116107
set(DEVICE_SOURCE query1/query1_kernel.cpp)
117108
set(DEVICE_HEADER query1/query1_kernel.hpp)
118-
elseif(${QUERY} EQUAL 9)
119-
set(DEVICE_SOURCE query9/query9_kernel.cpp)
120-
set(DEVICE_HEADER query9/query9_kernel.hpp)
121109
elseif(${QUERY} EQUAL 11)
122110
set(DEVICE_SOURCE query11/query11_kernel.cpp)
123111
set(DEVICE_HEADER query11/query11_kernel.hpp)
124112
elseif(${QUERY} EQUAL 12)
125113
set(DEVICE_SOURCE query12/query12_kernel.cpp)
126114
set(DEVICE_HEADER query12/query12_kernel.hpp)
127115
else()
128-
message(FATAL_ERROR "\tQUERY ${QUERY} not supported (supported queries are 1, 9, 11 and 12)")
116+
message(FATAL_ERROR "\tQUERY ${QUERY} not supported (supported queries are 1, 11 and 12)")
129117
endif()
130118

131119
# A SYCL ahead-of-time (AoT) compile processes the device code in two stages.

DirectProgramming/DPC++FPGA/ReferenceDesigns/db/src/db.cpp

+2-59
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ using namespace sycl;
4242
bool DoQuery1(queue& q, Database& dbinfo, std::string& db_root_dir,
4343
std::string& args, bool test, bool print, double& kernel_latency,
4444
double& total_latency);
45-
#elif (QUERY == 9)
46-
#include "query9/query9_kernel.hpp"
47-
bool DoQuery9(queue& q, Database& dbinfo, std::string& db_root_dir,
48-
std::string& args, bool test, bool print, double& kernel_latency,
49-
double& total_latency);
5045
#elif (QUERY == 11)
5146
#include "query11/query11_kernel.hpp"
5247
bool DoQuery11(queue& q, Database& dbinfo, std::string& db_root_dir,
@@ -173,9 +168,9 @@ int main(int argc, char* argv[]) {
173168
}
174169

175170
// make sure the query is supported
176-
if (!(query == 1 || query == 9 || query == 11 || query == 12)) {
171+
if (!(query == 1 || query == 11 || query == 12)) {
177172
std::cerr << "ERROR: unsupported query (" << query << "). "
178-
<< "Only queries 1, 9, 11 and 12 are supported\n";
173+
<< "Only queries 1, 11 and 12 are supported\n";
179174
return 1;
180175
}
181176

@@ -229,13 +224,6 @@ int main(int argc, char* argv[]) {
229224
success = DoQuery1(q, dbinfo, db_root_dir, args,
230225
test_query, print_result,
231226
kernel_latency[run], total_latency[run]);
232-
#endif
233-
} else if (query == 9) {
234-
// query9
235-
#if (QUERY == 9)
236-
success = DoQuery9(q, dbinfo, db_root_dir, args,
237-
test_query, print_result,
238-
kernel_latency[run], total_latency[run]);
239227
#endif
240228
} else if (query == 11) {
241229
// query11
@@ -363,51 +351,6 @@ bool DoQuery1(queue& q, Database& dbinfo, std::string& db_root_dir,
363351
}
364352
#endif
365353

366-
#if (QUERY == 9)
367-
bool DoQuery9(queue& q, Database& dbinfo, std::string& db_root_dir,
368-
std::string& args, bool test, bool print, double& kernel_latency,
369-
double& total_latency) {
370-
// the default colour regex based on the TPCH documents
371-
std::string colour = "GREEN";
372-
373-
// parse the query arguments
374-
if (!test && !args.empty()) {
375-
std::stringstream ss(args);
376-
std::getline(ss, colour, ',');
377-
} else {
378-
if (!args.empty()) {
379-
std::cout << "Testing query 9, therefore ignoring the '--args' flag\n";
380-
}
381-
}
382-
383-
// convert the colour regex to uppercase characters (convention)
384-
transform(colour.begin(), colour.end(), colour.begin(), ::toupper);
385-
386-
std::cout << "Running Q9 with colour regex: " << colour << std::endl;
387-
388-
// the output of the query
389-
std::array<DBDecimal, 25 * 2020> sum_profit;
390-
391-
// perform the query
392-
bool success = SubmitQuery9(q, dbinfo, colour, sum_profit, kernel_latency,
393-
total_latency);
394-
395-
if (success) {
396-
// validate the results of the query, if requested
397-
if (test) {
398-
success = dbinfo.ValidateQ9(db_root_dir, sum_profit);
399-
}
400-
401-
// print the results of the query, if requested
402-
if (print) {
403-
dbinfo.PrintQ9(sum_profit);
404-
}
405-
}
406-
407-
return success;
408-
}
409-
#endif
410-
411354
#if (QUERY == 11)
412355
bool DoQuery11(queue& q, Database& dbinfo, std::string& db_root_dir,
413356
std::string& args, bool test, bool print, double& kernel_latency,

0 commit comments

Comments
 (0)