# US 12,182,552 B2 · Splitting vector processing loops with an unknown trip count

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,182,552 B2
- Document ID: US12182552B2
- Status: Granted
- Kind: B2
- Application number: 17/664,858
- Filed: 2022-05-24
- Published: 2023-11-30
- Granted: 2024-12-31
- Earliest claimed: 2022-05-24
- Assignees: Xilinx, Inc.
- Applicants: Xilinx, Inc.
- Inventors: Ajit K. Agarwal
- Web page: https://patentgrep.com/patent/US12182552B2

## CPC

- G06F 8/443: {Optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-based technique for processing an application includes determining that a loop of the application includes a reference to a data item of a vector data type. A trip count of the loop is determined to have an unknown trip count. The loop is split into a first loop and a second loop based on a splitting factor. The second loop is unrolled.

## Claims

### Claim 1

A method, comprising:
detecting, using computer hardware, that a loop of an application refers to one or more data items each of a vector data type;
wherein a trip count of the loop is unknown;
selecting, from the one or more data items, a selected data item having a largest number of elements based on a number of elements of each data item of the vector data type of the loop and using the number of elements of the selected data item as a splitting factor;
splitting, using the computer hardware, the loop into a first loop and a second loop based on the splitting factor; and
unrolling, using the computer hardware, the second loop.

### Claim 2 (depends on 1)

The method of claim 1, wherein the application is initially specified as source code, the method further comprising:
first converting the source code into an intermediate representation.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
compiling the application into executable program code.

### Claim 4 (depends on 1)

The method of claim 1, wherein the first loop has an unknown trip count and the second loop has a known trip count.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
modifying a control flow construct of the first loop by decrementing a loop control condition of the control flow construct of the first loop by the splitting factor.

### Claim 6 (depends on 4)

The method of claim 4, further comprising:
modifying a control flow construct of the second loop to have a loop control condition equal to the splitting factor.

### Claim 7 (depends on 4)

The method of claim 4, wherein the first loop dominates the second loop and the second loop post dominates the first loop.

### Claim 8

A system, comprising:
a processor configured to initiate operations including:
detecting that a loop of an application refers to one or more data items each of a vector data type;
wherein a trip count of the loop is unknown;
selecting, from the one or more data items, a selected data item having a largest number of elements based on a number of elements of each data item of the vector data type of the loop and using the number of elements of the selected data item as a splitting factor;
splitting the loop into a first loop and a second loop based on the splitting factor; and
unrolling the second loop.

### Claim 9 (depends on 8)

The system of claim 8, wherein the application is initially specified as source code, and wherein the processor is configured to initiate operations comprising:
first converting the source code into an intermediate representation.

### Claim 10 (depends on 8)

The system of claim 8, wherein the first loop has an unknown trip count and the second loop has a known trip count.

### Claim 11 (depends on 8)

The system of claim 8, wherein the processor is configured to initiate operations comprising:
compiling the application into executable program code.

### Claim 12 (depends on 10)

The system of claim 10, wherein the processor is configured to initiate operations comprising:
modifying a control flow construct of the first loop by decrementing a loop control condition of the control flow construct of the first loop by the splitting factor.

### Claim 13 (depends on 10)

The system of claim 10, wherein the processor is configured to initiate operations comprising:
modifying a control flow construct of the second loop to have a loop control condition equal to the splitting factor.

### Claim 14 (depends on 10)

The system of claim 10, wherein the first loop dominates the second loop and the second loop post dominates the first loop.

### Claim 15

A computer program product, comprising:
one or more computer-readable storage mediums, and program instructions collectively stored on the computer-readable storage mediums, wherein the program instructions are executable by computer hardware to initiate operations including:
detecting, using computer hardware, that a loop of an application refers to one or more data items each of a vector data type;
wherein a trip count of the loop is unknown;
selecting, from the one or more data items, a selected data item having a largest number of elements based on a number of elements of each data item of the vector data type of the loop and using the number of elements of the selected data item as a splitting factor;
splitting the loop into a first loop and a second loop based on a splitting factor; and
unrolling the second loop.

### Claim 16 (depends on 15)

The computer program product of claim 15, wherein the application is initially specified as source code, and wherein the program instructions are executable by computer hardware to initiate operations including:
first converting the source code into an intermediate representation.

### Claim 17 (depends on 15)

The computer program product of claim 15, wherein the first loop has an unknown trip count and the second loop has a known trip count.

### Claim 18 (depends on 15)

The computer program product of claim 15, wherein the program instructions are executable by computer hardware to initiate operations including:
modifying a control flow construct of the first loop by decrementing a loop control condition of the control flow construct of the first loop by the splitting factor; and
modifying a control flow construct of the second loop to have a loop control condition equal to the splitting factor.

### Claim 19 (depends on 17)

The computer program product of claim 17, wherein the first loop dominates the second loop and the second loop post dominates the first loop.
