Efficient and scalable construction and probing of hash tables using multiple GPUs
By building and probing hash tables in parallel on multiple GPUs, and coordinating GPUs to achieve parallel writing results, the problems of memory capacity and access speed of a single GPU in large relational unions are solved, and the efficiency of join operations is improved.
Patent Information
- Application Number
- CN201980083821.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-10-23
- Filing Date
- 2019-10-17
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2039-10-17
AI Technical Summary
When the existing technology uses a single GPU to perform joint operations of large relationships, the performance bottleneck lies in the memory capacity and random memory access speed, resulting in low efficiency of the connection operation.
Multiple GPUs are used for hash table construction and detection, random memory access is parallelized through global location identifiers, and GPUs are coordinated during the detection phase to achieve parallel writing of results, increasing memory capacity and utilizing multi-GPU processing capabilities to reduce connection times.
It effectively expands the memory capacity and processing power of the system, significantly reduces the running time of connection operations, and improves the efficiency of large-relation unions.
Smart Images

Figure CN113227997B_ABST
Abstract
Description
Background Art
[0001] Data can be stored in a relational database through multiple tables. The tables reference each other according to a database schema (such as a star schema). Queries, such as SQL queries, can be submitted for processing against the tables in order to return the requested data. The processing can involve any number of operations, which can implement relational algebra, examples of which include joins, group by, order by, etc. In many systems, the performance bottleneck when processing queries is the union of execution relations. One such example is in online analytical processing (OLAP), which allows users to interactively analyze multidimensional data from multiple perspectives. It has been found that in systems using graphics processing units (GPUs), the union of large relations can be significantly accelerated.
[0002] In a hash-based join algorithm, a GPU may use a build table (which may also be referred to as a "dimension table") to create a hash table in a build phase, and then probe the hash table with entries from a probe table (which may also be referred to as a "fact table" and is typically larger than the build table) in a probe phase. The build phase may involve reading rows from the build table, hashing the rows on its join key to compute a hash value, and inserting its payload (and optionally its key or a pointer to the key) into the hash table at a location corresponding to the hash value. During the probe phase, the GPU may read rows from the probe table, hash the rows on its join key to compute a hash value, and use the hash value of the rows to probe for matching rows in the hash table. However, while using a GPU may speed up this process, a single GPU may not always be sufficient to connect the input tables quickly enough or at all due to the speed or memory capacity of a single GPU. For example, a single GPU may not have enough memory to store the hash table for the join, or may perform the join more slowly than desired due to the number of random memory accesses used to build and / or probe the hash table. Summary of the invention
[0003] Embodiments of the present disclosure provide efficient and scalable construction and detection of hash tables using multiple GPUs. Specifically, the present disclosure provides a method for efficiently and scalably using multiple GPUs to construct hash tables, detect hash tables, and materialize the results of detecting hash tables, which can be used to implement multi-GPU connections.
[0004] While conventional methods provide for implementing table joins using a single GPU, the present disclosure describes solutions for implementing table joins using multiple GPUs. Different methods for building hash tables, probing hash tables, and materializing the results of probes are described, some of which can be combined with or used with other methods. The disclosed methods can utilize the memory of multiple GPUs in processing join operations to increase the effective memory capacity available to the system. The disclosed methods can also utilize the processing power of multiple GPUs executed in parallel when processing join operations to reduce the runtime of the join relative to conventional methods.
[0005] In various examples, random memory accesses required to build and / or probe a hash table may be performed in parallel on multiple GPUs using a global location identifier (ID). The global location ID may be calculated from the data of an entry (from one or more keys of the entry) and identifies a global location associated with the entry (e.g., in a hash table). When building a hash table, each GPU may be assigned one or more portions (e.g., partitions) of the hash table, and the GPU may calculate the global location ID from the entries in the build table to determine, for an entry, whether to perform an insertion using the entry and / or where to perform the insertion. When probing a hash table, the GPU may calculate the global location ID from the entries in the probe table to determine, for an entry, whether to perform a probe using the entry and / or where to perform the probe.
[0006] The present disclosure further describes methods for coordinating GPUs when materializing results in the probe phase of a hash join operation, which may allow for parallel writes to a global output buffer. In some methods, a global offset to a global output buffer is maintained in a memory accessible to each GPU in the GPU to indicate where each GPU should write a portion of the result. When a GPU is used to write a portion of the result (e.g., directly, without a local cache), the global offset may be incremented to account for the size of the portion of the result in the global offset buffer. In other methods, the GPU may write a portion of the result to a local or initial output buffer. In order to materialize a portion of the result to the global output buffer, the GPU may calculate an exclusive sum of the local or initial output buffer size. The exclusive sum may provide a global offset to each local or initial output buffer to indicate where in the global output buffer the portion of the result from the local or initial output buffer should be written. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] 1. The present system and method for efficiently and scalably constructing and probing hash tables using multiple GPUs is described in detail below with reference to the accompanying drawings, wherein:
[0008] 2. Figure 1is an example system diagram of a multi-GPU distributed processing system according to some embodiments of the present disclosure;
[0009] 3. Figure 2 is a diagram illustrating an example of distributed construction of a hash table using multiple GPUs according to some embodiments of the present disclosure;
[0010] 4. Figure 3 is a diagram illustrating an example of copying a hash table to multiple GPUs according to some embodiments of the present disclosure;
[0011] 5. Figure 4 is a diagram illustrating an example of distributed probing of a hash table using multiple GPUs and fixed hash table partitions according to some embodiments of the present disclosure;
[0012] 6. Figure 5 is a diagram illustrating an example of distributed probing of a hash table using multiple GPUs and a fixed probe table portion according to some embodiments of the present disclosure;
[0013] 7. Figure 6 is a diagram showing an example of materializing the results of a distributed probing of a hash table using multiple GPUs and a global offset variable according to some embodiments of the present disclosure;
[0014] 8. Figure 7 is a diagram showing an example of materializing the results of a distributed probing of a hash table using multiple GPUs and the size of a local output buffer according to some embodiments of the present disclosure;
[0015] 9. Figure 8 is a flow chart illustrating a method for distributed construction of a hash table using multiple GPUs according to some embodiments of the present disclosure, wherein a construction table entry is associated with a local hash table partition;
[0016] 10. Fig. 9 is a flow chart illustrating a method for using a plurality of distributed build hash tables according to some embodiments of the present disclosure, wherein build table entries are associated with remote hash table partitions;
[0017] 11. Fig.10 is a flow chart illustrating a method for distributed probing of a hash table using multiple GPUs according to some embodiments of the present disclosure, wherein a probe table entry is associated with a local hash table partition;
[0018] 12. Fig.11 is a flow chart illustrating a method for distributed probing of a hash table using multiple GPUs according to some embodiments of the present disclosure, wherein a probe table entry is associated with a remote hash table partition;
[0019] 13. Fig.12 is a flow chart illustrating a method for materializing the results of a distributed probing of a hash table using multiple GPUs and a global offset variable according to some embodiments of the present disclosure;
[0020] 14. Fig.13 is a flow chart illustrating a method for materializing the results of a distributed probing of a hash table using multiple GPUs and the size of a local offset buffer according to some embodiments of the present disclosure; and
[0021] 15. Fig.14 is a block diagram of an example computing device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0022] The present disclosure provides efficient and scalable construction and probing of hash tables using multiple GPUs. In various aspects, the present disclosure provides methods for efficiently and scalably constructing hash tables, probing hash tables, and materializing the results of probing hash tables using multiple GPUs, which can be used to implement multi-GPU connections or other operations involving construction and / or probing of hash tables.
[0023] In various examples, random memory accesses required to build and / or probe a hash table may be performed in parallel on multiple GPUs using a global location identifier (ID). The global location ID may be calculated from the data of an entry (from one or more keys of the entry) and identifies a global location associated with the entry (e.g., in a hash table and / or at a specific GPU). For example, a hash value may be calculated from the key of each entry and used to derive the global location ID of the entry. Examples of global location IDs include a global hash value index of a hash table, a global bucket ID of a hash table, a GPU ID, and / or a hash table partition ID. When building a hash table, one or more portions (e.g., partitions) of the hash table may be assigned to each GPU, and the GPU may calculate a global location ID from an entry in a build table to determine, for an entry, whether to perform an insertion using the entry and / or where to perform the insertion.
[0024] In some methods - in order to build a hash table in a distributed manner using multiple GPUs - each GPU can be assigned or allocated a partition of the hash table, and the build table for operation can be distributed across GPUs (e.g., each GPU has one or more build table partitions). Each hash table partition can cover a different range of addresses (contiguous values) in the hash table (a set of one or more buckets of values using open addressing). Each GPU can read data from the entries in the GPU's build table portion and determine the global location ID of the entry from the data of each entry. If the GPU uses the global location ID to determine that the corresponding position for insertion is within the GPU's hash table partition, the GPU can insert the payload (and key or entry index) therein. Otherwise, the payload may not be inserted into the GPU's hash table partition, but may be inserted at the GPU associated with the position for insertion. Thus, the number of random memory accesses to the GPU memory used to insert entries into the hash table can be distributed and parallelized across GPUs.
[0025] After the GPU processes at least some (e.g., a complete partition) of the GPU's build table portion, the GPU may pass build table data representing at least one uninserted entry of the processed portion of the build table to another GPU. The processing and transfer of the build table data may continue until the hash table is fully built. Double buffering may be used to overlap the processing and transfer of build table data. For each entry, the processed build table data exchanged between the GPUs may include data sufficient to perform the insertion of the entry, such as a payload and a corresponding key and / or hash value. In an example where the GPU initially includes multiple build table portions, when the GPU receives build table data from another GPU, it may process the received build table data together with the initial build table portion.
[0026] In some examples, processed build table data is passed using a switching or routing algorithm such as a ring switch. In a ring switch, the GPUs may be logically arranged in a ring so that each GPU has a left neighbor and a right neighbor. When passing build table data to another GPU, each GPU may pass the build table data to the neighbor in the same direction, regardless of whether the neighbor corresponds to a location for inserting an entry captured by the build table data. This approach may be used in situations where many-to-many GPU communication is unavailable or undesirable.
[0027] In other examples (e.g., as an alternative to ring switching), a GPU may provide build table data for an entry directly to a particular GPU based on determining (using a global location ID) that another GPU corresponds to a location for inserting the entry into the hash table. In some examples, the other GPU may use the received build table data to perform the insertion locally. In other examples, the GPU may use the build table data to remotely insert the entry into the hash table partition of the other GPU, such as by using a system-wide atomic operation to the peer GPU.
[0028] The present disclosure also provides, in part, a method for distributed probing of hash tables. In a replicated hash table approach, each GPU has a local copy of a hash table that can be used to parallelize the operation of the probing phase. The replicated hash table approach can use a build phase to form partitions of the hash table that are distributed across the GPUs, which are then merged to form local copies. In a partitioned hash table approach, each GPU has a corresponding partition of the hash table to parallelize the operation of the probing phase, so merging of hash table partitions may not be required.
[0029] As the size of the probe table becomes larger than the build table, the replicated hash table approach may be more desirable for use in join operations. For example, although the build phase of the replicated hash table approach may take longer than the partitioned hash table approach due to merging hash table partitions across GPUs to create local copies, the probe phase may be faster because each GPU can locally probe any portion of the hash table, thereby reducing inter-GPU traffic. The partitioned hash table approach can be used to reduce memory requirements for storing hash tables because each GPU does not need to store a local copy of the complete hash table. A hybrid approach may also be used according to the present disclosure, in which one or more GPUs include a complete copy and one or more other GPUs include one or more hash table partitions.
[0030] For distributed probing using a partitioned hash table approach, each GPU may be provided with a portion of a probe table, and the GPU may use entries from the local portion of the probe table to probe the hash table partition. When probing the hash table, the GPU may calculate a global location ID from the entry in the probe table to determine for the entry whether to perform probing using the entry and / or where to perform probing (e.g., similar to a build phase). Thus, the number of random memory accesses to GPU memory for probing the hash table using the entry may be distributed and parallelized across the GPUs.
[0031] After a GPU processes at least some of a portion of a probe table for a GPU (e.g., a complete partition), it may pass probe table data representing at least one unprobed entry of the processed portion of the probe table to another GPU. Processing and passing of probe table data may continue until the hash table has been probed for all probe table entries, which may be when the probe table partition has visited all GPUs and / or there are no remaining entries to probe. Double buffering may be used to overlap processing and passing of probe table data. For each entry, the processed probe table data exchanged between the GPUs may include data sufficient to perform a probe hash table for that entry, such as one or more corresponding keys, payloads, and / or hash values.
[0032] In some examples, processed probe table data is delivered using a switch or routing algorithm such as a ring switch. In other examples (e.g., as an alternative to a ring switch), the GPU may provide the probe table data for an entry directly to a particular GPU based on determining (using a global location ID) that another GPU corresponds to a location for probing a hash table for the entry. In some examples, the other GPU may perform the probe locally using the received probe table data. In other examples, the GPU may use the probe table data to remotely probe a hash table partition of another GPU.
[0033] In other examples, in addition to or in lieu of a GPU providing probe table data to another GPU, a GPU may provide hash table data corresponding to a hash table partition or portion. For example, the GPUs may exchange hash table data for probing, and each GPU may use the same local probe table portion for probing until the probe table is fully processed (e.g., each hash table data for a hash table partition has been visited by each GPU and / or a result has been generated for each probe table entry).
[0034] In a further aspect, the probe table can be rearranged to form a probe table portion provided to a GPU based on a hash table index of the entries. For example, the probe table can be arranged so that each GPU receives entries from the probe table corresponding to locations for probing using those entries. For example, the probe table portions can be configured so that the entries of each probe table portion include keys that hash to a range of a hash table partition on the corresponding GPU. In some examples, entries can be assigned to the probe table portions using corresponding global location IDs.
[0035] The present disclosure further describes a method for coordinating GPUs when materializing the results of a probe hash table, which can allow for parallel writes to a global output buffer. In some methods, a global offset to a global output buffer is maintained in a memory accessible to each GPU in the GPU to indicate where each GPU should write a portion of the result. When a GPU is to write a portion of the result (e.g., directly, without a local cache), the global offset may be incremented to take into account the size of the portion of the result in the global offset buffer (possibly using atomic memory operations). In other methods, the GPU may write a portion of the result to a local or initial output buffer. In order to materialize a portion of the result to the global output buffer, the GPU may calculate an exclusive sum of the local or initial output buffer size. The exclusive sum may provide a global offset to the global output buffer for each local or initial output buffer to indicate where in the global output buffer the portion of the result from the local or initial output buffer should be written.
[0036] See also Figure 1 , Figure 1 is an example system diagram of a multi-GPU distributed processing system 100 according to some embodiments of the present disclosure. It should be understood that this and other arrangements are set forth herein only as examples. Other arrangements and elements (e.g., machines, interfaces, functions, sequences, functional groupings, etc.) may be used in addition to or in place of those shown, and some elements may be omitted altogether. Further, many of the elements described herein are functional entities that may be implemented as discrete or distributed components or in combination with other components and in any suitable combination and location. The different functions described herein as being performed by entities may be performed by hardware, firmware, and / or software. For example, different functions may be performed by a processor executing instructions stored in a memory. As an example, the multi-GPU distributed processing system 100 may be implemented in a Fig.14 The system is implemented on one or more instances of computing device 1400.
[0037] Multi-GPU distributed processing system 100 (also referred to as “system 100”) may include multiple GPUs (e.g., two or more), such as GPU 102A and GPU 102B, to GPU 102N (also referred to as “GPUs 102A-102N”), one or more CPUs, such as CPU 104, and one or more data stores, such as one or more data stores 106.
[0038] Although shown in GPU 102A, each of GPUs 102A-102N may include separate instances of, for example, interface manager 110, hash table builder 112, hash table detector 114, result manager 116, location determiner 118, data filter 120, and GPU memory 122.
[0039] The system 100 may be configured to perform any number of operations on data from tables stored in the database 106, such as operations 138 involving building tables 140, probing tables 142, and hash tables 144, to produce one or more results 146. In some embodiments, operations 138 may be performed by the query engine 130 as part of executing a query. The query engine 130 includes a query interface 132 and an operation processor 134. The functionality of the query interface 132 and / or the operation processor 134 may be implemented using one or more computing devices, such as GPUs 102A-102N, one or more CPUs 104, and / or other devices.
[0040] As an overview, query interface 132 may be configured to receive queries from a user and / or software, and operation processor 134 may be configured to execute the queries. Processing the query may involve performing any number of operations that may implement relational algebra, examples of which include joins, groupings, sortings, etc. Operation 138 is one such example of an operation, which may be a join operation. GPUs 102A to 102N may be used for multi-GPU distributed processing of one or more portions of operation 138. For example, distributed processing by GPUs 102A-102N may be used to build hash table 144 from build table 140, probe hash table 144 using probe table 142, materialize results 146 of operation 138, and / or provide other distributed processing and storage capabilities.
[0041] An overview of the components of GPU 102A is provided, which may be similar for each of GPUs 102A-102N. Interface manager 110 is configured to manage the receipt of data by GPU 102A and the sending of data from GPU 102A. Hash table builder 112 is configured to implement functionality for building a hash table (such as hash table 144) using build table 140, which may involve using build table entries to insert into the hash table. Hash table probe 114 is configured to implement functionality for probing a hash table (e.g., hash table 144) using probe table 142, which may involve probing the hash table using probe table entries. Result manager 116 is configured to implement functionality for materializing the results of an operation (such as result 146 of operation 138). Location determiner 118 is configured to determine a location (e.g., using a global location ID) to facilitate functionality of one or more of hash table builder 112, hash table probe 114, result manager 116, and / or other components of GPU 102A. The location may correspond to a partition and / or bucket of hash table 144 for inserting an entry therein or probing an entry therein, and / or a GPU that includes the partition and / or bucket of hash table 144 .
[0042] Data store 106 may include a computer-readable medium and may be configured to store data (e.g., data of a relational table) against which query engine 130 may perform queries. Although depicted as a single component, database 106 may be embodied as one or more data stores and may be distributed for storage in a cloud and / or across one or more data stores in any suitable manner. As various examples, one or more data stores may be hosted external to other components of system 100 and / or at least partially hosted within one or more other components of system 100, such as GPUs 102A-102N, CPU 104, and / or a host computing system or device thereof.
[0043] In various examples, at least some of the data in the database 106 may be stored in multiple tables. The tables reference each other according to a database schema, such as a star schema. For example, the data may be stored in one or more relational databases in the data store 106. To determine and retrieve information from the database 106, the system 100 may process the data using any number of operations, such as operation 138, which may implement relational algebra, examples of which include joins, groupings, sortings, and the like.
[0044] In some embodiments, the query engine 130 is used to implement operations according to methods such as online analytical processing (OLAP), which allows users or software to interactively analyze multidimensional data from multiple perspectives by submitting queries to the query interface 132. However, the query engine 130 can be used to implement any suitable data processing technology that involves performing operations (such as join operations) on data. For example, a query - such as a SQL query - can be submitted to the query interface 132 of the query engine 130 for processing the data to return the requested data.
[0045] Operation 138 may be an operation defined by a query, such as a connection corresponding to a relationship. In this regard, result 146 may refer to an output set of an operation (e.g., a connection operation), which may be an output set of a query or an intermediate set of output sets for generating a query. However, operation 138 and / or one or more parts thereof (such as building a hash table 144, probing a hash table 144, or materializing the result of probing a hash table 144) may be practiced outside the context of query execution (e.g., using an operation processor 134). In other words, aspects of the present disclosure need not be limited to specific operations and / or systems. In addition, these different parts of operation 138 may be performed at any suitable time and by different systems (e.g., system 100 need not perform all of these parts of operation 138). Also in some examples, hash table 144 may be established and hash table 144 may be probed in multiple different operations, such as using a different probe table for each operation.
[0046] Build table 140 may refer to a relationship from which hash table 144 is created. This may be, for example, one or more columns of a given table of data from data storage 106. Build table 140 may also be referred to as a dimension table. Probe table 142 may refer to a relationship probed for hash table 144 created from build table 140. This may be, for example, one or more columns from a given table. Probe table 142 may also be referred to as a fact table and is typically larger than build table 140. Hash table 144 may correspond to a data structure created from the build table and may be used for fast random access by GPUs 102A-102N to accelerate operation 138. Hash table 144 may correspond to a hash function used to calculate a hash index into a bucket or slot array of corresponding values. A hash index may also be referred to as a hash value. Due to imperfections in hash functions, conflicts may occur when a hash function generates the same hash index for more than one entry. In various embodiments, hash table 144 may be implemented using an addressing mode such as open addressing. In any example, open addressing with linear probing may be used to resolve conflicts. Open addressing can provide a method for handling collisions. In open addressing, all elements can be stored in the hash table itself. Hash collisions can be resolved by probing or searching alternative locations in the array (probing sequence) until the target entry is found or an unused array entry slot is found, which can indicate that the key does not exist in the hash table. In linear probing, the interval between probes can be fixed.
[0047] One or more portions of the build table 140, the probe table 142, and / or the hash table 144 may be stored in and / or distributed across the CPU memory 124 of the CPU 104, the GPU memory 122 of the GPUs 102A-102N, and / or other storage locations. The distribution and location of the data may vary for different embodiments. The CPU memory 124 of the CPU 104, the GPU memory 122 of the GPUs 102A-102N, and / or other storage devices may include random access memory (RAM). For example, the CPU memory 124 may refer to RAM attached to the CPU 104, which may also be referred to as system memory. Further, the GPU memory 122 may refer to RAM attached to the GPU, which may also be referred to as device memory. In different examples, each of the one or more CPUs 104 may correspond to a CPU 104. Fig.14 1406, and one or more of the GPUs 102A-102N may correspond to the GPU 1408.
[0048] When performing operation 138 using a hash-based join algorithm, the system 100 may use the build table 140 to create a hash table 144 in a build phase, and then probe the hash table 144 with entries (e.g., rows) from the probe table 142 in a probe phase. The build phase may involve the system 100 reading an entry 150 (e.g., a row) from the build table 140, hashing the entry on its key 152 (e.g., a join key) to calculate a hash value, and inserting its payload 154 into an entry 156 of the hash table 144 at a location (e.g., a row) with a hash index corresponding to the hash value. In addition to the payload 154, the key 152 or a pointer for locating the key 152 may also be inserted into the entry 156 of the hash table 144. During the probe phase, the system 100 may read an entry 160 from the probe table 142, hash the entry 160 on its key 152 (e.g., a join key) to calculate a hash value, and use the hash value of the entry 160 to probe a matching entry 156 in the hash table 144, which is used to provide an entry 162 of the result 146. The entry 162 may include an entry ID 164 of the entry 150 of the build table 140 and a matching entry ID 166 of the entry 160 of the probe table 142. Since different keys may hash to the same hash value, the match may check that one or more keys identified by the entry 156 in the hash table 144 match the key of the probe table entry. The system 100 may use the GPUs 102A-102N to process one or more portions of the operation 138, which may increase the speed and / or memory capacity available to the system 100 compared to using one GPU.
[0049] Distributed construction of hash tables
[0050] The present disclosure provides, in part, a method for constructing a hash table 144 in a distributed manner using GPUs 102A-102N. Figure 2 , Figure 2 1 is a diagram illustrating an example of distributed construction of hash table 144 using GPUs 102A-102N according to some embodiments of the present disclosure. However, the present disclosure contemplates many potential variations for constructing hash table 144 in a distributed manner. Further, many of these variations may be used to construct partitioned hash tables for distributed probing or replicated hash tables for distributed probing. For example, to form replicated hash tables, partitioned hash tables may be merged across GPUs 102A-102N. Figure 3 An example used to describe merging hash table partitions.
[0051] Operation processor 134 may assign or allocate respective portions (e.g., one or more partitions) of hash table 144 and build table 140 for operation 138 to each of GPUs 102A-102N. For example, hash table partition 244A and build table portion 240A may be assigned to GPU 102A, hash table partition 244B and build table portion 240B may be assigned to GPU 102B, and hash table partition 244N and build table portion 240N may be assigned to GPU 102N.
[0052] A partition herein may refer to a contiguous allocation representing a portion of a larger data structure. Each hash table partition 244A-244N may cover a different set of one or more buckets of values (e.g., contiguous values) in the hash table (e.g., using open addressing). Further partition sizes of the data structure may be substantially equivalent (e.g., equal when divisible by the number of GPUs and / or partitions). In addition, in various embodiments, each allocation may not overlap. For example, the hash table 144 may be partitioned into N partitions of substantially equal size, wherein each GPU 102A-102N is assigned its own partition, and N may also represent the number of GPUs. Assuming the local partition size is A, the hash table partition 244A may have a global hash table index ranging from 0 to A-1, assuming the local partition size is B, the hash table partition 244B may have a global hash table index ranging from A to B-1, and so on. The partitions of the build table 140 and the probe table 142 may be arranged similarly.
[0053] The allocated portions of hash table 144 and / or build table 140 may be distributed across GPUs 102A-102N and / or may be in memory accessible to a corresponding GPU in GPUs 102A-102N. For example, a portion of hash table 144 is allocated to a particular GPU in GPU memory 122 of that GPU. Examples include hash table partition 244A of GPU 102A allocated in GPU memory 122 of GPU 102A. Portions of build table 140 may be similarly arranged or may be in CPU memory 124 of one or more CPUs 104, such as a CPU 104 of a host system including a corresponding GPU storing the assigned portion of the build table. In any example, the portion of build table 140 may be stored in GPU memory 122 or may be in CPU memory 124 accessible by all GPUs 102A-102N or a subset thereof.
[0054] In general, the storage locations of portions of hash table 144 and build table 140 may vary based on the components, capabilities, and configuration of system 100. For example, in some embodiments, more than one of GPUs 102A-102N may be able to directly read from and write to the same CPU memory 124 and / or the same GPU memory 122, in which case portions of hash table 144 and / or build table 140 for each GPU may be in the same memory. However, even if direct reads and writes are not supported, GPUs may still share memory locations, in which case large memory copies may be used, albeit potentially less efficiently.
[0055] In some examples, GPUs 102A-102N may build hash table 144 in multiple iterations. For example, Figure 2 Iterations 200A and 200B are shown for building hash table 144 in a distributed manner using GPUs 102A-102N. In iteration 200A, hash table builder 112 of each of GPUs 102A-102N may read data (in parallel) from entries of a build table portion (e.g., partition) of the GPU and use locality determiner 118 of the GPU to make a determination 210 from the data as to which GPU is assigned for the hash table partition for each entry and / or whether the GPU includes the hash table partition for the entry.
[0056] For example, the hash table builder 112 of the GPU 102A may read the entries from the build table portion 240A, and the location determiner 118 of the GPU 102A may make a determination 210 for each entry as to which GPU includes the hash table partition for inserting the entry and / or whether the GPU 102A includes the hash table partition. This may include the location determiner 118 hashing the key of the entry to calculate a hash value, and using the hash value to derive a global location ID for the entry. As described herein, examples of a global location ID include a global hash value index of the hash table 144, a global bucket ID of the hash table 144, a partition ID of a hash table partition, and / or a GPU ID identifying a corresponding location for insertion into the hash table 144. If the location determiner 118 of the GPU determines using the global location ID that the insertion is for the hash table partition of the GPU, then the GPU may insert the corresponding entry therein. Otherwise, the entry may not be inserted into the hash table partition of the GPU, but may be inserted at the GPU associated with the insertion.
[0057] As a non-limiting example, the location determiner 118 may calculate the partition size P_Size of a single partition using equation (1):
[0058] P_Size=Hashtbl_Size / K (1)
[0059] Where Hashtbl_Size is the size of the hash table 144 (eg, the number of buckets), and K is the number of GPUs 102A-102N. The location determiner 118 may also calculate the hash table index Hash_Idx using equation (2):
[0060] Hash_Idx=Key_Hash%Hashtbl_Size (2)
[0061] Where Key_Hash is the hash of the key that builds the entry of table 140 .
[0062] The location determiner 118 may also calculate the GPU ID of the specified GPU as D_GPU using equation (3):
[0063] D_GPU=Hash_Idx / P_Size (3)
[0064] Each GPU may be assigned a GPU ID ranging from 0 to K-1, and if the location determiner 118 determines that D_GPU is equal to the GPU ID of the GPU and the GPU ID of the GPU is less than K-1, the hash table builder 112 may perform the insertion at the GPU. Further, if the location determiner 118 determines that D_GPU is greater than or equal to the GPU ID of the GPU and the GPU ID of the GPU is equal to K-1, the hash table builder 112 may perform the insertion at the GPU. Otherwise, the insertion may not be performed at the GPU so that it may be performed at the specified GPU. It should be noted that the equations and decisions may vary based on the configuration of the partition and hash table 144. In this example, the global location ID may refer to or correspond to Hash_Idx. This example assumes that P_Size is constant for a partition. However, in other examples, P_Size may be different for different partitions.
[0065] As an example using equations (1), (2), and (3), assume K=16 and Hashtbl_Size=1024, so that P_Size=64 using equation (1). Next, assume Key_Hash=793434, so that Hash_Idx=858 using equation (2). Thus, using equation (3), D_GPU=13. If the current GPU has a GPU ID of 10, the hash table builder 112 of the GPU may not perform insertion at the GPU.
[0066] By using global location identifiers to determine whether to insert an entry into a local hash table partition of a GPU, insertions to build hash table 144 may be efficiently distributed across GPUs 102A-102N and parallelized, thereby reducing the impact of corresponding random memory accesses on the overall construction time of hash table 144.
[0067] In a further aspect, based on the hash table builder 112 of a GPU processing at least a portion of the build table portion of the GPU (e.g., a complete local partition), the hash table builder 112 may use the interface manager 110 to provide a corresponding portion of the build table data to another GPU for further processing. The build table data may correspond to Figure 2 10A-104B may be provided to GPU 102B, the interface manager 110 of GPU 110B may provide the build table portion 242A (corresponding to the build table portion 240A) to GPU 102N, and the interface manager 110 of GPU 110N may provide the build table portion 242N (corresponding to the build table portion 240N) to GPU 102A. Providing or passing data to another GPU may refer to the GPU pushing data and / or transmitting data to the memory of another GPU, and / or providing the GPU with access to data in the GPU and / or CPU memory. For example, in the case where the GPUs are able to access each other's GPU memory, there is no need to hand off the data because the data can be accessed remotely by the other GPU. Further, in some examples, this switching may be performed by operation processor 134 and / or a switching algorithm, and the GPU may or may not be an active participant in the switching.
[0068] Build table portions 242A-242N may include, for example, build table data representing one or more entries from corresponding build table portions 240A-240N. For an entry, this may include a payload and a corresponding key, a hash value of the key, a specified GPU ID for the entry, a hash table index for the entry, and / or a global location ID for the entry. In some embodiments, providing the hash value, specified GPU ID, hash table index, and / or global location ID may reduce processing by allowing different GPUs to use those values without calculating those values.
[0069] In some examples, build table portions 242A-242N may be generated from build table portions 240A-240N, where the data filter 120 and / or operation processor 134 of each GPU may filter out entry data for entries that the GPU has inserted into the GPU hash table partition. This may allow subsequent operations to operate on fewer build table entries and / or reduce inter-GPU traffic. In some examples, build table data including entry data for entries that have not been filtered out may not be pushed directly to the next GPU. For example, build table data may first be collected in a local staging buffer managed by software. This may result in a load imbalance between GPUs 102A-102N. In the case where build table 140 is in CPU memory 124, this load imbalance may be resolved by dividing the input into smaller partitions that are distributed across GPUs 102A-102N in a round robin manner.
[0070] Iteration 200B may be similar to iteration 200A, but using build table portions 242A-242N instead of build table portions 240A-240N. For example, in iteration 200B, hash table builder 112 of each of GPUs 102A-102N may (in parallel) read data from entries of the GPU's build table portion (e.g., partition) and use GPU's locality determiner 118 to make a determination 210 from the data as to which GPU is assigned for each entry's hash table partition and / or whether the GPU includes the hash table partition for the entry.
[0071] Similarly, if the GPU's location determiner 118 uses the global location ID to determine that the insertion is for the GPU's hash table partition, the GPU may insert the corresponding entry therein. Otherwise, the entry may not be inserted into the GPU's hash table partition, but may be inserted later at the GPU associated with the insertion.
[0072] Also similar to iteration 200A, based on the GPU-based hash table builder 112 processing at least a portion of the GPU's build table portion (e.g., a complete local partition), the hash table builder 112 may use the interface manager 110 to provide a corresponding portion of the build table data to another GPU for further processing. The build table data may correspond to Figure 2 Build table portions 246A-246N in the embodiment and may be generated from or correspond to build table portions 242A-242N, respectively.
[0073] The processing of the build table portions and providing build table data to different GPUs as described in iterations 200A and 200B may continue until hash table 144 is built. In any example, data (e.g., build table data) exchanged between GPUs 102A-102N may be stored in and processed from one or more of their buffers. In some examples, each of GPUs 102A-102N includes multiple buffers for double-caching data. For example, in each iteration such as iteration 200A, GPU 102A may process build table data, such as representing build table portion 240A, from an active buffer and receive build table data, such as representing build table portion 242N, from another GPU in the staging buffer of GPU 102A. In the next and / or subsequent iterations (such as iteration 200B), the roles of the buffers may switch. Each of GPUs 102A-102N may perform caching similar to GPU 102A. Using cache, GPUs 102A-102N may overlap data processing with the exchange of processed data between GPUs 102A-102N.
[0074] In some examples, the build table data is provided to another GPU using a switching or routing algorithm (e.g., a ring switch). In some examples, the switching or routing algorithm is configured so that each GPU sees all elements of build table 140. In other examples, the switching or routing algorithm is configured so that each GPU sees at least the elements of build table 140 that the GPU will insert into the GPU's hash table partition.
[0075] In a ring exchange, GPUs 102A-102N may be logically arranged in a ring such that each GPU has a left neighbor and a right neighbor. Figure 2 , the left neighbor of GPU 102A may be GPU 102N, and the right neighbor of GPU 102A may be GPU 102B. When each GPU provides build table data to another GPU, the GPU may provide data to the neighboring GPU in the same direction, such as Figure 2 Using ring switching, build table 140 may be read only once (e.g., via a relatively narrow CPU-GPU interconnect), and then each portion thereof may be passed back and forth between GPUs 102A-102N in the ring until every value from the build table is inserted into hash table 144.
[0076] The bottleneck in building hash table 144 may be caused by random memory access, which may be caused by performing atomic compare and swap operations and typically has a significantly lower throughput than the inter-GPU bandwidth. Using the methods described herein, the throughput of this bottleneck may be reduced by at least K times (compared to using a single GPU), where K is the number of GPUs 102A-102N, with each GPU 102A-102N making K passes (worst case) over build table 140 for insertion. On average, in each pass, only 1 / K entries of build table 140 may require a compare and swap operation.
[0077] Although each of GPUs 102A-100N is shown as including a single build table portion 240A-240N, in examples where a GPU initially includes multiple build table portions (e.g., partitions), when a GPU receives build table data from another GPU, it may process the received build table data as well as the initial build table portion for insertion. For example, in iteration 200A, GPU 102A may start with build table portion 240A and at least one other build table portion. However, GPU 102A may not process all of the initial build table portions in iteration 200A and may not provide all of the build table portions to different GPUs in iteration 200A. Then, in iteration 200B, GPU 102A may process one or more of build table portion 242N and the other initial build table portions. Further note that although Figure 2 Each of GPUs 102A-102N is shown as having a single hash table partition, but any of GPUs 102A-102N may be assigned any number of hash table partitions.
[0078] As an example of the foregoing, operation processor 134 may partition build table 140 into a plurality of partitions greater than the number of GPUs 102A-102N. In iteration 200B, each GPU 102A-102N may read the initial build table partition and the build table partition received from the left neighbor GPU in iteration 200A. Subsequently, all build table entries that have passed filtering by data filter 120 and do not fall into the hash table partition of the current GPU may be pushed to the right neighbor (e.g., using a local staging buffer). In the case where the inter-GPU bandwidth is higher than the bandwidth of the link accessing build table 140, this approach may be beneficial because traffic on a narrow link may be smoothed over a larger portion.
[0079] In some embodiments, when the location determiner 118 of one or more of the GPUs 102A-102N determines (e.g., using determination 210) a designated GPU for inserting an entry and the GPU is not the designated GPU, entry data (e.g., payload, hash value, and / or key, etc.) for the entry may be provided by the GPU to the designated GPU based on the determination. For example, the entry data may be provided (e.g., pushed) directly to the designated GPU (e.g., to its staging buffer), and the designated GPU may perform an insertion of the corresponding entry into a local partition of the hash table 144. This may be implemented in the case where each of the GPUs 102A-102N manages K-1 staging buffers. As another example, the GPU may perform a remote insertion of the entry into a partition of the hash table 144 of the designated GPU, such as in the case where the system 100 supports atomic operations for peer GPUs.
[0080] In implementations where remote insertion is possible, build table portions 240A-240N may not be exchanged between GPUs 102A-102N. For example, iteration 200B may not be required, and hash table 144 may be built in a single pass over build table 140. However, in any example, remote insertion may be performed by some of GPUs 102A-102N but not others, and / or may be performed for some scans of entries in build table 140 but not others, depending on various underlying factors.
[0081] Distributed hash table merging
[0082] The present disclosure provides, in part, a method for merging hash tables distributed across multiple GPUs, such as GPUs 102A-102N. For example, each of GPUs 102A-102N may include a corresponding hash table partition assigned to the GPU by an operation processor 134 and constructed from a build table 140. The hash table partitions may be constructed using the methods described herein or other suitable methods. In the case of probing the hash table partitions in a distributed manner, the methods described herein for performing distributed probing of hash tables using hash table partitions may be employed. However, in other embodiments, the hash table partitions may be merged to replicate the hash table 144 on one or more GPUs 102A-102N, and the replicated hash table copies may be used for distributed probing of the hash table.
[0083] See now Figure 3 , Figure 3300A and 300B). The operation processor 134 may use one or more stages (such as stage 300A and stage 300B) to merge partitions of the hash table 144. In stage 300A, each of the GPUs 102A-102N may push the hash table partitions assigned to it to the output hash tables of all other GPUs (e.g., in parallel). For example, GPU 102A may push hash table partition 244A to all GPUs 102A-102N, including itself, GPU 102B may push hash table partition 244B to all GPUs 102A-102N, including itself, and GPU 102N may push hash table partition 244N to all GPUs 102A-102N, including itself, as shown in FIG. Figure 3 As shown. In embodiments where each of GPUs 102A-102N has a non-overlapping partition of hash table 144, stage 300A may be performed without conflict with a continuous bulk peer-to-peer memory copy or coalesced write. Likewise, in some embodiments, each of GPUs 102A-102N may begin stage 300A once GPUs 102A-102N have completed processing their final build table data, such as where stage 300A is not performed in-place (e.g., the output hash table of each GPU is a separate initially empty data structure).
[0084] In embodiments where hash table partitions 244A-244N include conflicts (such as conflicts 310A, 310B, and 310N), stage 300B may be performed. For example, due to hash table conflicts, each of hash table partitions 244A-244N may have used some hash table entries outside the assigned range of the hash table partition. In the example shown, linear probing may be used for all hash table entries outside the assigned range so that the entry is contiguous in the GPU memory 122 of the GPU and starts at the entry directly after the end of the assigned range. To ensure that conflicts that overflow the end of the assigned range of the hash table partition are appended after the assigned range of the hash table partition and are not inserted into the assigned range (e.g., due to loop wrapping), each GPU may allocate a data structure that is larger than its assigned range (e.g., the size of the full hash table). After the global barrier, these entries may be processed in stage 300B.
[0085] In stage 300B, the interface manager 110 of each of the GPUs 102A-102N may perform a linear scan of conflicts 310A-310N for the hash table partitions 244A-244N (e.g., N linear scans for N partitions for each GPU). In doing so, the interface manager 110 may read each overflow entry directly from each peer hash table partition and start at the hash table entry just after the end of the processed partition. The interface manager 110 may run the linear scan until the first empty entry is found, as all overflow conflicts may be resolved at that point. Each key / entry found by the linear scan may be inserted by the hash table builder 112 into the output hash table of the local GPU 102A-102N, as shown in FIG. Figure 3 as shown in .
[0086] To generate a replicated hash table for each of GPUs 102A-102N, each GPU may insert the overflow of all other GPUs, which may include overflows attributable to the GPU itself that are not merged in-place. Thus, stage 300B may include performing the insertion of overflows by the GPUs in parallel but redundantly on each GPU. After stage 300B, each of GPUs 102A-102N may have a complete copy of hash table 144 in local memory (e.g., GPU memory 122 of the GPU).
[0087] Distributed Probing of Hash Tables
[0088] The present disclosure also provides, in part, a method for probing a hash table distributed across multiple GPUs (such as GPUs 102A-102N). For example, each of GPUs 102A-102N may include a respective hash table partition constructed from build table 140. The hash table partitions may be constructed using the methods described herein or other suitable methods. In the case where hash table partitions are used for distributed probing, the methods described herein for distributed probing of hash tables using hash table partitions may be employed. However, the present disclosure also provides for distributed probing of hash tables using multiple complete local copies of a hash table, such as where the methods described herein (e.g., using Figure 3 ) or other suitable methods to merge hash table partitions across GPUs.
[0089] Operation processor 134 may assign and / or distribute a corresponding portion (e.g., one or more partitions) of probe table 142 to each of GPUs 102A-102N for use in operation 138, and each of GPUs 102A-102N may use the GPU's hash table probe 114 to probe hash table 144 using the GPU's probe table portion.
[0090] Similar to About Figure 2As described for building the table portion, the portion of the probe table 142 may be distributed across the GPUs 102A-102N and / or may be stored in a memory accessible to a corresponding GPU in the GPUs 102A-102N. For example, the portion of the probe table 142 assigned to a particular GPU may be maintained in the GPU memory 122 of that GPU, or in the CPU memory 124 of one or more CPUs 104, such as a CPU 104 of a host system that includes a corresponding GPU assigned to the portion of the probe table. In any example, the portion of the probe table 142 may be in the GPU memory 122 or in the CPU memory 124 accessible to all or a subset of the GPUs 102A-102N. For example, with the probe table 142 stored in the CPU memory 124, the operation processor 134 may partition the probe table 142 substantially evenly (e.g., equally when divisible by the number of GPUs and / or partitions) across all GPUs 102A-102N. The hash table probe 114 of each of the GPUs 102A-102N may (in parallel) read entries / values from its assigned portion of the probe table and locally probe the hash table 144. In the case where each value from the probe table 142 is read only once, all GPUs 102A-102N may read the value directly from fixed system memory or may process the value in a staging pipeline. If the probe results in a matching key in the hash table 144, the result manager 116 may materialize the result (e.g., result 146).
[0091] Different examples of hash tables for probing distributed across GPUs 102A-102N are provided. In some approaches, the hash table portion may be swapped between GPUs 102A-102N, and the probe table portion may be pinned to GPUs 102A-102N (not swapped). In other approaches, both the hash table portion and the probe table portion may be pinned to GPUs 102A-102N. In other approaches, the hash table portion may be pinned to GPUs 102A-102N, and the probe table portion may be swapped between GPUs 102A-102N.
[0092] See now Figure 4 , Figure 4 is a diagram illustrating an example of distributed probing of a hash table using multiple GPUs and fixed hash table partitions according to some embodiments of the present disclosure.
[0093] Operation processor 134 may assign or allocate respective portions (e.g., one or more partitions) of hash table 144 and probe table 142 to each of GPUs 102A-102N for use in operation 138. For example, hash table partition 244A and probe table portion 442A may be assigned to GPU 102A, hash table partition 244B and probe table portion 442B may be assigned to GPU 102B, and hash table partition 244N and probe table portion 442N may be assigned to GPU 102N.
[0094] In various examples, the operational processor 134 partitions the probe table 142 into N partitions of substantially equal size, wherein each of the GPUs 102A-102N is assigned a respective partition, and N may also represent the number of GPUs. The hash table 144 and / or the assigned portion of the probe table 142 may be distributed across the GPUs 102A-102N and / or may be stored in a memory accessible to a corresponding GPU in the GPUs 102A-102N. For example, the portion of the hash table 144 assigned to a particular GPU may be maintained in the GPU memory 122 of that GPU. One example includes the hash table partition 244A of GPU 102A being maintained in the GPU memory 122 of GPU 102A. Portions of the probe table 142 may be similarly arranged, or may be in the CPU memory 124 of one or more CPUs 104, such as the CPU 104 of a host system that includes a corresponding GPU to which a portion of the probe table 142 is assigned. In any example, portions of probe table 142 may be in GPU memory 122 or in CPU memory 124 accessible to all GPUs 102A-102N or a subset thereof. In general, the storage locations of portions of hash table 144 and probe table 142 may vary based on the components, capabilities, and configuration of system 100.
[0095] GPUs 102A-102N may probe hash table 144 in multiple iterations. For example, Figure 4Iterations 400A and 400B are shown for probing the hash table 144 in a distributed manner using the GPUs 102A-102N. In iteration 400A, the hash table probe 114 of each of the GPUs 102A-102N may scan the assigned probe table portion (e.g., in parallel) and may perform a probe of the hash table partition stored on that GPU (e.g., when the location of the entry corresponds to the hash table portion / partition). For example, the hash table probe 114 of the GPU 102A may scan the entries from the probe table portion 442A, and the hash table probe 114 of the GPU 102A may make a determination 410 for each entry whether the GPU 102A may include a matching entry in the hash table partition 244A. This may include the hash table probe 114 hashing the key of the entry to calculate a hash value, and using the hash value to determine whether the hash table partition 244A may include a matching entry (e.g., based on the global location ID).
[0096] In some examples, determination 410 may be performed using locality determiner 118. For example, hash table probe 114 of each of GPUs 102A-102N may use locality determiner 118 of the GPU to make determination 410 of which GPU is assigned for each hash table partition of the entry and / or whether the GPU includes a hash table partition for the entry. For example, hash table probe 114 of GPU 102A may read the entry from probe table portion 442A, and locality determiner 118 of GPU 102A may make determination 410 for each entry of which GPU includes a hash table partition for probing the entry and / or whether GPU 102A includes a hash table partition. This may include locality determiner 118 hashing a key of the entry to calculate a hash value, and using the hash value to derive a global location ID, such as a global hash value index of hash table 144, a global bucket ID of hash table 144, a partition ID of hash table 144, and / or a GPU ID identifying a corresponding location for probing hash table 144. If the GPU's location determiner 118 uses the global location ID to determine that the probe is for the GPU's hash table partition, the GPU can probe the corresponding entry therein. Otherwise, the entry may not be used to probe the GPU's hash table partition, but may be used later to probe the GPU that includes the corresponding hash table partition.
[0097] In examples where the location determiner 118 is used by the hash table probe 114, the location determiner 118 may determine the global location ID using equations (1), (2), and (3) and / or other suitable equations. By using the global location ID to determine whether to probe an entry for a local hash table partition of a GPU, the probing of the hash table 144 may be parallelized across the GPUs 102A-102N, thereby reducing the impact of the corresponding random memory accesses on the total probing time of the hash table 144.
[0098] In a further aspect, a GPU-based hash table probe 114 processes at least a portion of a GPU's probe table portion (e.g., a complete local partition), and the hash table probe 114 may use the interface manager 110 to provide the probe table data (e.g., the complete portion and / or the unprobed or matched portion) to another GPU for further processing. The probe table data may represent Figure 4 444N in the probe table portions 444A-444N of the GPU 102A and may be generated from or correspond to the probe table portions 442A-442N, respectively. For example, the interface manager 110 of GPU 110A may provide the probe table portion 444A (corresponding to the probe table portion 442A) to GPU 102B, the interface manager 110 of GPU 110B may provide the probe table portion 444B (corresponding to the probe table portion 442B) to GPU 102N, and the interface manager 110 of GPU 110N may provide or pass the probe table portion 444N (corresponding to the probe table portion 442N) to GPU 102A. Providing or passing data to another GPU may refer to the GPU pushing the data and / or transferring the data to the memory of the other GPU, and / or providing access to the data to the GPU.
[0099] Probe table portions 444A-444N may consist of, for example, probe table data representing one or more entries from corresponding probe table portions 442A-442N. For an entry, this may include a corresponding key, a hash value of the key, a specified GPU ID for the entry, a hash table index for the entry, and / or a global location ID for the entry. In some embodiments, providing a hash value, a specified GPU ID, a hash table index, and / or a global location ID may reduce processing by allowing different GPUs to use those values without calculating those values.
[0100] In some examples, probe table portions 444A to 444N may be generated from probe table portions 442A-442N, wherein the data filter 120 and / or operation processor 134 of each GPU may filter out entry data and / or its entries from entries that the GPU has matched to a GPU hash table partition. This may allow subsequent operations to operate on fewer probe table entries and / or reduce inter-GPU traffic. In some examples, probe table data including entry data for entries that were filtered out may not be pushed to the next GPU. For example, the probe table data may first be collected in a software-managed staging buffer. This may result in a load imbalance between GPUs 102A-102N. In the case where the probe table 142 is in the CPU memory 124, this load imbalance may be resolved by dividing the input into smaller partitions that are distributed across GPUs 102A-102N in a round-robin manner.
[0101] Iteration 400B may be similar to iteration 400A, but with probe table portions 444A-444N used instead of probe table portions 442A-442N. For example, in iteration 400B, the hash table probe 114 of each of the GPUs 102A-102N may scan the assigned probe table portion (in parallel) and perform a join with a hash table partition stored on that GPU (e.g., when the location of the entry corresponds to a hash table portion / partition). Similarly, the location determiner 118 may be used, and if the location determiner 118 determines using the global location ID that the entry includes a hash value in the hash table partition of the GPU, then the GPU may probe for the hash table partition of the GPU. Otherwise, the entry may not be used to probe the hash table partition of the GPU, but may be used later to probe a GPU that includes the corresponding hash table partition or probed location.
[0102] Also similar to iteration 400A, the GPU-based hash table probe 114 processes at least a portion of the probe table portion of the GPU (e.g., a complete local partition), and the hash table probe 114 can use the interface manager 110 to provide the probe table data (e.g., the complete portion and / or the unprobed portion) to another GPU for further processing. These processed portions may represent Figure 4 Detection table portions 446A-446N in the embodiment and may be generated from or correspond to detection table portions 444A-444N, respectively.
[0103] The processing of the probe table portions and providing the probe table data to the different GPUs illustrated in iterations 400A and 400B may continue until all entries from the probe table are probed to the hash table 144. In any example, data (e.g., probe table data) exchanged between GPUs 102A-102N may be stored in and processed from one or more of their buffers. In some examples, each of GPUs 102A-102N includes multiple buffers for double-caching data. For example, in each iteration, such as iteration 400A, GPU 102A may process probe table data (e.g., representing probe table portion 442A) from an active buffer and receive probe table data from another GPU in the staging buffer of GPU 102A, such as representing probe table portion 444N. In the next iteration and / or subsequent iterations (such as iteration 400B), the roles of the buffers may switch. Each of GPUs 102A-102N may perform caching similar to GPU 102A. Using cache, GPUs 102A-102N may overlap data processing with the exchange of processed data between GPUs 102A-102N.
[0104] In some examples, the probe table data is provided to another GPU using a switching or routing algorithm (e.g., a ring switch as described herein). In some examples, the switching or routing algorithm is configured so that each GPU sees all elements of probe table 142. In other examples, each GPU may not see all elements of probe table 142, and the switching or routing algorithm may be configured so that each GPU sees at least the elements of probe table 142 that the GPU will probe for the GPU's hash table partition.
[0105] Another example of a switching or routing algorithm is hierarchical switching. In hierarchical switching, the operation processor 134 may logically group the GPUs 102A-102N into sets of M GPUs, where M is less than the number of GPUs N. At the beginning of the probe hash table 144, each set S of GPUs 102A-102N may collectively include a complete copy of the probe table 142 for several partitions in the GPU memory 122 across the GPUs in the set, so that the probe table partitions are replicated in each set S. When the probe table data is exchanged between GPUs, the partitions may be exchanged (e.g., after filtering in a round-robin manner) within each set S. This approach may reduce the number of transfers of the probe table data from N to M, which may be desirable for GPU-GPU connection topologies that may not provide fast bisection bandwidth between all GPUs and are effectively limited by communication throughput. For example, the pressure from the all-to-all interconnection between GPUs 102A-102N may be unloaded because the GPUs may only fully communicate during the first iteration of the probe hash table 144, but in the next M-1 iterations, the GPUs may communicate within the set. Hierarchical switching may be similarly used to build hash table 144 , such methods being described herein (eg, using build table 140 instead of probe table 142 ).
[0106] Although each of GPUs 102A-102N is shown as including a single probe table portion 442A-442N, in examples where a GPU initially includes multiple probe table portions (e.g., partitions), when a GPU receives probe table data from another GPU, it may process the received probe table data as well as the initial probe table portion. For example, in iteration 400A, GPU 102A may start with probe table portion 442A and at least one other initial probe table portion. Then, in iteration 400B, GPU 102A may process one or more of probe table portion 444N and the other initial probe table portions. Further note that although Figure 4 Each of GPUs 102A-102N is shown with a single hash table partition, but any GPU of GPUs 102A-102N may be assigned any number of hash table partitions.
[0107] As an example, in iteration 400A, the hash table probe 114 of each of the GPUs 102A-102N may scan the assigned probe table partition and perform a probe for a portion of the hash table stored on that GPU (e.g., when the location of the entry corresponds to a hash table portion / partition). In parallel, the probe table data may be sent to the peer GPU in a round-robin fashion. This may be repeated until all probe table partitions are processed on all GPUs 102A-102N. Similar to the embodiment of the build phase, where the data filter 120 filters the probe table 142, each of the GPUs 102A-102N may push the probe table data representing only the keys and values that have not been filtered out to the staging buffer of the next GPU. Using this approach, inter-GPU traffic may be minimized, and subsequent passes may operate on fewer values.
[0108] although Figure 4 A method is shown in which hash table partitions are fixed to GPUs 102A-102N and probe table portions are exchanged between GPUs 102A-102N. As described herein, hash table data may be exchanged between GPUs 102A-102N and probe table portions may be fixed to GPUs 102A-102N. For example, referring now to Figure 5 , Figure 5 is a diagram illustrating an example of distributed probing of hash tables using GPUs 102A-102N and fixed probe table portions 542A-542N according to some embodiments of the present disclosure.
[0109] Figure 5 The iterations 500A and 500B in the example may be similar to Figure 4 400A and 400B in iteration 500A. However, in iteration 500A, probe table portions 542A-542N may be scanned to probe hash table portions 544A-544N, and hash table portions 546A-546N may correspond to (e.g., be generated from) hash table portions 544A-544N and be swapped by GPUs 102A-102N. In iteration 500B, probe table portions 542A-542N may be scanned to probe swapped hash table portions 546A-546N, and hash table portions 548A-548N may correspond to (e.g., be generated from) hash table portions 546A-546N and be swapped by GPUs 102A-102N. In doing so, one or more determinations 510 may be made for each GPU, which may be similar to one or more determinations 410.
[0110] As an example, in iteration 500A, each of GPUs 102A-102N may scan one or more probe table portions assigned in one or more probe table portions 542A-542N, and may perform a probe for a hash table portion 544A-544N stored on that GPU (e.g., when the location of the entry corresponds to a hash table portion / partition). In parallel, corresponding hash table portions in hash table portions 546A-546N may be sent to and / or provided to a peer GPU, for example, in a round-robin manner. This may be repeated until all hash table portions on all GPUs are processed or all probe table entries are matched to hash table 144. For example, where GPUs 102A-102N include N GPUs, hash table 144 may be split into N partitions (one for each GPU). In this example, there may be N passes over probe table 142. However, at each pass, the corresponding hash table partition may be accessed only for a subset of the keys from probe table portions 542A-542N. In particular, accesses to the GPU may be for those keys having hash values that fall within the range of the hash table partition at the GPU. As such, the total number of random accesses across all GPUs 102A-102N for all N passes may be equal to the total number of keys in the probe table 142.
[0111] The performance of the above method may be limited by the slowest of the following timings in each iteration: (1) partition size of probe table 142 / sequential access to the probe table, which is either a single GPU memory throughput of GPU memory 122 or the memory throughput of the GPU accessing CPU memory (to scan the probe table partitions); (2) partition size of probe table 142 / random single GPU memory throughput of GPU memory 122 / N (to access hash table 144, on average 1 / N values will fall into the current hash table partition); and (3) partition size of hash table 144 / per-GPU two-partition bandwidth (to swap hash table partitions). If the probe table is actually in GPU memory, sequential GPU memory access is often an order of magnitude faster than random GPU memory access, so that (2) or (3) will be the dominant factor, depending on the size of probe table 142 and hash table 144. If the probe table is in CPU memory, then (1) may become a bottleneck.
[0112] As described herein, in some approaches, both the hash table portion and the probe table portion may be fixed to GPUs 102A-102N. For example, when the location determiner 118 of GPU 102A makes a determination 410 / 510 of which GPU is assigned a hash table partition for an entry (e.g., depending on a hash index) and the GPU is different from GPU 102A, GPU 102A may directly access the corresponding GPU to perform a probe on the hash table partition. Specifically, GPU 102A may remotely access the GPU memory 122 of the corresponding GPU. Other GPUs 102B-102N may behave similarly. Direct access to the remote GPU memory 122 may be performed by mapping the remote GPU memory 122 into the addressing space of the GPU performing the remote access, which may be facilitated using a unified memory. Unified memory may refer to a single memory address space accessible from any of GPUs 102A-102N and / or CPU 104. Using unified memory, an application may allocate data that may be read from or written to code running on a CPU or GPU. As another example, GPU 102A may provide probe table data for an entry to a corresponding GPU for probing by the receiving GPU (eg, to its staging buffer), rather than performing a direct access remotely. Other GPUs 102B-102N may behave similarly.
[0113] While in various examples, hash table portions and / or probe table portions may be fixed to GPUs 102A-102N, in other examples, some hash table portions and / or probe table portions may be exchanged between GPUs 102A-102N and other hash table portions and / or probe table portions may be fixed. Further, remote access of GPU memory 122 for probing may be integrated into any of the described examples and may be performed for some of GPUs 102A-102N but not others, and / or may be performed for some scans of entries in probe table 142 but not others, depending on various underlying factors. Thus, various hybrids and combinations of the methods described herein are possible.
[0114] Rearrange probe table entries for distributed probing
[0115] As described herein, the operations processor 134 may assign or allocate a respective portion (e.g., one or more partitions) of the probe table 142 for operation 138 to each of the GPUs 102A-102N, and each of the GPUs 102A-102N may use the GPU's hash table probe 114 to probe the hash table 144 using the GPU's probe table portion. In any example, this may include the operations processor 134 rearranging entries of the probe table 142 at the beginning of the probe phase (before probing occurs) to reduce inter-GPU communication. In a different example, the operations processor 134 may determine a portion of the probe table 142 for a GPU based at least in part on a range of the hash table 144 assigned to the GPU. For example, the operations processor 134 may use a global location identifier to assign an entry to a GPU based on the entry falling within a range of the hash table 144 assigned to the GPU (e.g., in the GPU memory 122 of the GPU). Using this approach, the operation processor 134 may rearrange one or more entries of the probe table 142 into a number of partitions (e.g., equal to the number of GPUs 102A-102N), where each partition may only hold keys that fall within the range of the hash table partition assigned to the corresponding GPU. The rearrangement may be performed on the CPU 104 and / or on the GPUs 102A-102N.
[0116] In some examples, to rearrange the entries of the probe table 142, the probe table data may not be moved in place, but may be copied from the probe table 142 to a contiguous location in the corresponding probe table partition (e.g., to maximize throughput). For each GPU, a shared memory hierarchical probe table partition may be used to avoid random memory accesses to the GPU global memory. GPUs 102A-102N may each populate a probe table partition, for example, by generating 0-N-1 buckets, where N is the number of GPUs. After GPUs 102A-102N populate the probe table partitions, these partitions may be swapped (e.g., a full swap between GPUs, where each GPU sends its bucket K to GPU K) and concatenated (e.g., to form a single partition from buckets from other GPUs) so that ultimately each GPU has a probe table partition with keys that fall into the range of the local hash table partition. Using this approach, each probe table partition index may be bound to a corresponding hash table partition range (e.g., by hashing the key and dividing by the hash table partition size to determine the probe table partition index for the entry).
[0117] Materialize the results of distributed probing of hash tables
[0118] The present disclosure also provides, in part, methods for materializing results of probing hash tables distributed across multiple GPUs, such as GPUs 102A-102N. For example, each of GPUs 102A-102N may include a respective hash table partition of hash table 144 and / or a replicated copy of hash table 144. Hash table 144 may be probed by GPUs 102A-102N using the methods described herein or other suitable methods to produce results 146.
[0119] See now Figure 6 , Figure 6 6 is a diagram illustrating an example of materializing the results of a distributed probing of a hash table 144 using GPUs 102A-102N and a global offset variable 604 according to some embodiments of the present disclosure. GPUs 102A-102N may use the global offset variable 604 to materialize at least some of the results to at least a memory 606 shared between GPUs 102A-102N. For example, GPUs 102A-102N may materialize the results 146 to a global output buffer 608 in the memory 606. The memory 606 may include CPU memory or GPU memory accessible by each of the GPUs.
[0120] In various examples, the global offset variable 604 may reside in the same or different memory 602 as the memory 606, and may include CPU memory or GPU memory. In some embodiments, the global offset variable 604 resides in the GPU memory 122 of one or more of the GPUs 102A-102N that is accessible by each of the GPUs 102A-102N, and may be used to coordinate writes to the global output buffer 608. The global offset variable 604 may include a variable, and the value of the variable may be used to track and define a global offset of where the result should be written to the global output buffer 608. For example, to materialize the result 146, each of the GPUs 102A-102N may use an atomic operation with a system-wide range that increments the global offset variable 604 by the number of results 146 (or values) to be materialized by the GPU. The corresponding result 146 may then be written to the global output buffer 608 at the value of the global offset variable 604 returned by the atomic operation. For example, GPU 102A may write result 610A in results 146 to the global output buffer 608 at a location defined by global offset variable 604, and may increment global offset variable 604 based on the number of results 610A. Similarly, GPU 102B may write result 610B in results 146 to the global output buffer 608 at a location defined by global offset variable 604, and global offset variable 604 may increment based on the number of results 610B. Further, GPU 102N may write result 610N in results 146 to the global output buffer 608 at a location defined by global offset variable 604, and global offset variable 604 may increment based on the number of results 610N.
[0121] See now Figure 7 , Figure 7608 is a diagram illustrating an example of materializing the results of a distributed probing of a hash table using multiple GPUs and the size of local output buffers according to some embodiments of the present disclosure. Without employing a global offset variable, such as when one or more of GPUs 102A-102N cannot access or use global offset variable 604, or for performance reasons, a GPU may materialize a portion of the results it generates in a local memory (such as local GPU memory). For example, GPU 102A may materialize result 610A to the local output buffer of GPU 102A, GPU 102B may materialize result 610B to the local output buffer of GPU 102B, and GPU 102N may materialize result 610N to the local output buffer of GPU 102N. GPUs 102A-102N may further materialize results 610A-610N from the local output buffers to global output buffer 608 to form result 146. To do this, GPUs 102A-102N may calculate an exclusive prefix sum of the local output buffer sizes.
[0122] To illustrate the exclusive prefix sum, assume that GPUs 102A-102N include four GPUs with the following local output buffer sizes: 5, 8, 2, and 10. The exclusive prefix sum of this array will be 0, 5, 13, 15, where the current size value is excluded from the sum and everything before the current size value is added. For example, for the fourth entry (10), the exclusive prefix sum can be calculated as 5+8+2. This prefix sum sequence can define the global offset of the portion of result 146 in each local output buffer, respectively. For example, in the case where GPU 102A is the GPU with a local output buffer size of 5 in the above example, the result 610A can be materialized using a global offset of 0 (e.g., indicating the starting address of the global output buffer 608). Each of GPUs 102A-102N can write (e.g., push in parallel) the corresponding portion of result 146 to the global output buffer 608 using the corresponding global offset value of the portion of result 146.
[0123] In various embodiments, Figure 6 and Figure 7 The methods can be combined, such as on a system with multiple islands of fully connected GPUs. For example, one can use Figure 6 method, and then you can use Figure 7 In a further example, the global offset variable 604 may be allocated in CUDA unified memory and may be implemented using software emulation with system-wide atomics. Figure 6 method.
[0124] See now Figure 8, each block of method 800 and other methods described herein includes a computing process that can be performed using any combination of hardware, firmware, and / or software. For example, different functions can be performed by a processor executing instructions stored in a memory. The method can also be embodied as computer-usable instructions stored on a computer storage medium. These methods can be provided by a stand-alone application, a service or a hosted service (standalone or in combination with another hosted service), or a plug-in for another product, to name a few. In addition, by way of example, with respect to multi-GPU distributed processing system 100 ( Figure 1 ) to describe the method. However, these methods may additionally or alternatively be performed by any one system or any combination of systems, including but not limited to those described herein.
[0125] Figure 8 8 is a flow chart illustrating a method 800 for distributed build hash tables using multiple GPUs, wherein build table entries are associated with local hash table partitions, according to some embodiments of the present disclosure. At block B802, method 800 includes receiving a portion of a build table. For example, in iteration 200A, interface manager 110 of GPU 102A may receive build table portion 240A.
[0126] At block B804, method 800 includes computing a global location identifier from the entries in the portion of the build table. For example, location determiner 118 of GPU 102A may compute a global ID from the entries in build table portion 240A that identifies a specified GPU from GPUs 102A-102N as being assigned hash table partition 244A of hash table 144 (and / or identifies hash table partition 244A for inserting an entry). For example, the computation may be performed for determination 210 performed by hash table builder 112 of GPU 102A.
[0127] At block B806, method 800 includes performing insertion of the entry in a hash table partition of the hash table based on the global location identifier. For example, hash table builder 112 of GPU 102A may perform insertion of the entry in hash table partition 244A based on the global ID identifying GPU 102A as the designated GPU (and / or identifying hash table partition 244A for inserting the entry). The insertion may be made, for example, in response to determination 210 performed by hash table builder 112 of GPU 102A.
[0128] After building the hash table using method 800, at least a portion of the hash table may be probed. For example, the hash table probe 114 of GPU 102A may use at least a portion of the probe table 142 to probe at least a portion of the hash table 144 to produce one or more of the results 146. In some examples, the hash table partitions 244A-244N may be merged to form a replicated copy, and the probe may be directed to the local copy of the hash table 144. In other examples, the probe may be directed to the hash table partition 244A. Further, the probe and result materialization may be performed using any suitable method, including those described herein. Although method 800 is primarily described for iteration 200A, method 800 may be similarly applied to iteration 200B. Further, method 800 may be applied to embodiments in which GPUs 102A-102N may remotely insert entries from a local build table portion into a hash table partition assigned to other GPUs, in which case data from the local build table portion may not be provided to the other GPUs for those GPUs to perform the insertion, and iteration 200B may not be required.
[0129] See now Fig. 9 , Fig. 9 9 is a flow chart illustrating a method 900 for distributed build hash tables using multiple GPUs, wherein build table entries are associated with remote hash table partitions, according to some embodiments of the present disclosure. At block B 902, method 900 includes receiving a portion of a build table. For example, in iteration 200A, interface manager 110 of GPU 102A may receive build table portion 240A.
[0130] At block B904, method 900 includes computing a global location identifier from the entries in the portion of the build table. For example, location determiner 118 of GPU 102A may compute a global ID from the entries in build table portion 240A that identifies a specified GPU from GPUs 102A-102N as being assigned hash table partition 244N of hash table 144 (and / or identifies hash table partition 244N for inserting an entry). For example, the computation may be performed for determination 210 performed by hash table builder 112 of GPU 102A.
[0131] At block B906, method 900 includes sending data representing the entry based on the global location identifier for inserting the entry into a hash table partition of the hash table. For example, interface manager 110 of GPU 102A may send data representing the entry based on the global location identifier that identifies the specified GPU as different from GPU 102A (and / or identifies hash table partition 244N for inserting the entry) for inserting the entry into hash table partition 244N at the specified GPU. This sending may be made, for example, in response to determination 210 performed by hash table builder 112 of GPU 102A, and the entry may be included in build table portion 242A provided to GPU 102B. Later, GPU 102B may provide the data to GPU 102N, and GPU 102N may perform the insertion into hash table partition 244N. In other examples, the data may be sent by GPU 102A or GPU 102B to GPU 102N as part of a remote insertion into hash table partition 244N. Further, the GPU to which GPU 102A provides data may depend on the switching or routing algorithm employed.
[0132] After building a hash table using method 900, at least a portion of the hash table may be probed. For example, hash table probe 114 of GPU 102A may use at least a portion of probe table 142 to probe at least a portion of hash table 144 to produce one or more of results 146. In some examples, hash table partitions 244A-244N may be merged to form a replicated copy, and the probe may be directed to a local copy of hash table 144. In other examples, the probe may be directed to hash table partition 244A. Further, the probe and result materialization may be performed using any suitable method, including those described herein. Although method 900 is primarily described for iteration 200A, method 900 may be similarly applied to iteration 200B. Further, method 900 may be applied to embodiments in which GPUs 102A-102N may perform remote insertion of entries from a local build table portion into a hash table partition assigned to other GPUs, in which case data from the local build table portion may not be provided to other GPUs for those GPUs to perform the insertion, and iteration 200B may not be required.
[0133] See now Fig.10 , Fig.10 1 is a flow chart illustrating a method 1000 for distributed probing of a hash table using multiple GPUs, wherein a probe table entry is associated with a local hash table partition, according to some embodiments of the present disclosure. At block B 1002, method 1000 includes receiving a portion of a probe table. For example, in iteration 400A, interface manager 110 of GPU 102A may receive probe table portion 442A.
[0134] At block B1004, method 1000 includes computing a global location identifier from the entry in the portion of the probe table. For example, location determiner 118 of GPU 102A may compute a global ID from the entry in probe table portion 442A that identifies a specified GPU from GPUs 102A-102N as including hash table partition 244A of hash table 144 for probing the entry (and / or identifies that hash table partition 244A should be probed using the entry). For example, the computation may be performed for determination 410 performed by hash table probe 114 of GPU 102A.
[0135] At block B1006, method 1000 includes performing a probe of a hash table partition of the hash table based on the global location identifier. For example, hash table probe 114 of GPU 102A may perform a probe of hash table partition 244A using the entry based on the global ID identifying GPU 102A as the designated GPU (and / or identifying that hash table partition 244A should be probed using the entry). For example, the probe may be performed in response to determination 410 performed by hash table probe 114 of GPU 102A.
[0136] At block B1008, method 1000 includes providing one or more results of the probing of the hash table (if any) to a global output buffer. For example, hash table probe 114 of GPU 102A may use result manager 116 to materialize one or more results 146 to a global output buffer, such as Figure 6 and Figure 7 400A, the method 1000 may be similarly applied to iteration 400B. Further, the method 1000 may be applied to embodiments in which GPUs 102A-102N may perform remote probing using entries from a local probe table portion to hash table partitions on other GPUs, in which case data from the local probe table portion may not be provided to other GPUs for those GPUs to perform probing, and iteration 400B may not be required.
[0137] Furthermore, the method 1000 can also be applied to Figure 5 For example, GPU 102A may use the global ID from block B 1004 to determine whether to probe hash table portion 544A in iteration 500A at block B 1006, and / or may use the global ID from block B 1004 to determine whether to probe hash table portion 546A in iteration 500B at block B 1006.
[0138] See now Fig.11 , Fig.11 1 is a flow chart illustrating a method 1100 for distributed probing of a hash table using multiple GPUs, wherein a probe table entry is associated with a remote hash table partition, according to some embodiments of the present disclosure. At block B 1102, the method 1100 includes receiving a portion of a probe table. For example, in iteration 400A, the interface manager 110 of the GPU 102A may receive the probe table portion 442A.
[0139] At block B1104, method 1100 includes computing a global location identifier from the entry in the portion of the probe table. For example, location determiner 118 of GPU 102A may compute a global ID from the entry in probe table portion 442A that identifies a specified GPU from GPUs 102A-102N as including hash table partition 244N of hash table 144 for probing the entry (and / or identifies that hash table partition 244N should be probed using the entry). For example, the computation may be performed for determination 410 performed by hash table probe 114 of GPU 102A.
[0140] At block B1106, method 1100 includes sending data representing an entry for probing a hash table partition of a hash table based on the global location identifier. For example, interface manager 110 of GPU 102A may send data representing an entry for probing hash table partition 244N using an entry at a specified GPU based on a global location identifier that identifies the specified GPU as different from GPU 102A (and / or identifies that hash table partition 244N should use the entry to probe). This sending may be made, for example, in response to determination 410 performed by hash table probe 114 of GPU 102A, and the entry may be included in probe table portion 444A provided to GPU 102B. Later, GPU 102B may provide the data to GPU 102N, which may perform a probe into hash table partition 244N. In other examples, the data may be sent by GPU 102A or GPU 102B to GPU 102N as part of a remote probe into hash table partition 244N. Further, the GPU to which GPU 102A provides data may depend on the switching or routing algorithm employed.
[0141] At block B1108, method 1100 includes providing one or more results of the probing of the hash table (if any) to a global output buffer. For example, hash table probe 114 of GPU 102A may use result manager 116 to materialize one or more results 146 to a global output buffer, such as Figure 6 and Figure 7400A, the method 1000 may be similarly applied to iteration 400B. Further, the method 1000 may be applied to embodiments in which GPUs 102A-102N may perform remote probing using entries from the local probe table portion to hash table partitions on other GPUs, in which case data from the local probe table portion may not be provided to other GPUs for those GPUs to perform probing, and iteration 400B may not be required.
[0142] Further, the method 1100 can also be applied to Figure 5 For example, GPU 102A may use the global ID from block B1104 to determine whether to probe hash table portion 544A in iteration 500A at block B1106, and / or may use the global ID from block B1104 to determine whether to probe hash table portion 546A in iteration 500B at block B1106.
[0143] See now Fig.12 , Fig.12 1 is a flow chart illustrating a method 1200 for materializing the results of a distributed probing of a hash table using multiple GPUs and a global offset variable according to some embodiments of the present disclosure. At block B1202, the method 1200 includes probing at least a portion of a hash table to determine one or more results of a distributed probing of the hash table performed by a GPU, if any. For example, Figure 6 Hash table probes 114 of GPUs 102A-102N may perform distributed probing of hash tables 144 using any suitable method described herein or other suitable method. GPU 102A, for example, may determine result 610A, which may be part of probed results 146.
[0144] At block B1204, method 1200 includes determining an offset in a global output buffer based on a global offset variable from a global offset variable shared by the GPU to materialize the result (if any) to the global output buffer. For example, result manager 116 of GPU 102A may determine an offset in global output buffer 608 from global offset variable 604.
[0145] At block B1206, method 1200 includes materializing one or more results (if any) to a global output buffer using the offset. For example, result manager 116 of GPU 102A may materialize result 610A to global output buffer 608 at a location in global output buffer 608 corresponding to the offset.
[0146] See now Fig.13 , Fig.13 is a flow chart illustrating a method 1300 for materializing the results of a distributed probe of a hash table using multiple GPUs and the size of a local offset buffer according to some embodiments of the present disclosure. At block B1302, the method 1300 includes probing at least a portion of the hash table to determine one or more results of the distributed probe of the hash table performed by the GPU, if any. For example, Figure 7 Hash table probes 114 of GPUs 102A-102N may perform distributed probing of hash tables 144 using any suitable method described herein or other suitable method. GPU 102A, for example, may determine result 610A, which may be part of probed results 146.
[0147] At block B 1304 , method 1300 includes storing one or more results (if any) in a local output buffer. For example, result manager 116 of GPU 102A may store result 610A to a local output buffer of GPU 102A.
[0148] At block B 1306, method 1300 includes determining an offset in the global output buffer from the size of the local offset buffer used by the GPU for materializing the result (if any) to the global output buffer. For example, result manager 116 may use the size of the local output buffers of GPUs 102A-102N to calculate an exclusive prefix sum of the local output buffers, which may include an offset for result 610A in global output buffer 608.
[0149] At block B1306, method 1300 includes materializing one or more results (if any) to a global output buffer using the offset. For example, result manager 116 of GPU 102A may materialize result 610A to global output buffer 608 at a location in global output buffer 608 corresponding to the offset.
[0150] Fig.141400. The computing device 1400 may include an interconnect system 1402 that directly or indirectly couples the following devices: memory 1404, one or more central processing units (CPUs) 1406, one or more graphics processing units (GPUs) 1408, communication interfaces 1410, input / output (I / O) ports 1412, input / output components 1414, power supplies 1416, and one or more presentation components 1418 (e.g., displays). One or more of the GPUs 102A-102N may correspond to one or more GPUs 1408 and / or be included in one or more instantiations of the computing device 1400. Further, one or more of the CPUs 104 may correspond to one or more of the one or more CPUs 1406 and / or be included in one or more instantiations of the computing device 1400. Further, the different memories described herein may correspond to the memory 1404 and / or one or more instantiations of the computing device 1400.
[0151] although Fig.14 The various blocks of are shown as being connected with lines via interconnect system 1402, but this is not intended to be limiting and is merely for clarity. For example, in some embodiments, presentation component 1418 (such as a display device) may be considered to be I / O component 1414 (e.g., if the display is a touch screen). As another example, CPU 1406 and / or GPU 1408 may include memory (e.g., memory 1404 may represent a storage device in addition to the memory of GPU 1408, CPU 1406, and / or other components). In other words, Fig.14 The computing devices in the description are illustrative only. No distinction is made between categories such as "workstation," "server," "laptop," "desktop computer," "tablet computer," "client device," "mobile device," "handheld device," "game console," "electronic control unit (ECU)," "virtual reality system," and / or other device or system types, as all are considered Fig.14 within the range of computing devices.
[0152] The interconnection system 1402 may represent one or more links or buses, such as an address bus, a data bus, a control bus, or a combination thereof. The interconnection system 1402 may include one or more bus or link types, such as an industry standard architecture (ISA) bus, an extended industry standard architecture (EISA) bus, a video electronics standard association (VESA) bus, a peripheral component interconnect (PCI) bus, a peripheral component interconnect express (PCIe) bus, and / or another type of bus or link. In some embodiments, there is a direct connection between components. As an example, the CPU 1406 may be directly connected to the memory 1404. Further, the CPU 1406 may be directly connected to the GPU 1408. In the case where there is a direct or point-to-point connection between components, the interconnection system 1402 may include a PCIe link for performing the connection. In these examples, the PCI bus does not need to be included in the computing device 1400.
[0153] Memory 1404 may include any of a variety of computer-readable media. Computer-readable media may be any available media that can be accessed by computing device 1400. Computer-readable media may include volatile and non-volatile media, as well as removable and non-removable media. By way of example and not limitation, computer-readable media may include computer storage media and communication media.
[0154] Computer storage media may include volatile and nonvolatile media and / or removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules, and / or other data types. For example, memory 1404 may store computer readable instructions (e.g., representing programs and / or program elements, such as an operating system). Computer storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by computing device 1400. As used herein, computer storage media does not include the signals themselves.
[0155] Computer storage media may include computer readable instructions, data structures, program modules, and / or other data types in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information delivery media. The term "modulated data signal" may refer to a signal that has one or more of its characteristics set or changed in such a way that information is encoded into the signal. By way of example and not limitation, computer storage media may include wired media such as a wired network or a direct wired connection, and wireless media such as sound, RF, infrared, and other wireless media. Any combination of the above should also be included within the scope of computer readable media.
[0156] The CPU 1406 may be configured to execute computer-readable instructions to control one or more components of the computing device 1400 to perform one or more of the methods and / or processes described herein. Each of the CPUs 1406 may include one or more cores (e.g., one, two, four, eight, twenty-eight, seventy-two, etc.) capable of processing multiple software threads simultaneously. The CPU 1406 may include any type of processor, and may include different types of processors, depending on the type of computing device 1400 implemented (e.g., a processor with fewer cores for mobile devices and a processor with more cores for servers). For example, depending on the type of computing device 1400, the processor may be an Advanced RISC Machine (ARM) processor implemented using Reduced Instruction Set Computing (RISC) or an x86 processor implemented using Complex Instruction Set Computing (CISC). The computing device 1400 may also include one or more CPUs 1406 in addition to one or more microprocessors or supplementary coprocessors such as math coprocessors.
[0157] GPU 1408 can be used by computing device 1400 to render graphics (e.g., 3D graphics) or perform general-purpose computing. For example, GPU 1408 can be used for general-purpose computing on GPU (GPGPU). GPU 1408 can include hundreds or thousands of cores capable of processing hundreds or thousands of software threads simultaneously. GPU 1408 can generate pixel data of output image in response to rendering command (e.g., rendering command from CPU 1406 received via host interface). GPU 1408 can include graphics memory (e.g., display memory) for storing pixel data or any other suitable data (e.g., GPGPU data). Display memory can be included as part of memory 1404. GPU 1408 can include two or more GPUs operating in parallel (e.g., via a link). Links can directly connect GPUs (e.g., using NVLINK) or can connect GPUs through switches (e.g., using NVSwitch). When combined together, each GPU 1408 can generate pixel data or GPGPU data for different parts or different outputs for output (e.g., a first GPU for a first image and a second GPU for a second image). Each GPU may include its own memory, or may share memory with other GPUs.
[0158] The communication interface 1410 may include one or more receivers, transmitters, and / or transceivers that enable the computing device 1400 to communicate with other computing devices via an electronic communication network, including wired and / or wireless communications. The communication interface 1410 may include components and functionality that enable communication over any of a number of different networks, such as a wireless network (e.g., Wi-Fi, Z-wave, Bluetooth, Bluetooth LE, ZigBee, etc.), a wired network (e.g., via Ethernet or wireless broadband communications), a low power wide area network (e.g., LoRaWAN, SigFox, etc.), and / or the Internet.
[0159] I / O ports 1412 can enable computing device 1400 to be logically coupled to other devices including I / O components 1414, presentation components 1418, and / or other components, some of which can be built into (e.g., integrated into) computing device 1400. Illustrative I / O components 1414 include microphones, mice, keyboards, joysticks, game pads, game controllers, satellite dishes, scanners, printers, wireless devices, and the like. I / O components 1414 can provide a natural user interface (NUI) that processes air gestures, voice, or other physiological inputs generated by a user. In some examples, the input can be transmitted to an appropriate network element for further processing. NUI can implement any combination of voice recognition, stylus recognition, facial recognition, biometric recognition, gesture recognition on and adjacent to the screen, air gestures, head and eye tracking, and touch recognition associated with the display of computing device 1400 (as described in more detail below). Computing device 1400 may include a depth camera such as a stereo camera system, an infrared camera system, an RGB camera system, touch screen technology, and combinations of these for gesture detection and recognition. Additionally, computing device 1400 may include an accelerometer or gyroscope to enable motion detection (e.g., as part of an inertial measurement unit (IMU)). In some examples, the output of the accelerometer or gyroscope may be used by computing device 1400 to render immersive augmented reality or virtual reality.
[0160] The power supply 1416 may include a hardwired power supply, a battery power supply, or a combination thereof. The power supply 1416 may provide power to the computing device 1400 to enable the components of the computing device 1400 to operate.
[0161] The presentation component 1418 may include a display (e.g., a monitor, a touch screen, a television screen, a head-up display (HUD), other display types, or a combination thereof), a speaker, and / or other presentation components. The presentation component 1418 may receive data from other components (e.g., GPU 1408, CPU 1406, etc.) and output the data (e.g., as an image, video, sound, etc.).
[0162] The present disclosure may be described in the general context of machine-usable instructions or computer codes executed by a computer or other machine such as a personal digital assistant or other handheld device, including computer-executable instructions such as program modules. Typically, program modules including routines, programs, objects, components, data structures, etc. refer to codes that perform specific tasks or implement specific abstract data types. The present disclosure may be practiced in a variety of system configurations, including handheld devices, consumer electronics, general-purpose computers, more specialized computing devices, etc. The present disclosure may also be practiced in a distributed computing environment in which tasks are performed by remote processing devices linked through a communication network.
[0163] As used herein, the description of "and / or" with respect to two or more elements should be interpreted as referring to only one element or a combination of elements. For example, "element A, element B, and / or element C" may include only element A, only element B, only element C, element A and element B, element A and element C, element B and element C, or elements A, B, and C. In addition, "at least one of element A or element B" may include at least one of element A, at least one of element B, or at least one of element A and at least one of element B.
[0164] The subject matter of the present disclosure is described in detail herein to meet statutory requirements. However, the description itself is not intended to limit the scope of the present disclosure. On the contrary, the inventors have contemplated that the claimed subject matter may also be embodied in other ways to include steps different from the steps described herein in conjunction with other current or future technologies or combinations of similar steps. Moreover, although the terms "step" and / or "block" may be used herein to imply different elements of the method employed, these terms should not be interpreted as implying any particular order among or between the various steps disclosed herein, unless the order of the steps is explicitly described.
Claims
1. A method comprising: Receiving, by a graphics processing unit (GPU), portions of a build table from a plurality of GPUs; reading entries of the portion of the build table, wherein the plurality of GPUs are assigned respective partitions of the hash table representing respective portions of the hash table, and the GPU is assigned at least one of the hash table partitions; calculating a global location identifier from the entries in the portion of the build table, the global location identifier corresponding to one or more locations in the hash table; performing, by the GPU, insertion of the entry into the hash table partition based at least on a determination, based on the global location identifier, that the entry corresponds to the at least one hash table partition assigned to the GPU; and probing, by the GPU, at least a portion of the hash table using at least a portion of a probe table to produce one or more results. 2 . The method of claim 1 , wherein the one or more results comprise outputs of a join operation performed as part of executing a query on a relational database. 3 . The method of claim 1 , wherein the performing of the inserting is based on determining that a hash value of one or more keys of the entry falls within the at least one hash table partition assigned to the GPU. 4 . The method of claim 1 , wherein the global location identifier is a global hash index identifying a location of the entry in the hash table.
5. The method according to claim 1, further comprising: filtering, by the GPU, entries from the portion of the build table based on the global location identifier and generating a filtered portion of the build table that does not include entries for the GPU; and sending the filtered portion of the build table to a different GPU among the plurality of GPUs, the sending causing one or more insertions of one or more entries in the filtered portion of the build table into the hash table.
6. The method according to claim 1, further comprising: After inserting the entry into the at least one hash table partition, two or more hash table partitions of the hash table are merged across the multiple GPUs to form a fully replicated copy of the hash table on each GPU in the multiple GPUs, wherein the at least a portion of the hash table used in the probe is the fully replicated copy of the hash table on the GPU.
7. The method of claim 1, wherein the at least a portion of the hash table used in the probing is the at least one hash table partition assigned to the GPU.
8. The method of claim 1, wherein the portion of the build table is received from a different GPU among the plurality of GPUs based at least on the entry being determined to correspond to the at least one hash table partition assigned to the GPU.
9. The method according to claim 1, wherein: The received portion of the build table is in a first buffer of the GPU, the first buffer is used to analyze the entries in an iteration of the GPU, the GPU iteratively analyzes the entries of the build table for insertion into the hash table, and the method also includes: receiving different portions of the build table from different GPUs of the multiple GPUs at a second buffer of the GPU, the second buffer is used in the iteration as a staging buffer for subsequent iterations in which the GPU iteratively analyzes the entries of the build table for insertion into the hash table.
10. A method comprising: Receiving, by a first graphics processing unit (GPU), a portion of a build table, the first GPU being from a plurality of GPUs; reading first data from entries in the portion of the build table, wherein the plurality of GPUs are assigned respective partitions of the hash table representing respective portions of the hash table and a second GPU of the plurality of GPUs is assigned at least one of the hash table partitions; calculating a global location identifier based on the first data read from the entries in the portion of the build table, the global location identifier corresponding to one or more locations in the hash table; sending, by the first GPU, second data representing at least the entry for inserting the entry into the hash table partition at the second GPU based at least on determining, based on the global location identifier, the entry corresponding to the hash table partition assigned to the second GPU; and probing, by the first GPU, at least a portion of the hash table using at least a portion of the probe table to produce one or more results. 11 . The method of claim 10 , wherein sending the second data comprises directing, by the first GPU, remotely at the second GPU, the insertion of the entry in the hash table partition.
12. The method of claim 10, wherein sending the data comprises: The second data is sent to a buffer of the second GPU or a third GPU among the plurality of GPUs, the third GPU being a GPU different from the first GPU or the second GPU.
13. The method of claim 10, wherein the second data represents a plurality of entries of the portion of the build table, and the plurality of entries includes the entry.
14. The method according to claim 10, wherein the second data is sent to a third GPU among the plurality of GPUs, the third GPU is a GPU different from the first GPU or the second GPU, and the third GPU is determined by a ring exchange or a hierarchical exchange between the plurality of GPUs.
15. A system comprising: A plurality of graphics processing units (GPUs) for performing a collaborative build of a hash table from a build table, wherein the plurality of GPUs are assigned respective hash table partitions representing respective portions of a hash table, and wherein each of the plurality of GPUs is configured to: read data from an entry of the portion of the build table; determine a global location identifier from the data read from the entry of the respective portion of the build table, the global location identifier corresponding to one or more locations of the hash table, wherein the entry is inserted into the hash table partition of the hash table at the designated GPU based at least on determining the entry corresponding to the respective hash table partition assigned to the designated GPU according to the global location identifier.
16. The system of claim 15, wherein when a first GPU of the plurality of GPUs determines that the designated GPU is different from the first GPU based on the global location identifier, the first GPU provides data representing at least the entry to a different GPU of the plurality of GPUs. 17 . The system of claim 15 , wherein when a first GPU of the plurality of GPUs determines that the first GPU is the designated GPU based on the global location identifier, the first GPU performs the insertion of the entry at the first GPU.
18. The system of claim 15, wherein the plurality of GPUs are logically arranged in a ring, and the constructing further comprises: Each GPU of the plurality of GPUs provides data representing a plurality of entries of the respective portion of the build table to an adjacent GPU in the ring.
19. The system of claim 15, wherein at least one GPU of the plurality of GPUs performs inserting the entry into the hash table partition remotely at the designated GPU.
20. The system of claim 15, wherein each of the plurality of GPUs provides data representing a plurality of entries of the corresponding portion of the build table to another GPU determined by a hierarchical exchange between the plurality of GPUs.
21. The system of claim 15, wherein the global location identifier comprises a GPU identifier calculated using a key of the entry.
22. The system of claim 15, wherein the global location identifier corresponds to an output of one or more equations that define a first hash table partition of the hash table to be assigned to a first GPU of the plurality of GPUs for a first one or more insertions of a first one or more entries of the build table, and define a second hash table partition of the hash table to be assigned to a second GPU of the plurality of GPUs for a second one or more insertions of a second one or more entries of the build table.
Citation Information
Patent Citations
Character string matching method and system based on graphic processing unit (GPU) heterogeneous computing platform
CN103559017A
Extent hashing technique for distributed storage architecture
CN105612490A
Federated search
CN106415540A
Dedicated mechanism for page mapping in a GPU
US20080028181A1
System, method and computing device for detecting duplicate financial documents
US20090285471A1
