# US 2025/0085943 A1 · Optimizing instruction scheduling and memory allocation for tensor and graphical processors using lattice image data structure optimizations

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

- Number: US 2025/0085943 A1
- Document ID: US20250085943A1
- Status: Published application
- Kind: A1
- Application number: 18/465,492
- Filed: 2023-09-12
- Published: 2025-03-13
- Earliest claimed: 2023-09-12
- Assignees: Groq, Inc.
- Applicants: Groq, Inc.
- Inventors: Samir Jindel
- Web page: https://patentgrep.com/patent/US20250085943A1

## CPC

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

## Abstract

Optimizing instruction scheduling and memory allocation for tensor and graphical processors using lattice image data structure optimizations is provided. A method of using a loop fusion by a compiler in interconnected accelerator units to simplify a machine learning (ML) graph representing a program to be compiled is provided. The method includes (A) lowering a plurality of operations in an initial first program to an original plurality of at least two loops. The method also includes (B) inferring a fused loop structure from the original plurality of at least two loops in the initial first program thus creating a second program having the fused loop. The fused loop in the second program is pipelining the multiplication and addition operations thus significantly reducing the memory bandwidth requirements and improving cache locality.

## Claims

### Claim 1

A compiler process that reduces the number of variables in a program code representing relations of operations across long chains of tensor program operations such that the use of kernels at the lowest levels of program compilation can be eliminated, the process comprising a lattice image data structure for representing these relations in a tensor program code, and an algorithm that combines these relations while minimizing dimensionality of the integer sets and lattice images.

### Claim 2 (depends on 1)

The compiler of claim 1 wherein the algorithm is a KCA algorithm.

### Claim 3 (depends on 2)

The compiler of claim 2, wherein the KCA algorithm infers a low-dimensional shape of points from the hidden dimension set to reduce the hidden dimension of the resulting set or relation.

### Claim 4 (depends on 2)

The compiler of claim 2, wherein the KCA algorithm iteratively modifies the starting lattice basis until a desired property is achieved.

### Claim 5 (depends on 2)

The compiler of claim 2, wherein the KCA algorithm is run iteratively to validate a candidate shape or find missing points and to use missing points to improve the lattice basis.

### Claim 6

A method of using a loop fusion by a compiler in interconnected accelerator units to simplify a machine learning (ML) graph representing a program to be compiled, said method comprising:
(A) lowering a plurality of operation in said initial first program to an original plurality of at least two loops;
and
(B) inferring a fused loop structure from said original plurality of at least two loops in said initial first program thus creating a second program having said fused loop, wherein said fused loop in said second program is pipelining the multiplication and addition operations thus significantly reducing the memory bandwidth requirements and improving cache locality.

### Claim 7 (depends on 6)

The method of claim 6, wherein said interconnected accelerator units are selected from the group consisting of: a computer chip; a TSP chip; and a GROQ chip.

### Claim 8 (depends on 6)

The method of claim 6, wherein said step (B) further comprises:
(B1) expressing indexing logic in said original plurality of loops in said initial first program as lattice relations.

### Claim 9 (depends on 7)

The method of claim 7, wherein said step (B1) further comprises:
(B1, 1) calculating the hidden dimensions of the bijection between the iteration spaces of at least two initial loops.

### Claim 10 (depends on 8)

The method of claim 8, wherein said step (B1, 1) further comprises:
(B1, 1, 1) applying Kernel Characterization Algorithm (KCA) to said lattice relations.

### Claim 11 (depends on 10)

The method of claim 10, wherein said KCA algorithm infers a low-dimensional shape of points from said hidden dimension set, thus reducing the hidden dimension of the resulting set or relation.

### Claim 12 (depends on 10)

The method of claim 10, wherein said KCA algorithm comprises the following steps:
(C) validating a candidate lattice basis;
and
(D) using the missing points to improve said candidate lattice basis.

### Claim 13 (depends on 12)

The method of claim 12, wherein said step (C)) further comprises:
(C1) using Integer Linear Programming to validate said candidate lattice basis.

### Claim 14

An apparatus enabling a compiler in interconnected accelerator units to simplify a machine learning (ML) graph representing a program to be compiled, said method comprising:
(A) a means for lowering a plurality of operations in an initial first program to an original plurality of at least two loops;
and
(B) a means for inferring a fused loop structure from said original plurality of at least two loops in said initial first program thus creating a second program having said fused loop, wherein said fused loop in said second program is pipelining the multiplication and addition operations thus significantly reducing the memory bandwidth requirements and improving cache locality.

### Claim 15 (depends on 14)

The apparatus of claim 14, wherein aid mean (B) further comprises:
(B1) a Kernel Characterization Algorithm (KCA) configured to calculate the hidden dimensions of the bijection between the iteration spaces of at least two initial loops.
