# US 2025/0147744 A1 · Compiler Back-End Reuse Method, Apparatus, Compiler, and Storage Medium

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

- Number: US 2025/0147744 A1
- Document ID: US20250147744A1
- Status: Published application
- Kind: A1
- Application number: 18/823,264
- Filed: 2024-09-03
- Published: 2025-05-08
- Earliest claimed: 2023-11-08
- Assignees: Verisilicon Microelectronics (Chengdu) Co., Ltd.; VeriSilicon Microelectronics (Shanghai) Co., Ltd.; Verisilicon Technology (Shanghai) Co., Ltd.; Verisilicon Microelectronics (Hainan) Co., Ltd.; VeriSilicon Microelectronics (Nanjing) Co., Ltd.
- Applicants: Verisilicon Microelectronics (Chengdu) Co., Ltd.; VeriSilicon Microelectronics (Shanghai) Co., Ltd.; Verisilicon Technology (Shanghai) Co., Ltd.; Verisilicon Microelectronics (Hainan) Co., Ltd.; Verisilicon Microelectronics (Nanjing) Co., Ltd.
- Inventors: Tingting Yu
- Web page: https://patentgrep.com/patent/US20250147744A1

## CPC

- G06F 8/447: {Target code generation}
- G06F 8/41: Compilation
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

Provided are to a compiler back-end reuse method, apparatus, compiler, and computer-readable storage medium. The compiler back-end reuse method includes: acquiring a shader code and being compiled by a compiler front-end to obtain an intermediate code; converting the intermediate code into a target intermediate code of a preset format; converting an original resource identifier corresponding to the intermediate code into a target resource identifier of the preset format; and sending the target intermediate code and the target resource identifier to the compiler back-end to generate a target machine code.

## Claims

### Claim 1

A compiler back-end reuse method, comprising:
acquiring an intermediate code obtained by compiling a shader code by a compiler front-end;
converting the intermediate code into a target intermediate code of a preset format;
converting an original resource identifier corresponding to the intermediate code into a target resource identifier of the preset format; and
sending the target intermediate code and the target resource identifier to the compiler back-end to generate a target machine code.

### Claim 2 (depends on 1)

The compiler back-end reuse method according to claim 1, wherein the step of converting an original resource identifier corresponding to the intermediate code into a target resource identifier of the preset format comprises:
determining an original resource type identifier and an original binding number in the original resource identifier;
converting the original resource type identifier into a target resource type identifier of the preset format; and
converting the original binding number into a target binding number of the preset format.

### Claim 3 (depends on 2)

The compiler back-end reuse method according to claim 2, wherein the step of converting the original resource type identifier into a target resource type identifier of the preset format comprises:
acquiring a preset corresponding relationship, wherein the preset corresponding relationship comprises a corresponding relationship between a resource type identifier of the preset format and resource type identifiers of other formats; and
converting the original resource type identifier into the target resource type identifier according to the preset corresponding relationship.

### Claim 4 (depends on 2)

The compiler back-end reuse method according to claim 2, wherein a format of the original resource type identifier is SPIR-V format, and a format of the target resource type identifier is DXIL format.

### Claim 5 (depends on 2)

The compiler back-end reuse method according to claim 2, wherein the step of converting the original binding number into a target binding number of the preset format comprises:
forming the target binding number after sequentially numbering the same original binding numbers corresponding to different resources.

### Claim 6 (depends on 1)

The compiler back-end reuse method according to claim 1, wherein the compiler back-end reuse method further comprises:
acquiring a useless resource that is not used by the target intermediate code;
acquiring a useless set number of the useless resource, and mapping the useless set number to a preset set number; and
acquiring the useless resource according to the useless set number in the preset set number, and deleting the useless resource.

### Claim 7 (depends on 6)

The compiler back-end reuse method according to claim 6, wherein the compiler back-end reuse method further comprises:
acquiring a read instruction of reading the useless resource according to the useless set number in the preset set number, and deleting the read instruction; or
acquiring a write instruction of writing the useless resource according to the useless set number in the preset set number, and deleting the write instruction; or
acquiring the read instruction of reading the useless resource and the write instruction of writing the useless resource according to the useless set number in the preset set number, and deleting the read instruction and the write instruction.

### Claim 8

A compiler back-end reuse apparatus, comprising:
a communication module, wherein the communication module is configured to acquire an intermediate code obtained by compiling a shader code by a compiler front-end;
an intermediate code conversion module, wherein the intermediate code conversion module is configured to convert the intermediate code into a target intermediate code of a preset format; and
a resource identifier conversion module, wherein the resource identifier conversion module is configured to convert an original resource identifier corresponding to the intermediate code into a target resource identifier of the preset format, wherein
the communication module is further configured to send the target intermediate code and the target resource identifier to the compiler back-end, so as to send the target intermediate code and the target resource identifier to the compiler back-end to generate a target machine code.

### Claim 9 (depends on 8)

A compiler including the compiler back-end reuse apparatus of claim 8, the compiler comprising:
a compiler front-end, wherein the compiler front-end is configured to compile the shader code to obtain the intermediate code;
the compiler back-end reuse apparatus, wherein the compiler back-end reuse apparatus is configured to generate the target intermediate code and the target resource identifier of the preset format according to the intermediate code; and
a compiler back-end, wherein the compiler back-end is configured to generate the target machine code according to the target intermediate code and the target resource identifier.

### Claim 10 (depends on 2)

The compiler back-end reuse method according to claim 2, wherein the compiler back-end reuse method further comprises:
acquiring a useless resource that is not used by the target intermediate code;
acquiring a useless set number of the useless resource, and mapping the useless set number to a preset set number; and
acquiring the useless resource according to the useless set number in the preset set number, and deleting the useless resource.

### Claim 11 (depends on 3)

The compiler back-end reuse method according to claim 3, wherein the compiler back-end reuse method further comprises:
acquiring a useless resource that is not used by the target intermediate code;
acquiring a useless set number of the useless resource, and mapping the useless set number to a preset set number; and
acquiring the useless resource according to the useless set number in the preset set number, and deleting the useless resource.

### Claim 12 (depends on 4)

The compiler back-end reuse method according to claim 4, wherein the compiler back-end reuse method further comprises:
acquiring a useless resource that is not used by the target intermediate code;
acquiring a useless set number of the useless resource, and mapping the useless set number to a preset set number; and
acquiring the useless resource according to the useless set number in the preset set number, and deleting the useless resource.

### Claim 13 (depends on 5)

The compiler back-end reuse method according to claim 5, wherein the compiler back-end reuse method further comprises:
acquiring a useless resource that is not used by the target intermediate code;
acquiring a useless set number of the useless resource, and mapping the useless set number to a preset set number; and
acquiring the useless resource according to the useless set number in the preset set number, and deleting the useless resource.

### Claim 14 (depends on 8)

The compiler back-end reuse apparatus according to claim 8, wherein the step of converting an original resource identifier corresponding to the intermediate code into a target resource identifier of the preset format comprises:
determining an original resource type identifier and an original binding number in the original resource identifier;
converting the original resource type identifier into a target resource type identifier of the preset format; and
converting the original binding number into a target binding number of the preset format.

### Claim 15 (depends on 14)

The compiler back-end reuse apparatus according to claim 14, wherein the step of converting the original resource type identifier into a target resource type identifier of the preset format comprises:
acquiring a preset corresponding relationship, wherein the preset corresponding relationship comprises a corresponding relationship between a resource type identifier of the preset format and resource type identifiers of other formats; and
converting the original resource type identifier into the target resource type identifier according to the preset corresponding relationship.

### Claim 16 (depends on 14)

The compiler back-end reuse apparatus according to claim 14, wherein a format of the original resource type identifier is SPIR-V format, and a format of the target resource type identifier is DXIL format.

### Claim 17 (depends on 14)

The compiler back-end reuse apparatus according to claim 14, wherein the step of converting the original binding number into a target binding number of the preset format comprises:
forming the target binding number after sequentially numbering the same original binding numbers corresponding to different resources.

### Claim 18 (depends on 8)

The compiler back-end reuse apparatus according to claim 8, wherein the compiler back-end reuse method further comprises:
acquiring a useless resource that is not used by the target intermediate code;
acquiring a useless set number of the useless resource, and mapping the useless set number to a preset set number; and
acquiring the useless resource according to the useless set number in the preset set number, and deleting the useless resource.

### Claim 19 (depends on 18)

The compiler back-end reuse apparatus according to claim 18, wherein the compiler back-end reuse method further comprises:
acquiring a read instruction of reading the useless resource according to the useless set number in the preset set number, and deleting the read instruction; or
acquiring a write instruction of writing the useless resource according to the useless set number in the preset set number, and deleting the write instruction; or
acquiring the read instruction of reading the useless resource and the write instruction of writing the useless resource according to the useless set number in the preset set number, and deleting the read instruction and the write instruction.
