SIMD 2MIN/2MAX Instructions for Branch-Efficient Huffman Coding

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The generation of Huffman codes in compression algorithms like DEFLATE is bottlenecked by the inefficiency of traditional software implementations using heap data structures, which lead to performance issues due to data-dependent branch predictions on modern processors.

Innovation Solution

The introduction of hardware-based instructions such as Compute-2MIN and Compute-2MAX to find the two smallest or largest values in an array, allowing for well-predicted operations that replace data-dependent branches, improving computational efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional software implementations using heap data structures are used to compute Huffman codes, then the algorithm can handle general cases with arbitrary numbers of elements, but the performance is limited due to data-dependent branch mispredictions on modern processors

Engineering Contradiction:
ImproveHuffman code generation speedVSAvoidBranch misprediction penalty
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent replaces the traditional software-based heap data structure with a hardware-based instruction (Compute-2MIN/Compute-2MAX) that directly computes the minimum or maximum of two values in a single CPU cycle. This substitution eliminates the need for complex software heap operations and their associated data-dependent branches, thereby resolving the performance limitation caused by branch mispredictions while maintaining the ability to handle general Huffman coding cases.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Productivity

If hardware-based instructions like Compute-2MIN and Compute-2MAX are introduced to find extreme values, then computational efficiency improves by replacing data-dependent branches, but the device complexity increases

Engineering Contradiction:
ImproveCode computation speedVSAvoidInstruction set architecture complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent segments the Huffman code generation process into discrete, manageable steps that can be executed by simple hardware instructions. Instead of implementing a complex general-purpose heap data structure in software, the solution breaks down the problem into atomic operations (finding min/max of two values) that can be performed by dedicated hardware instructions. This segmentation allows the system to achieve high performance through simple, predictable operations while keeping the overall device complexity manageable.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS10379854B2Processor instructions for determining two minimum and two maximum values
Publication Date: 2019.08.13 INTEL CORP
  • US10379854B2 patent drawing
  • US10379854B2 patent drawing
  • US10379854B2 patent drawing

AI summary

Processor instructions for determining two minimum and two maximum values and associated apparatus and methods. The instructions include various 2MIN instructions for determining the two smallest values among three or four input values and 2MAX instructions for determining the two largest values among three or four input values. The 2MIN instructions employ two operands, with the first operand in some of the variations storing concatenated min1 and min2 values in a first register and a scr2 comparison value or two src2 concatenated src2 values in a second register. Comparators are used to implement hardware logic for determining whether the scr2 value(s) is/are less than each of min1 and min2. Based on the hardware logic, the smallest two values among min1, min2, and src2 (or both src2 values) are stored as concatenated values in the first register. The 2MAX instructions are implemented in a similar manner, except the comparisons are whether the scr2 value(s) is/are greater than each of max1 and max2 values. 128-bit 2MIN and 2MAX SIMD instructions are also provided for processing two 64-bit data-paths in parallel.