Prime Factorization Hash Operation for Cache Adaptability
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing modulo hash operations for non-powers of two are computationally expensive due to complex arithmetic operations like division and multiplication, which are slower than bitwise operations, making them inefficient for performance-critical scenarios.
Innovation Solution
The prime factorization hash operation is subdivided into two computationally efficient hashing operations, where a large number is hashed into a product of a prime number and a power of two, using a first modulo operation to determine most significant bits and a second operation, such as XOR, to determine the remaining bits, allowing efficient hashing even when cache sizes or bins do not correspond to powers of two.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If traditional modulo hashing is used for non-power-of-two cache sizes, then the hashing can handle arbitrary cache configurations, but the computational complexity increases due to division and multiplication operations
Solution Approach 1:
The patent segments the hashing operation into two distinct phases: a first hashing operation that processes most significant bits using a prime number modulo, and a second hashing operation that processes remaining bits using a power-of-two modulo. This segmentation allows each phase to use optimized operations suitable for its specific purpose, resolving the contradiction between handling arbitrary cache sizes and maintaining computational simplicity.
Solution Approach 2:
The patent replaces complex mechanical arithmetic operations (division and multiplication) with more efficient bitwise operations. Specifically, the second hashing operation uses bitwise AND operations instead of division by a power of two, and the first hashing operation uses a pre-computed magic number multiplication that is more efficient than general division. This substitution maintains adaptability while reducing computational complexity.
2Measurement precision
If complex arithmetic operations are used for non-power-of-two hashing, then accurate hash distribution is achieved, but the execution speed decreases
Solution Approach 1:
The hashing operation is divided into two sequential phases that together achieve accurate hash distribution while maintaining speed. The first phase uses a prime number modulo to ensure good distribution properties for arbitrary cache sizes, while the second phase uses efficient power-of-two modulo to complete the hashing. This segmentation allows the system to achieve both accuracy and speed by optimizing each phase for its specific function.
Solution Approach 2:
The patent changes the parameters of the hashing operation by using a composite modulus that is the product of a prime number and a power of two. This parameter change allows the use of efficient bitwise operations for the power-of-two portion while maintaining the distribution properties of prime number hashing, thereby achieving both accuracy and speed.
3Speed
If power-of-two modulo operations are used, then fast bitwise operations are achieved, but the cache configuration is limited to power-of-two sizes
Solution Approach 1:
The patent segments the modulo operation into two parts: one that handles the power-of-two portion using fast bitwise operations, and another that handles the prime number portion using efficient multiplication with a pre-computed magic number. This segmentation allows the system to achieve both the speed of power-of-two operations and the flexibility of arbitrary cache sizes by combining the strengths of both approaches.
Solution Approach 2:
The patent merges two different hashing approaches into a single composite operation. The first hashing operation combines prime number modulo with bitwise operations, and the second hashing operation combines power-of-two modulo with bitwise AND operations. This merging allows the system to achieve both speed and flexibility by integrating the advantages of both methods into a unified hashing function.
Data Source
AI summary
A technique for improving performance of a hash operation on a processor is provided, in which an input value is hashed into a second value corresponding to a number of bins. The number of bins is an integer that corresponds to a product of first and second integers, the first integer corresponding to a prime number and the second integer corresponding to a power of two. A first modulo hashing operation is performed in which the input value is hashed into the first integer. A second hashing operation is performed using less than all bits of the input value. An output value is formed by concatenating a result of the first hashing operation with a result of the second hashing operation.


