RISC-V Byte Comparison Instruction for String Processing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current processor architectures, such as ARM and MIPS, lack high-performance dedicated instructions for string processing, leading to inefficiencies in natural language processing and text retrieval, which are critical for AI applications.

Innovation Solution

Incorporating a byte comparison instruction, such as 'tstnbz', as an extended instruction in the RISC-V architecture, allowing for efficient comparison of each byte of a source string with an ending identifier, reducing the number of instructions needed for string comparison and improving processing speed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional processor architectures (ARM, MIPS) are used without dedicated string processing instructions, then the architecture remains simple and easy to manufacture, but string processing efficiency is poor and execution time is long

Engineering Contradiction:
Improvestring processing efficiencyVSAvoidinstruction set complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent segments the string processing task into distinct operational phases: loading string data into registers, executing byte-by-byte comparison instructions to identify ending identifiers, and storing results. This segmentation allows the processor to handle string processing in manageable, efficient steps while maintaining architectural simplicity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary actions by loading entire string data into registers before processing begins. This pre-positioning of data in high-speed register memory eliminates repeated memory access during comparison operations, significantly improving execution speed without requiring complex memory management hardware.

Inventive Principle:
Principle #10Preliminary action

2Speed

If byte-by-byte comparison is performed using traditional instructions, then accuracy in locating ending identifiers is maintained, but the number of instructions required increases and processing speed decreases

Engineering Contradiction:
Improveprocessing speedVSAvoidexecution time
Core Design Contradiction:
SpeedVSLoss of time

Solution Approach 1:

The patent implements continuous useful action through dedicated byte comparison instructions that operate continuously on register data without interruption. The comparison operation proceeds byte-by-byte through the entire string in an unbroken sequence, maximizing processor utilization and eliminating idle cycles between operations.

Inventive Principle:
Principle #20Continuity of useful action

Solution Approach 2:

The patent employs skipping by directly comparing bytes against ending identifier values and immediately proceeding to the next byte without unnecessary intermediate operations. When an ending identifier is found, the processor rushes through to store the result and terminate the operation, minimizing total execution time.

Inventive Principle:
Principle #21Skipping (Rushing through)

3Reliability

If dedicated string processing instructions are added to the processor, then natural language processing and text retrieval performance improves, but hardware implementation complexity and development cost increase

Engineering Contradiction:
ImproveAI application performanceVSAvoidhardware implementation simplicity
Core Design Contradiction:
ReliabilityVSEase of manufacture

Solution Approach 1:

The patent achieves universality by designing byte comparison instructions that can handle multiple string processing tasks through a single unified operation. The same instruction mechanism serves both exact matching and ending identifier detection, allowing one instruction type to fulfill multiple functional requirements in natural language processing and text retrieval applications.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent implements self-service through automatic result generation and storage. The byte comparison instruction automatically compares input bytes, identifies ending identifiers, and stores results in designated registers without requiring additional control logic or manual intervention, thereby improving AI application reliability while keeping hardware implementation straightforward.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS11640300B2Byte comparison method for string processing and instruction processing apparatus
Publication Date: 2023.05.02 ALIBABA GROUP HOLDING LTD
  • US11640300B2 patent drawing
  • US11640300B2 patent drawing
  • US11640300B2 patent drawing

AI summary

Embodiments of the present disclosure provide an instruction processing apparatus, comprising a first register configured to store a source string, wherein the source string comprises at least one byte, and an execution circuitry, communicatively coupled to the first register and configured to execute a comparison instruction to compare the at least one byte in the source string with an ending identifier to obtain a result value corresponding to the source string, wherein the comparison instruction is executed on each of the at least one byte in the source string and the comparison instruction is an assembly code instruction.