
Q1
Q3
Q5
Q6
Q10
Q12
Q14
Q19
Q1.1
Q1.2
Q1.3
Q2.1
Q2.2
Q2.3
Q3.1
Q3.2
Q3.3
Q3.4
Q4.1
Q4.2
Q4.3
0
20
40
60
80
100
Execution Time Breakdown (%)
Divergence Resource Contention
Others
Figure 1: Execution time breakdown of TPC-H and SSB
queries demonstrating the impact of divergent execution
and resource contention among threads.
of divergence and resource contention were estimated based on
the achieved execution eciency of the warps and GPU hardware
occupancy rate, both of which can be obtained using proling tools
from GPU vendors. The results of the breakdown clearly demon-
strate that divergent execution and resource contention among
the threads have a signicant impact on the overall performance
of both TPC-H and SSB queries. Overall these ineciencies can
contribute to more than 50% of the total execution time. Therefore,
divergence and resource contention have now become the most
signicant bottleneck for query processing on GPUs.
In this paper, we propose Pyper, a JIT compilation-based query
processing system to resolve GPUs’ divergence and resource con-
tention issues. Pyper introduces two new operators for query plan
transformation, Shue and Segment, to improve GPU hardware
utilization during query execution. Specically, Shue is applied
to a pipeline to reduce the execution divergence. Segment is used
to split a pipeline that has overwhelming resource usage into sev-
eral pipelines with lower resource usage but much higher thread
parallelism. The benets of the two operators come with overheads.
Thus, we develop a cost model to guide the optimal use of Shue
and Segment operators. The challenge is that we need to estimate
the impact of divergence and resource contention, which have been
overlooked in the previous studies [14, 15].
The major contributions of this paper are as follows.
•
We study the eciency of current JIT compilation-based
query processing approaches and identify their severe under-
utilization of GPU hardware due to divergent execution and
degraded parallelism arising from resource contention.
•
We propose Pyper to address the execution eciency issues
of existing JIT compilation-based systems, by introducing
two new operators (Shue and Segment) and an analytical
model to determine the usage of the two operators in a cost-
ecient manner.
•
We conduct in-depth experiments demonstrating the benet
of using the Shue and Segment operators as well as the
accuracy of our analytical model. Our experiments show
that Pyper is able to improve the performance of TPC-H
and SSB queries on average by 1.60x and 1.52x, compared
to Hawk [5]. Pyper further achieves 5.01x and 2.55x perfor-
mance improvement over Omnisci [
2
] for TPC-H and SSB
queries respectively.
The rest of this paper is organized as follows. In Section 2.1, we
present the GPU hardware’s background and the related work on
JIT query compilation. We then present the architecture design of
Pyper in Section 3. We present the details of the analytical model
and query optimizer in Sections 4 and 5, respectively. We present
the experiments in Section 6 and conclude in Section 7.
2 BACKGROUND AND RELATED WORK
2.1 GPU Hardware & CUDA
A single GPU consists of multiple streaming multiprocessors (SMs),
each of which consists of multiple CUDA cores. All CUDA cores in
an SM share resources like the registers and shared memory. Due
to this sharing, the workload scheduler in GPU only schedules new
threads for execution on an SM, if there are enough registers and
shared memory resources available. GPUs also have an L2 cache
and a global memory that are shared among all the SMs. Each
thread block is given exclusive access to shared memory, i.e., data
in shared memory cannot be shared across dierent thread blocks.
Warp-at-a-time execution model:
In the CUDA programming
model, a program executed by the GPU is known as a kernel. A
kernel is executed as a grid of thread blocks, which can further
be divided into warps (groups of 32 threads). Each thread block
is assigned to a single SM, and the CUDA cores inside each SM
executes the threads in a SIMD fashion, at the granularity of a
single warp. Hence, during any given execution cycle, an entire
warp of threads can only execute a single instruction. That means,
during each instruction issue cycle, only threads that can execute
the same instruction will be activated, and the resources allocated
to the other threads would be wasted. Thus, branch divergence can
be a serious performance issue on GPU executions.
Resource constraints per thread:
For the eciency of GPU
executions, registers, and shared memory are the key resources
that constrain the number of parallel thread executions. Warps can
only be scheduled for execution on GPUs if there are enough free
hardware resources available.
2.2 JIT Query Compilation
JIT compilation-based systems (hereafter referred to as compiled sys-
tems) [
5
–
7
,
11
] have been developed to further reduce unnecessary
materialization of intermediate data at operator/kernel boundaries
within query pipelines and to reduce the instruction count within
GPU kernels. In the following, we review the related work of JIT-
based query engines on GPUs (more related work can be found at
our technical report [29]).
LLVM based database systems like Voodoo [
31
], HetExchange [
6
],
HAPE [
7
], OmniSci (formerly known as MapD) and OpenCL based
HorseQC [
11
] and Hawk [
5
] were proposed to generate optimized
executable code for heterogeneous systems containing both CPUs
and GPUs. Both Voodoo [
31
] and Hawk [
5
] attempt to generate code
to execute on a variety of parallel architectures. HetExchange [
6
] de-
veloped abstraction for device-oblivious operators and exploited the
heterogeneous parallelism of modern servers with multiple CPUs/G-
PUs. HorseQC [
11
] extends the operator-at-a-time approach by
203
评论