# US 2026/0037174 A1 · Method for Optimizing Memory Access Based on Machine Learning Model and Related Device

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

- Number: US 2026/0037174 A1
- Document ID: US20260037174A1
- Status: Published application
- Kind: A1
- Application number: 18/793,937
- Filed: 2024-08-04
- Published: 2026-02-05
- Earliest claimed: 2024-08-04
- Assignees: Mediatek Inc.
- Applicants: Mediatek Inc.
- Inventors: Meng-Hsuan Yang; Yu-Chen Lin; Hsing-Chang Chou; Po-Hua Huang
- Web page: https://patentgrep.com/patent/US20260037174A1

## CPC

- G06F 3/0655: {Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices}
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 3/0673: {Single storage device}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for optimizing memory access based on a machine learning model is provided. The method includes converting a portion of the machine learning model corresponding to an operation requirement of a hardware into a directed acyclic graph, wherein the portion of the machine learning model comprises multiple fusions, and the directed acyclic graph comprises a plurality of vertexes and a plurality of directed edges, wherein the edge ei,j is the edge from the vertex Vi to vertex Vj, and the value of the edge ei,j is set to indicate a total amount of DRAM accesses from an input of fusioni to an output of fusionj-1, and, where i, j are positive integers and j is larger than i; and determining a shortest path, wherein the shortest path represents the path from a starting vertex to a destination vertex with a smallest total amount of DRAM accesses.

## Claims

### Claim 1

A method for optimizing memory access, comprising:
converting a portion of a machine learning model corresponding to an operation requirement of a hardware into a directed acyclic graph; wherein the portion of the machine learning model comprises multiple fusions, and the directed acyclic graph comprises a plurality of vertexes and a plurality of directed edges,
wherein the edge ei,j is the edge from the vertex Vi to vertex Vj, and the value of the edge ei,j is set to indicate a total amount of an external memory access from an input of fusioni to an output of fusionj-1, and, wherein i, j are positive integers and j is larger than i, and wherein the external memory is located outside of the hardware; and
determining a shortest path, wherein the shortest path represents the path from a starting vertex to a destination vertex with a smallest total amount of external memory accesses, wherein the staring vertex does not have an input edge, and the destination vertex does not have an output edge.

### Claim 2 (depends on 1)

The method of claim 1, wherein, the edge ei,j is used for indicating the data that needs to be transferred between the fusions in a fusion set from fusioni to fusionj-1 is stored in a cache, rather than the external memory, when j−1 is larger than i.

### Claim 3 (depends on 1)

The method of claim 1, wherein the external memory is a DRAM (dynamic random access memory).

### Claim 4 (depends on 1)

The method of claim 1, wherein the step of determining the shortest path from a staring vertex to a destination vertex comprising:
determining the shortest path from the staring vertex to the destination vertex by a topological sorting method.

### Claim 5 (depends on 4)

The method of claim 4, the step of determining the shortest path from the staring vertex to the destination vertex by a topological sorting method comprising:
determining a value of a visiting vertex of the start vertex, wherein, the visiting vertex is connected to the start vertex through an output edge of the start vertex at step S1;
determining the visiting vertex without an unvisited input edge as a current vertex at step S2;
determining a value of a visiting vertex of the current vertex at step S3, wherein the visiting vertex is connected to the current vertex through an output edge of the current vertex; and
repeating the step S2 and S3 until all vertices have been visited and there are no unvisited edges.

### Claim 6 (depends on 5)

The method of claim 5, further comprising: an initial value of the starting vertex is set to 0 and an initial value of the non-starting vertex is set to a large value.

### Claim 7 (depends on 5)

The method of claim 5, the step of determining a value of a visiting vertex of the current vertex comprising:
adding the value of the edge from the current vertex to the visiting vertex and a current value of the current vertex to obtain a sum value;
updating the current value of the visiting vertex to the sum value if the sum value is smaller than the current value of the visiting vertex; and
keeping the current value of the visiting vertex unchanged if the sum value is not smaller than the current value of the visiting vertex.

### Claim 8 (depends on 1)

The method of claim 1, wherein the shortest path represents the path from the starting vertex to the destination vertex on which the sum of the values of the edges in the path is smallest.

### Claim 9 (depends on 3)

The method of claim 3, wherein the value of the vertex Vi is used for indicating the total amount of DRAM access from the input of fusion0 to the output of fusioni-1.

### Claim 10 (depends on 3)

The method of claim 3, converting a portion of the machine learning model corresponding to an operation requirement of a hardware into a directed acyclic graph comprising:
building the plurality of vertices with sequential numbers, wherein the number of the vertices is equal to the number of fusions in the portion of the machine learning model plus one;
building a directed base edge between two vertices with adjacent numbers, wherein the directed base edge is set to indicate a total amount of DRAM accesses of the corresponding single fusion; and
building a directed direct edge between two vertices with non-adjacent numbers, wherein the directed direct edge is set to indicate a total amount of DRAM accesses from an input of one fusion to an output of another fusion, and the data that needs to be transferred between the fusions in a fusion set from the one fusion to another fusion is not stored in the DRAM.

### Claim 11 (depends on 10)

The method of claim 10, wherein the data that needs to be transferred between the fusions in a fusion set from the one fusion to another fusion is stored in a cache.

### Claim 12 (depends on 10)

The method of claim 10, further comprising:
determining whether the directed direct edge is built is based on a capacity of the cache;
wherein if the cache has the capacity to store the data that needs to be transferred between the fusions in the fusion set from one fusion to another fusion, then the directed direct edge is built; if the cache does not have the capacity to store the data that needs to be transferred between the fusions in a fusion set from one fusion to another fusion, then the directed direct edge is not built.

### Claim 13

A device, comprising:
a processor; and
a memory storing instructions, wherein the instructions are performed by the processor to perform:
convert a portion of a machine learning model corresponding to an operation requirement of a hardware into a directed acyclic graph, wherein the portion of the machine learning model comprises multiple fusions, and the directed acyclic graph comprises a plurality of vertices and a plurality of directed edges, wherein an edge ei,j is from a vertex Vi to a vertex Vj, and a value of the edge ei,j is set to indicate a total amount of an external memory accesses from an input of fusioni to an output of fusionj-1, where i, j are positive integers and j is larger than i, and wherein the external memory is located outside of the hardware; and
determine a shortest path, wherein the shortest path is from a starting vertex to a destination vertex with a smallest total amount of external memory accesses, wherein the starting vertex does not have an input edge, and the destination vertex does not have an output edge.

### Claim 14 (depends on 13)

The device of claim 13, wherein the edge ei,j is used for indicating data that needs to be transferred between fusions in a fusion set from fusioni to fusionj-1 is stored in a cache, rather than the external memory, when j−1 is larger than i.

### Claim 15 (depends on 13)

The device of claim 13, wherein the external memory is a DRAM (dynamic random access memory).

### Claim 16 (depends on 13)

The device of claim 13, wherein the processor is configured to determine the shortest path from the starting vertex to the destination vertex by using a topological sorting method.

### Claim 17 (depends on 16)

The device of claim 16, wherein the processor is further configured to:
update a value of a visiting vertex of the starting vertex, wherein the visiting vertex is connected to the starting vertex through an output edge of the starting vertex;
determine the visiting vertex without an unvisited input edge as a current vertex; and
determine a value of a visiting vertex of the current vertex, wherein the visiting vertex is connected to the current vertex through an output edge of the current vertex, and
repeating the step of determining the visiting vertex without an unvisited input edge as a current vertex and the step of determining a value of a visiting vertex of the current vertex until all vertices have been visited and there are no unvisited edges.

### Claim 18 (depends on 17)

The device of claim 17, wherein the processor is further configured to set an initial value of the starting vertex to 0, and an initial value of a non-starting vertex to a large value.

### Claim 19 (depends on 17)

The device of claim 17, wherein in determining a value of a visiting vertex of the current vertex, the processor is configured to perform:
a value of an edge from the current vertex to the visiting vertex is added to a current value of the current vertex to obtain a sum value;
a current value of the visiting vertex is updated to the sum value if the sum value is smaller than the current value of the visiting vertex; and
the current value of the visiting vertex is retained if the sum value is not smaller than the current value of the visiting vertex.

### Claim 20 (depends on 13)

The device of claim 13, wherein the shortest path represents a path from the starting vertex to the destination vertex on which a sum of values of edges in the path is smallest.
