Elamur Research

GPU LSM: A Dynamic Dictionary Data Structure for the GPU

Paper · 2017 · Saman Ashkiani, Shengren Li, Martin Farach-Colton et al.

Summary

A dictionary is easy to search when all its keys sit in one sorted array. Keeping that array sorted can be expensive when new records keep arriving or old ones need to be removed. In GPU parallel computing, the awkward case is an update large enough to occupy many threads but small enough that rebuilding the whole dictionary would waste work. The authors address that case with GPU LSM, a dictionary based on the log-structured merge tree. It handles batches of changes and supports queries for a single key, the number of keys in an interval, or the records in that interval.

The design divides the dictionary into sorted arrays of increasing capacity. An incoming batch is sorted and placed in the smallest empty level it can reach. Whenever it encounters a full level, it merges with that level and moves on. A deletion enters through the same path as an insertion, using a marker called a tombstone. The structure can retain older records because queries use the order of the levels and the order of records within each level to determine which version of a key is current. An explicit cleanup operation later discards obsolete records and reorganizes the surviving data.

On an NVIDIA Tesla K40c, the GPU LSM achieved a harmonic mean of 225.3 M elements/s across the tested insertion batch sizes, compared with 16.7 M elements/s for a GPU sorted array, a reported advantage of 13.5x. Both structures could be built quickly from a single initial collection. The large difference appeared when the authors repeatedly added batches to a growing dictionary. Individual update rates varied substantially because a batch sometimes had to merge through several occupied levels.

Retrieval favored the sorted array. When every requested key existed, the GPU LSM averaged 75.7 M lookups/s and the sorted array averaged 133.3 M lookups/s. For intervals with an expected result size of 8, the GPU LSM averaged 32.7 M count queries/s and 23.3 M range queries/s. Wider intervals reduced both rates because they brought more candidate records into validation. In a separate experiment, cleanup cut the time for a large sequence of lookups enough to recover its own cost. Together, the measurements show where the recurring cost moves when the dictionary accepts updates cheaply. Searches may have to visit several arrays, and interval queries must resolve competing versions before they can return an answer.

Deep dive: GPU LSM: A Dynamic Dictionary Data Structure for the GPU

GPU LSM uses sorted levels to update a GPU dictionary in batches, trading some lookup and range-query speed for faster insertions and deletions. · about 34 minutes to read

The problem and its context

What the dictionary has to preserve

A dictionary associates a key with a value. The keys in this paper have a total order, so any pair of keys can be compared. That order supports questions about intervals as well as requests for a particular key. A lookup asks for the value currently associated with a key. A count asks how many current entries are between two endpoints, including the endpoints. A range query asks for the entries themselves, including their values. Inserting a key that already exists replaces its value. Deleting a key removes the association, even if the physical representation happens to retain a record of it.

A single sorted array is a natural starting point. A lookup can use binary search, repeatedly restricting its attention to the part of the array where the key could occur. An interval query can find the beginning and end of the relevant run of records. Both procedures benefit from having all the keys in the same order in the same array. Updating that representation brings a different kind of work. Adding a sorted group of records may require a merge with the resident array. Even when the new group is small, the merge can involve the old data throughout the array.

A hash table offers another starting point if the main requirement is to find individual keys. The paper uses the GPU cuckoo hash table from work on real-time parallel hashing on the GPU as its point of comparison. The table supports fast construction and point lookup. The ordering needed for an interval is absent from the hash layout, so a count or range query cannot isolate its candidates through the positions of its endpoints. The implementation the authors use also has limited provision for runtime insertion and lacks deletion. Its strengths address a different portion of the dictionary interface.

Some of the earlier structures discussed in the paper supported richer searches. Grid files organized multidimensional data for database queries. Other work explored a binary tree designed around hardware characteristics and a GPU search procedure for a B+ tree built on the CPU. Spatial structures supported range searches and queries over moving objects. The authors identify a shared barrier in the work they discuss. Changing the structure generally required rebuilding it, and for several structures the construction itself took place on the CPU. Fast GPU queries and fast GPU construction were separate achievements. Efficient recurring changes added a further requirement.

Why the size of an update matters

The paper distinguishes three regimes for updating a dictionary. A few changes offer little parallel work, and a serial procedure may suffice. At the other extreme, if the incoming data is on the scale of the existing dictionary, rebuilding the whole structure may be a reasonable way to use the device. The paper concentrates on the middle regime. A batch contains enough changes to run in parallel, while the current dictionary is large enough that revisiting all of it for every batch is expensive.

The middle regime is especially awkward for a tree whose shape changes during insertion. A change to a balanced tree can trigger rebalancing. Concurrent insertions may cause several threads to modify overlapping parts of the tree, so each insertion cannot be understood as an independent action. The authors seek a layout whose updates can be expressed as collective operations on arrays. Parallel work can then go into sorting or merging records within an update, while the progress of one batch through the structure can follow a predictable rule.

The hardware makes the organization of memory accesses important. The GPU groups threads into warps that execute together and schedules thread blocks across streaming multiprocessors. Threads in a block can exchange data through shared memory. Data that must persist across operations resides in global memory, which all threads can access. The paper emphasizes arranging adjacent threads’ accesses so that they address nearby locations. These coalesced accesses help the device use global-memory bandwidth. Parallelism alone leaves a problem if each thread has to fetch small pieces of data from unrelated addresses.

The authors mention several applications that motivate a changing ordered dictionary, including repeated spatial queries on moving objects, processing dynamic graphs and trees, and dynamic memory allocation. Their ray-tracing example illustrates the cost of depending on reconstruction. The OptiX engine they discuss generally rebuilt its bounding volume hierarchy each frame, with limited exceptions. These examples explain why incremental updates mattered to the authors. The dictionary study evaluates the operations that such applications might use.

What the design takes from earlier dictionaries

The authors contrast these GPU requirements with the assumptions behind common CPU dictionaries. Balanced trees and related structures can do a small amount of work at each of several levels, but a search may have to fetch data separately at each level. External-memory dictionaries address a similar locality problem by organizing work around blocks of data that are fetched together. A B-tree places many keys in a node so that a single fetched page can guide the search among many children. The paper treats this as a useful precedent for thinking about locality and notes that B-trees leave room for improvement on updates.

The log-structured merge tree, or LSM, improves insertion by maintaining collections at increasing sizes. New data enters a small collection first. When its contents need to move into a larger collection, they move together. Over a long sequence of inserts, most batches visit only the smaller collections during their initial update. A collection at a large level is touched less frequently. Searching takes a different route because a key might be present at any occupied level.

The cache-oblivious lookahead array, or COLA, uses sorted arrays at its levels. It also maintains links across levels so that a search performed at one level can help locate the search position in another. That technique is called fractional cascading. The GPU LSM takes the graded capacity and merge-based insertion strategy from the LSM, and it takes the sorted-array layout from the COLA. It searches the arrays separately. The authors judged that maintaining the extra links would complicate parallel updates, so each level can be built and merged using its own array. The consequences for update work and retrieval work follow from that choice.

The method, step by step

The answer the structure owes the caller

It helps to separate the dictionary the caller sees from the records the GPU stores. In the dictionary, a key has a current value or is absent. In storage, the same key can occur several times. A stored record can represent a value that was replaced, a value that was deleted, or the deletion itself. The ordering of those records makes it possible to recover the current state without removing outdated records at the moment an update arrives.

The paper starts from a set of key–value pairs. Its insertion rule can be written as follows.

S ← (S − {⟨k, ∗⟩}) ∪ {⟨k, v⟩}

Here S is the set of current pairs, k is the incoming key, and v is its new value. Angle brackets enclose a pair. The wildcard ∗ stands for any value associated with k. Braces denote sets, − removes the indicated pair if it is present, and ∪ adds the incoming pair. The arrow ← says that the expression on the right becomes the new dictionary state.

Deletion changes the visible state in a related way.

S ← S − {⟨k, ∗⟩}

S again denotes the current pairs, k is the key being deleted, and ∗ allows any value for that key. The angle brackets identify the pair and the braces enclose the set to remove. The subtraction is set difference, and ← assigns the result as the current state. A lookup returns the matching pair when the key is present, or ⊥, the paper’s symbol for absence.

Count and range queries both select keys by the same inclusive condition.

k₁ ≤ k ≤ k₂

k₁ is the lower endpoint, k₂ is the upper endpoint, and k is a key under consideration. The symbol ≤ includes equality at each boundary. Count returns the number of current pairs meeting the condition. Range returns those pairs. The distinction affects how much work the GPU does after it determines which records are current.

What a batch means

Each GPU LSM has a chosen update batch size. The choice stays fixed for that instance and determines the capacity of its smallest level. Inserts and deletions can be mixed within an update batch. Queries may be issued in groups of arbitrary size. Query work and update work happen in separate phases, so a query sees a structure after an update has been applied or before it begins. During a query phase, many queries can read the same structure independently or cooperate on parts of their processing.

Time advances by batch for the purpose of deciding which record is current. If a key receives a new value in a later batch, that value replaces an earlier one. If several inserts of the same key occur within a batch, the interface permits an arbitrary choice among them. A deletion in the same batch as an insertion takes precedence for that key. Repeated deletions of the key in one batch have the effect of a single deletion. These rules give the implementation a definite ordering across batches and a simpler rule within a batch, where concurrent records need no finer chronology.

The paper also describes how to fill an update when a caller has fewer records than the configured batch size. It can repeat an input record until the batch reaches its required length. The duplicates leave the visible result intact because identical copies of the chosen record contribute the same update. They still consume processing capacity, which matters when choosing a batch size for a particular stream of updates.

R b₀ / b

R is the average insertion rate for full batches, b₀ is the number of actual incoming elements, and b is the configured batch size. Juxtaposition multiplies R by b₀, and / divides the result by b. The expression describes the portion of the full physical insertion rate spent on the actual input under padding.

Placing a new batch

The levels are numbered from the smallest up. A level is either empty or filled to capacity. Its capacity follows a doubling rule.

b · 2ⁱ

b is the fixed batch size, · denotes multiplication, and i is the level index starting at zero. The power 2ⁱ expresses how many batch-sized groups fit at that level. A full level holds a sorted array of that capacity.

The dictionary’s resident size can therefore be described in batch units.

n = r b

n is the number of resident records, r is the number of batch-sized units they occupy, and b is the number of records in a batch. The juxtaposition of r and b means multiplication. Resident records can include superseded values and tombstones. After cleanup, the storage can also include padding. The current number of dictionary entries can consequently be smaller than n.

The binary representation of r describes which levels are full. Each set bit corresponds to a full level at the same position. A batch starts at the smallest level. If that level is empty, the sorted batch fits directly. If the level is full, both inputs have the same size. Merging them produces a sorted array of the right size for the next level, and the smaller level becomes empty. The operation continues until the merged array reaches an empty level. The analogy to a binary counter is exact at the level of occupancy. Adding a batch advances the counter, and every carry corresponds to a merge.

The paper illustrates an insertion into a dictionary containing 5b resident records. Its contents occupy a smallest run and a larger run. Adding a batch first fills the capacity of the smallest run twice over, so the two equally sized runs are merged. The next level has room for the result, and the larger run already present can be left alone. This is the kind of update the layout is designed to make cheap. The new records are brought into the structure without reorganizing the largest resident array.

How GPU LSM applies a mixed update batch

The steps in order.

How GPU LSM applies a mixed update batchStep 1: Encode deletions as tombstones1. Encode deletions as tombstonesStep 2: Sort the batch by key and status2. Sort the batch by key and statusStep 3: Start at the smallest level3. Start at the smallest levelStep 4: Merge with an occupied level in key order4. Merge with an occupied level in key orderStep 5: Clear that level and carry the merged array5. Clear that level and carry the merged arrayStep 6: Store the array at the first empty level6. Store the array at the first empty level

Making sorted records preserve time

The implementation uses 32-bit variables for keys and values. It devotes the least significant bit of the stored key variable to a status flag, leaving 31 bits for the original key. In a freshly sorted batch, a tombstone for a key must precede a regular record for that key, so the tombstone uses a zero status bit and the regular record uses a set bit. Sorting by the complete encoded key puts records in original-key order and breaks a tie in favor of a tombstone.

A merge between runs has a different obligation. Consider a deletion in an older batch followed by a new insertion of that key. The new value must win, even though its status bit would place it after the old deletion in a sort by the complete encoded key. The merge therefore compares the original keys while ignoring the status bit. On a tie, it takes the record from the newer run first. The merge is stable in the sense needed here. The previously established order of equal keys in each input survives, and the equal keys from the newer input precede the equal keys from the older input.

The two comparison rules meet different parts of the interface. Sorting the incoming batch establishes the precedence of deletions within that batch. Merging runs establishes the precedence of more recent batches. A tombstone can consequently appear after a newer regular record with the same key in a merged array. That order is necessary for an insertion to restore a previously deleted key. Keeping the rules separate also explains how time can be recovered without a separate timestamp for each entry.

During ordinary incremental insertion, the smaller occupied levels contain more recent data than the larger ones. Whenever a lower level participates in a merge, the running result includes the records carried from below, which are newer than the records already at that level. Thus there is an order across levels and an order among equal keys within a level. When the authors later rebuild the structure during cleanup, they retain just the winning value for each live key. At that point the original chronology of different keys can be discarded.

The GPU implementation uses CUB’s radix sort for the incoming batch and a merge from moderngpu with a modified comparison. The merge writes its output into separate storage. During successive merges, the implementation alternates between buffers, so the previous result is available as input while the next result is written elsewhere. The libraries use shared memory to organize traffic to global memory into coalesced accesses. Sorted levels also give the smaller arrays a chance to benefit from caching without requiring their sizes to be tailored to particular cache boundaries.

How much work a sequence of updates takes

The binary layout permits an expensive individual update. If all the lower levels are full, a carry can travel through all of them. As the sizes double, the last merge can involve a large fraction of the resident records. The long-run analysis instead follows each element. A record starts in a batch and participates in a merge whenever it is moved to a larger level. There is a limit on how many larger levels can exist after a given number of batches.

O(r b log r)

r is the number of inserted batches in the sequence, b is the number of elements per batch, and log is the logarithm. O gives an asymptotic upper bound on total work. The paper’s argument charges each of the r b elements for the merges it can participate in. Dividing the total work across the inserted elements gives amortized work of O(log r) per element. Here amortized refers to the cost averaged over an update sequence, including the occasional expensive carries.

The paper also states the scale of an individual worst case.

Ω(r b)

Ω denotes an asymptotic lower bound, and r b is the number of records represented by r batches of size b. A carry into a new large level can require work on this scale. The upper bound for the sequence and the lower bound for that individual case describe different questions. The sequence can be economical while a particular batch still takes much longer than the one before it.

For the timing of a specific insertion, the authors write the following expression.

Tᵇᵢₙₛ(r) = Tᵇₛₒᵣₜ + (2^ffz(r) − 1) Tᵇₘₑᵣgₑ

Tᵇᵢₙₛ(r) denotes the insertion time with r batches already resident and batch size b. Tᵇₛₒᵣₜ is the time spent sorting the incoming batch. Tᵇₘₑᵣgₑ is the paper’s reference time for merging batches of size b. The function ffz(r) returns the position of the least significant zero bit in the binary representation of r, which is the index of the first empty level encountered by the insertion. The caret ^ denotes exponentiation. The minus sign subtracts 1 from that power, and juxtaposition multiplies the resulting factor by the reference merge time. The addition combines the cost of the initial sort with the term for the merge cascade. The expression captures the growth in merge work as the first available level gets farther away.

Looking up a key

Each lookup begins at the smallest occupied level. Within its sorted array, it performs a lower-bound search, which finds the first position whose original key is at least the requested key. The result could be at the end of the array, or it could point to a higher key. Either outcome means the requested key is absent from that level. The search then proceeds to the next occupied level.

If the position has the requested key, the status bit determines the answer. A regular record supplies the current value. A tombstone means that the key is absent. Either result ends the search because older matches cannot supersede the first matching record. Thus a lookup can benefit from the placement of recent data in smaller levels. A key with no matching record anywhere requires examining every occupied level. A match on a deletion marker can also settle an unsuccessful lookup early.

The authors consider a bulk alternative in which the requests would be sorted and searched together. This would introduce a sort over the requests themselves and would require the requests to be available as a group. The chosen implementation lets each thread perform a search independently. A batch uses many threads to run these individual searches. The paper identifies the scattered memory accesses in binary search as the main bottleneck for this operation.

O(log²(r) + log(r) log(b))

O gives an asymptotic upper bound on individual memory accesses per lookup, r is the number of resident batches, and b is the batch size. log²(r) is the square of the logarithm of r. Juxtaposition in log(r) log(b) denotes multiplication, and + adds the terms. The bound comes from having up to logarithmically many levels and doing a binary search whose cost grows with the size of the particular level. In terms of the total resident size n, the paper gives the simpler worst-case description O(log² n) for a lookup.

Counting keys and retrieving an interval

An interval search starts with two binary searches per occupied level. A lower bound locates the first key greater than or equal to the lower endpoint. An upper bound locates the first key strictly greater than the upper endpoint. Everything between the resulting positions is a candidate. Using a strict comparison at the upper edge keeps records equal to that endpoint inside the interval. At this stage each level supplies a contiguous slice even though the validity of its individual records is still unknown.

In a dictionary with a single current record for each key and no deletion markers, the positions would already suffice for a count. The GPU LSM’s candidate slices can contain several occurrences of the same key, and a deletion in one slice can invalidate a value in another. Every occupied level participates because finding a record for one key says nothing about whether an older level contains some other key in the interval. The procedure must arrange all the candidates for a given interval so it can decide which occurrence wins for each key.

The first stage assigns a query to a thread and records the lengths of its candidate slices. The next stage uses an exclusive prefix sum over those lengths. A prefix sum combines the sizes of preceding slices, so the exclusive form gives each slice an offset at which it can begin writing into a shared output array. The resulting arrangement keeps the material for a query together and gives different queries separate regions. It also allows the implementation to allocate space for the preliminary results before it knows how many live records will survive.

The third stage copies candidate keys to those positions. To make writing more efficient, threads in a warp cooperate on the output for the 32 queries assigned to that warp. The fourth stage sorts each query’s portion separately, an operation called segmented sort. The sort uses the original key and preserves the time order among records for the same key. Equal keys become neighbors within the query segment, with the newest applicable record first. The term segment can refer either to a query’s whole region in the temporary array or to a consecutive run for one key inside that region. These are two different groupings.

For count queries, the last stage counts a run of equal keys only when its first record is regular. A tombstone in that position suppresses the run. The implementation uses warp-wide ballots, which collect the results of thread-level conditions across a warp, to help validate and count candidates for neighboring queries. The answer is a single count per interval. The temporary work can still be substantial when the candidate slices are long, even though the answer is small.

Range queries follow the same boundary search and offset calculation. Their copy and sort stages carry the values alongside the keys. In the last stage, the implementation marks the candidate records that should survive and compacts each query’s segment, gathering its live records together. Both marked status and compaction apply to the temporary query results. The output includes starting offsets for the queries and the corresponding valid key–value pairs in key order. Returning the records accounts for some of the additional cost of range queries, along with carrying values and compacting the results during processing.

The paper’s capability comparison summarizes the GPU LSM’s count and range work with an output-sensitive term.

O(log² n + L)

O is the asymptotic upper-bound notation used in the comparison, n is the number of elements in the structure, and L there denotes output size. log² n is the square of the logarithm of n, and + joins the search and output terms. For the sorted array, the corresponding expression uses log n for the search term because there is only one array. The implementation description makes the role of candidate records explicit. In a GPU LSM holding old versions and tombstones, the amount of data gathered and checked can exceed the live answer size. Performance therefore depends on the contents of the candidate slices as well as the eventual output.

Cleaning up and building from an initial collection

A cleanup gathers the occupied levels in order from smaller to larger, using stable merges that compare the original keys. The merged result groups all versions of each key. The same rule used for query validation identifies the winner. If the winning record is a tombstone, that whole group can be removed. If the winner is regular, it is retained and all the other records in its group are discarded. The implementation marks the records, compacts the survivors, and uses their existing sorted order to lay out the new levels.

Compaction can leave a number of survivors that is incompatible with full levels of the prescribed sizes. The implementation pads the tail with special records carrying the tombstone status and a maximum key. These records remain invisible to queries and keep the physical size in whole batch units. The authors considered retaining enough stale records to satisfy the same size constraint. They chose to remove stale records in one pass and pad the compacted result because they expected it to require less processing. The new arrays can then be assigned using the same binary occupancy rule as before.

The theoretical discussion gives a cost for rebuilding with a sort and compaction. The implemented cleanup exploits the fact that the existing arrays are already sorted, so it merges them. The analysis also describes a schedule that charges cleanup to the updates between cleanups. With cleanup triggered when the dictionary doubles in size, the extra work can be amortized without changing the asymptotic total. The interface leaves the practical timing to the caller. That choice matters because cleanup incurs an immediate cost and offers a future benefit that depends on which levels and obsolete records it removes.

A bulk build begins with the initial records available together. The authors sort them on the GPU, then divide the sorted result into the levels implied by the number of batch units. This procedure and an incremental build can produce the same kind of searchable layout through different work. Bulk build starts with the opportunity to sort all available records together. Incremental insertion starts with a structure already in use and takes advantage of the levels it can leave untouched.

Experiments and results

What was measured

The experiments ran on an NVIDIA Tesla K40c with Kepler architecture, 12 GB of DRAM, and error correction enabled. The host had an Intel Xeon E5630 CPU. The programs were compiled with NVIDIA’s compiler, version 7.5.17, with optimization enabled. The major construction, sorting, merging, and query operations took place on the GPU. The comparison structures were a GPU-maintained sorted array implemented by the authors and the cuckoo hash table from CUDPP.

The sorted array serves as a reference for both updating sorted data and searching it. In the repeated-insertion experiment, the new batch is sorted and merged into the resident array. For queries, the array represents the single-level case. The hash table contributes measurements for bulk build and point lookup, with a load factor of 80%. Its available operations determine where it fits in the comparison. The experiment does not assign it a repeated-update throughput for the full dictionary interface or use it to answer interval queries.

The main workloads are constructed collections of keys and requests. The insertion sweep uses randomly generated elements. Query collections are selected to control how many requests match or how many records are expected in an interval. The metrics are primarily throughputs. Update rates count input elements processed per second, while lookup, count, and range rates count completed queries per second. The amount of data behind each query can vary, especially when a range query returns several records. The authors also report elapsed times for the cleanup example and its subsequent query workload.

Construction and recurring insertion

Bulk build measures the work of creating a structure from a collection already available. The GPU’s key–value radix sort sustained 770 M elements/s. GPU LSM construction then divided the sorted result among its levels. The authors treated this distribution cost as small relative to the sort and later reported a bulk-build throughput of 728 M elements/s for the GPU LSM. The cuckoo table achieved 361.7 M elements/s at its stated load factor. The authors describe the construction advantage of the sort-based structures as up to 2x in this setting. The sort throughput and the full build throughput refer to different amounts of work.

To study recurring insertion, the authors generated 2²⁷ elements and inserted them a batch at a time. For each choice of batch size, the sequence exposed the different possible resident batch counts up to the chosen limit. After each insert, they recorded the rate for that batch. They retained the minimum and maximum rates, as well as a harmonic mean across the tested occupancies. The same sequence of batch sizes and growing resident sizes was applied to the sorted-array baseline.

The chart gives the paper’s aggregate comparison across batch sizes. The 225.3 M elements/s for GPU LSM and 16.7 M elements/s for the sorted array summarize repeated insertion. The authors report the advantage as 13.5x. The hash table’s build rate answers the separate question of how fast it can construct the table from a collection available at once.

Harmonic mean insertion throughput across batch sizes for randomly generated elements

GPU LSM has the higher aggregate rate for repeated batch insertion.

Harmonic mean insertion throughput across batch sizes for randomly generated elementsGPU sorted array: 16.7GPU sorted array16.7GPU LSM (this paper): 225.3GPU LSM (this paper)225.3
The numbers
System or settingM elements/s
GPU sorted array16.7
GPU LSM (this paper)225.3

The range of rates within a given batch size shows what the aggregate conceals. At a batch size of 2¹⁹, the GPU LSM had a minimum of 11.3 M elements/s, a maximum of 558.2 M elements/s, and a harmonic mean of 289.4 M elements/s. For the sorted array, the corresponding minimum, maximum, and harmonic mean were 20.5, 555.9, and 39.4 M elements/s. The GPU LSM’s minimum was lower in this setting. Its advantage came from how frequently it could complete updates without a long carry.

At a batch size of 2²⁷, the tested input fits in the initial batch. The reported insertion rate for each array-based structure is 727.8 M elements/s. As the batch size decreases, the two structures spend very different amounts of time on residence-dependent work. At 2¹⁵, the GPU LSM’s harmonic mean is 58.4 M elements/s, while the sorted array’s is 2.6 M elements/s. The smaller incoming groups expose the cost of repeatedly merging with an increasingly large single array.

The paper also plots effective insertion rate as the dictionary grows. Each point uses the number of elements inserted so far and the cumulative time spent inserting them. This answers a different question from the rate of the most recent batch. The sorted array’s effective rate falls more rapidly with increasing resident size. At a fixed batch size, each of its updates revisits the resident array, whereas the GPU LSM revisits its larger arrays only at certain occupancies. The authors use pure insertion for these tests. Because a tombstone passes through the same sorting and merging operations as a regular record, they expect the status bits themselves to leave the immediate update cost unchanged.

Hit and miss lookups

The retrieval sweep uses up to 2²⁴ resident elements. For a fixed batch size, the authors construct the different possible level occupancies in that range. At each occupancy they issue as many queries as there are resident elements and repeat the comparison for a sorted array of the same size. Lookup has a workload in which every requested key exists and another in which none exists. These cases expose different search paths through the GPU LSM. A hit can stop as soon as the newest relevant record is found. In the experiment where none of the requested keys exists, the search has to rule out every occupied level.

Across batch sizes, the GPU LSM reaches 67.9 M queries/s for the miss workload and 75.7 M queries/s for the hit workload. The sorted array reaches 119.0 and 133.3 M queries/s for those workloads, respectively. The authors describe both sorted-array advantages as nearly 1.75x over the corresponding GPU LSM results. Cuckoo hashing reaches 498.9 M queries/s for misses and 758.0 M queries/s for hits at 80% load. Those numbers measure point-query throughput for the hash table, whose layout is specialized for that operation.

Point lookup throughput for the all-existing-key workload

Cuckoo hashing leads the all-hit test, followed by the sorted array and GPU LSM.

Point lookup throughput for the all-existing-key workloadCuckoo hash table: 758.0Cuckoo hash table758.0GPU sorted array: 133.3GPU sorted array133.3GPU LSM (this paper): 75.7GPU LSM (this paper)75.7
The numbers
System or settingM queries/s
Cuckoo hash table758.0
GPU sorted array133.3
GPU LSM (this paper)75.7

The levels also explain why the relative costs can vary as the dictionary grows. In a sorted array, a larger resident collection changes the size of the search space in that array. In a GPU LSM, growth can change both the sizes of the arrays and how many arrays have to be visited. The binary occupancy pattern makes that second quantity irregular. A merge can consolidate several small arrays into a larger one, so a larger resident count need not imply that a lookup searches more arrays.

Count and range throughput

The count and range tests use the same approach to resident size and query volume. The authors vary the expected number of records in a query interval, using settings of 8 and 1024. This setting describes the expected result size, and each individual interval can have a different number of matches. The larger setting requires the GPU to deal with more candidate keys or pairs per request. Count and range still report rates in queries per second, so the extra work appears as a lower rate.

At expected size 8, the GPU LSM’s average count throughput is 32.7 M queries/s. At expected size 1024 it is 2.8 M queries/s. The authors report that the sorted array is 1.84x as fast at the smaller setting and 1.45x as fast at the larger one. The absolute GPU LSM throughput drops as the candidate work grows. The relative gap also depends on how query processing in the sorted array responds to the larger intervals.

For range retrieval, the GPU LSM achieves 23.3 M queries/s at expected size 8 and 1.3 M queries/s at expected size 1024. The authors give the sorted-array advantages as 1.39x and 1.36x for the two settings. In both settings the GPU LSM processes count queries faster than range queries. Counting yields a single result after validation. Range retrieval carries values through the intermediate stages and produces an ordered collection of validated records.

How much cleanup costs and saves

The cleanup measurements count resident elements processed per second. For a structure with batch size 2²⁰ and all levels below the level indexed by 6 occupied, cleaning up at removal fractions of 10% and 50% yielded 1870.2 and 1828.2 M elements/s, respectively. A roughly equal-sized structure with batch size 2¹⁹ and all levels below the level indexed by 7 occupied yielded 1842.5 and 1794.3 M elements/s for those removal fractions. The paper compares these rates with the bulk-build rate of 728 M elements/s and reports that cleanup can be up to 2.5x as fast as construction from scratch.

The authors separately ask whether the time spent cleaning can be recovered by subsequent queries. In an example with batch size 2¹⁸ and 10% removals, the cleanup took 19.23 ms. Afterward the structure answered 32 million lookups in 132.5 ms. The authors report that cleanup and the subsequent lookup workload together were nearly 4.8x faster than executing the same lookups on the structure before cleanup. That comparison includes the cost of doing the cleanup. It shows a case in which the smaller set of occupied levels pays back the preprocessing within the measured query run.

What the ablations show

The paper reports no component-removal ablation of the full implementation. Its controlled comparisons vary batch size, level occupancy, lookup success, interval size, and cleanup state. These comparisons show which features of a workload expose the costs predicted by the layout, and which results depend on the interaction of several mechanisms.

A carry is expensive when it happens, and infrequent across the sequence

The most direct test of the binary-counter structure is the timing of successive inserts at a fixed batch size. The paper plots individual batch times at a batch size of 2¹⁹ against the number of resident batches. The relevant feature is the position of the first empty level. When it is the smallest level, the principal operations are sorting and placement. When several levels are occupied below it, the update has to merge runs of increasing size. The insertion timing therefore follows a carry pattern driven by the current occupancy, beyond the effect of resident size alone.

The minimum, maximum, and harmonic mean rates help distinguish that pattern from a simple difference in the speed of the sorting or merging implementations. In the insertion sweep, the maximum rates can be close for the GPU LSM and the sorted array, and the GPU LSM commonly has a lower minimum. The harmonic means favor the GPU LSM over the sequence. If the main explanation were a faster merge primitive, the lowest-rate cases would be harder to reconcile with the aggregate. The occupancy analysis supplies an explanation consistent with both. The GPU LSM does less merging much of the time and can do a succession of merges at an unfavorable transition.

Changing the batch size shows where available parallelism and storage layout enter the same comparison. With fewer records in each batch, the smaller operations have less parallel work available. For a given resident population, smaller batches also allow more levels. The reported averages change with both factors, so this sweep does not identify how much of a change comes from device utilization and how much comes from the distribution of levels. It does show that a result for a single, favorable batch size would give an incomplete account of repeated updates.

Early termination helps point queries

The all-hit and all-miss lookups separate workloads in which finding a stored key can finish the search from one that requires ruling out the key at every level. GPU LSM has a higher aggregate rate for the all-hit workload. This is consistent with the search order. The earliest eligible match can be returned immediately, while an absent key in the miss experiment causes each occupied level to be probed. The sorted array and hash table also show higher throughput in their all-hit tests, so the difference between the two GPU LSM rates cannot be assigned exclusively to its level scan.

The occupancy comparisons provide a further check. Smaller update batches generally produce more occupied levels on average over the tested resident sizes. The GPU LSM’s mean lookup rate usually falls as the configured batch gets smaller. The authors’ explanation identifies the amount of search across levels as a substantial factor. The experiments do not separately measure the cost of the binary-search traffic, cache behavior, and early termination at each level. They establish the workload pattern the combination produces.

The sorted array offers a way to see the scale of that combined cost. Its retrieval path searches a single sorted collection. Its advantages show how much the benchmark pays, in aggregate, for the GPU LSM’s different layout and query procedure. They cannot establish what a version with fractional cascading would achieve. The paper gives the asymptotic search benefit of the COLA’s links as context and leaves their implementation and measurement in a GPU LSM open.

Wider intervals shift the work after the boundary searches

The count and range comparison changes the expected size of an interval answer while keeping the underlying workload design. The boundary searches still occur at every occupied level in either setting. Larger intervals supply more records to gather and validate. The drop in queries per second at the larger setting shows that retrieval cost depends heavily on this candidate processing. A throughput measure for narrow windows gives little guidance about a workload in which each window covers many records.

Count and range also make a useful pair because they share their initial searches and offset calculation. The range path sorts and moves values, marks surviving pairs, and emits the compacted records. The count path checks which keys survive and produces a scalar for each query. The measured rate difference captures these combined changes in work. The paper does not provide stage timings that would separate the contribution of moving values from that of validation and output compaction.

The before-and-after lookup example uses the same query workload. The result shows that reorganizing and thinning the resident records can improve throughput enough to justify the cost of the cleanup itself in a query-heavy period. The cleanup changes several properties together. It removes records and can reduce the number of occupied levels. The example supports the practical value of the whole operation. It does not identify an independent effect for each change.

The cleanup throughput comparison also qualifies the authors’ observation that cost depends mainly on the resident size and less on how many records are removed. At the similar-sized occupancies reported in the paper, changing the removal fraction leaves the cleanup rates in the same general range. In both reported pairs the measured rate is higher at 10% removals than at 50%. The paired measurements therefore illustrate relatively modest sensitivity in those settings. They do not establish that increasing the fraction removed consistently speeds up cleanup itself. A large removal can still leave a better layout for later queries, which is a separate outcome.

Limitations

Boundaries the authors state

The interface is designed for fixed-size batches of updates and separate phases of updates and queries. These are central assumptions behind the simple representation of time and the implementation’s ability to run searches over stable arrays. The paper allows independent point lookups during a query phase. It does not offer a protocol for an update and a query to operate concurrently on the same changing levels. Applications with many undersized updates can pad each batch, but padding lowers the rate of processing useful input because the repeated records still take space and work.

The policy for conflicting records is also part of the interface. Same-batch inserts for a shared key can leave any one of their values current, while a same-batch deletion takes precedence over inserts for that key. An application needing a definite order among all operations inside a batch would require different semantics. The status-bit encoding leaves 31 bits for the original key in the 32-bit representation. A wider key domain would need some change to the representation used in the experiments.

The authors identify stale records as a cost of their approach. Deferred removal can increase the physical population of the dictionary and can keep levels occupied that might otherwise disappear. Count and range queries expend work validating the extra candidates. The paper supplies cleanup as an explicit response and describes how its cost can be amortized under a particular schedule. It leaves a practical choice about timing because the benefit depends on both the contents left in the structure and the queries still to come.

The authors also recognize a search cost in leaving out the COLA’s cross-level links. They give the corresponding difference in asymptotic lookup work and point out that implementing fractional cascading would add memory and complicate updates. Their measurements compare the implemented GPU LSM with its reference structures. Whether a linked version would be worthwhile remains an open question in the paper.

What the design of the evaluation leaves open

The headline insertion result summarizes throughput across batch sizes and occupancies. It is a measure of a stream of updates in which cheap batches can offset expensive ones. A system with a tight deadline for every batch would also depend on the long-carry cases reflected in the minimum rates. The paper supplies examples of how far the individual rates can differ, but it does not establish a latency guarantee for an application that needs steady response times.

The update benchmark uses insertions. The authors’ reason for treating deletions similarly is that a tombstone is processed by the same immediate update path. That reasoning covers the sorting and merging required to admit the batch. It does not establish equal lifetime cost for workloads with different proportions of inserts, deletes, and repeated keys. Those workloads can leave different amounts of obsolete data, create different interval candidate sets, and require cleanup at different times. The query and cleanup tests characterize parts of that behavior rather than the end-to-end throughput of a long-running mixed workload.

The query sweeps deliberately control simple dimensions such as whether keys are present and the expected interval result size. They provide no measurements for an application in which requests repeatedly target a small group of popular keys, request intervals vary sharply in size, or updates and queries alternate in application-specific bursts. The GPU LSM’s search cost depends on where its matching records reside. The cost of interval validation depends on the candidate slices. That makes the connection between these benchmarks and any particular application dependent on the application’s data and access patterns.

The memory-access results also come from one GPU configuration and the primitive implementations used there. The paper’s work bounds and correctness rules describe the data structure beyond that setup. The measured rates depend on how that hardware handles sorts, merges, searches, and global-memory traffic. The experiments establish neither the same absolute rates on another device nor the same margins between the GPU LSM and its baselines.

Finally, the baselines answer specific questions about the cost of supporting mutability. The sorted array provides a simple ordered structure with efficient queries and an available route for incremental insertion. The hash table provides a fast point-query reference and a bulk-build measurement. The authors discuss GPU tree searches and explain why they lacked a suitable publicly available B-tree implementation built on the GPU for their comparison. The benchmark therefore quantifies the trade against the selected array and hash implementations. It leaves open how GPU LSM would compare with another GPU-resident dictionary supporting the same full set of updates and queries.

What came after

The subsequent use of GPU LSM in citing studies is undocumented here. The paper itself closes with two directions for further work. One is to use fractional cascading to carry search information between levels, then determine whether the gain in retrieval justifies the added storage and update work. The other is to investigate whether similar batching and merging principles can help a different GPU structure, such as a bounding volume hierarchy for dynamic scenes. Both are proposals from the authors. Their experiments establish the tradeoff for an ordered dictionary with batched updates, while leaving those extensions untested.

Cite

Cite as Saman Ashkiani, Shengren Li, Martin Farach-Colton, Nina Amenta and John D. Owens. 2017. GPU LSM: A Dynamic Dictionary Data Structure for the GPU. IPDPS 2018.

The paper itself, not this page. BibTeX from the library's record of the work. arXiv 1707.05354

@inproceedings{ashkiani2017gpu,
  title = {{GPU LSM: A Dynamic Dictionary Data Structure for the GPU}},
  author = {Saman Ashkiani, Shengren Li, Martin Farach-Colton, Nina Amenta and John D. Owens},
  booktitle = {IPDPS 2018},
  year = {2017},
  eprint = {1707.05354},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1707.05354}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/ashkiani-2017-gpu-lsm-dynamic-dictionary-data/