Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit a82880d

Browse files
committed
Don't run sort on gpu in L0 case
1 parent 798103a commit a82880d

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

omniscidb/QueryEngine/MemoryLayoutBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,9 @@ std::unique_ptr<QueryMemoryDescriptor> MemoryLayoutBuilder::build(
11061106
Executor* executor,
11071107
const ExecutorDeviceType device_type) {
11081108
bool sort_on_gpu_hint =
1109-
device_type == ExecutorDeviceType::GPU && allow_multifrag &&
1110-
!ra_exe_unit_.sort_info.order_entries.empty() &&
1109+
(device_type == ExecutorDeviceType::GPU && executor->getDataMgr()->getGpuMgr() &&
1110+
executor->getDataMgr()->getGpuMgr()->getPlatform() != GpuMgrPlatform::L0) &&
1111+
allow_multifrag && !ra_exe_unit_.sort_info.order_entries.empty() &&
11111112
gpu_can_handle_order_entries(
11121113
ra_exe_unit_, query_infos, ra_exe_unit_.sort_info.order_entries, executor);
11131114
// must_use_baseline_sort is true iff we'd sort on GPU with the old algorithm

omniscidb/Tests/IntelGPUEnablingTest.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,33 @@ struct ExecuteTestBase {
231231
}
232232
}
233233

234+
static void createGpuSortTestTable() {
235+
createTable("gpu_sort_test",
236+
{{"x", ctx().int64()},
237+
{"y", ctx().int32()},
238+
{"z", ctx().int16()},
239+
{"t", ctx().int8()}},
240+
{2});
241+
run_sqlite_query("DROP TABLE IF EXISTS gpu_sort_test;");
242+
run_sqlite_query(
243+
"CREATE TABLE gpu_sort_test (x bigint, y int, z smallint, t tinyint);");
244+
TestHelpers::ValuesGenerator gen("gpu_sort_test");
245+
for (size_t i = 0; i < 4; ++i) {
246+
insertCsvValues("gpu_sort_test", "2,2,2,2");
247+
run_sqlite_query(gen(2, 2, 2, 2));
248+
}
249+
for (size_t i = 0; i < 6; ++i) {
250+
insertCsvValues("gpu_sort_test", "16000,16000,16000,127");
251+
run_sqlite_query(gen(16000, 16000, 16000, 127));
252+
}
253+
}
254+
234255
static void createAndPopulateTestTables() {
235256
createTestInnerTable();
236257
createTestTable();
237258
createSmallTestsTable();
238259
createTestInnerLoopJoinTable();
260+
createGpuSortTestTable();
239261
}
240262
};
241263

@@ -851,6 +873,7 @@ TEST_F(BasicTest, Sort) {
851873
c("SELECT COUNT(*) as val from test GROUP BY x ORDER BY val DESC;", g_dt);
852874
c("SELECT x, COUNT(*) as val from test GROUP BY x ORDER BY val DESC;", g_dt);
853875
c("SELECT COUNT(*) as val from test GROUP BY x ORDER BY val ASC LIMIT 2;", g_dt);
876+
c("SELECT x, COUNT(*) AS val FROM gpu_sort_test GROUP BY x ORDER BY val DESC;", g_dt);
854877
}
855878

856879
class FallbackTest : public ExecuteTestBase, public ::testing::Test {

0 commit comments

Comments
 (0)