# US 2021/0173934 A1 · Method and system for managing memory of data processing accelerators

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

- Number: US 2021/0173934 A1
- Document ID: US20210173934A1
- Status: Published application
- Kind: A1
- Application number: 16/315,957
- Filed: 2019-01-04
- Published: 2021-06-10
- Earliest claimed: 2019-01-04
- Assignees: Baidu.Com Times Technology (Beijing) Co., Ltd.; Baidu USA LLC
- Applicants: Baidu.Com Times Technology (Beijing) Co., Ltd.; Baidu USA LLC
- Inventors: Yong LIU; Yueqiang CHENG; Jian OUYANG; Tao WEI
- Web page: https://patentgrep.com/patent/US20210173934A1

## CPC

- G06F 21/575: {Secure boot}
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 21/53: by executing in a restricted environment, e.g. sandbox or secure virtual machine
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

According to one embodiment, a system performs a secure boot using a security module such as a trusted platform module (TPM) of a host system. The system establishes a trusted execution environment (TEE) associated with one or more processors of the host system. The system launches a memory manager within the TEE, where the memory manager is configured to manage memory resources of a data processing (DP) accelerator coupled to the host system over a bus, including maintaining memory usage information of global memory of the DP accelerator. In response to a request received from an application running within the TEE for accessing a memory location of the DP accelerator, the system allows or denies the request based on the memory usage information.

## Claims

### Claim 1

A computer-implemented method for memory management, the method comprising:
performing a secure boot using a security module of a host system;
establishing a trusted execution environment (TEE) associated with one or more processors of the host system;
launching a memory manager within the TEE, wherein the memory manager is configured to manage memory resources of a data processing (DP) accelerator coupled to the host system over a bus, including maintaining memory usage information of a global memory of the DP accelerator; and
in response to a request received from an application running within the TEE for accessing a memory location of the DP accelerator, allowing or denying the request based on the memory usage information.

### Claim 2 (depends on 1)

The method of claim 1, wherein the memory manager is implemented as a part of a runtime library associated with the DP accelerator, which is executed within the TEE of the host system.

### Claim 3 (depends on 1)

The method of claim 1, wherein maintaining memory usage information of global memory of the DP accelerator comprises maintaining a memory usage data structure to record memory allocation of memory blocks of the global memory of the DP accelerator.

### Claim 4 (depends on 3)

The method of claim 3, wherein the memory usage data structure comprises a plurality of entries, each entry recording a memory block of the global memory of the DP accelerator that has been allocated.

### Claim 5 (depends on 4)

The method of claim 4, wherein each entry stores a starting memory address of a corresponding memory block, a size of the corresponding memory block, and a flag indicating whether the corresponding memory block has been allocated.

### Claim 6 (depends on 3)

The method of claim 3, further comprising:
receiving a first request from the application to allocate a first memory block from the global memory of the DP accelerator;
in response to the first request, determining whether the first memory block has been allocated based on the memory usage information stored in the memory usage data structure, without having to interrogate the DP accelerator; and
allocating the first memory block of the global memory to the application, in response to determining that the first memory block has not been allocated.

### Claim 7 (depends on 6)

The method of claim 6, further comprising denying the first request, in response to determining that the first memory block has been allocated.

### Claim 8 (depends on 3)

The method of claim 3, further comprising:
receiving a second request from the application to deallocate a second memory block from the global memory of the DP accelerator;
in response to the second request, determining whether the second memory block has been allocated to the application based on the memory usage information stored in the memory usage data structure;
deallocating the second memory block from the global memory, in response to determining that the second memory block has been allocated to the application; and
otherwise denying the second request.

### Claim 9

A non-transitory machine-readable medium having instructions stored therein, which when executed by a processor, cause the processor to perform operations, the operations comprising:
performing a secure boot using a security module of a host system;
establishing a trusted execution environment (TEE) associated with one or more processors of the host system;
launching a memory manager within the TEE, wherein the memory manager is configured to manage memory resources of a data processing (DP) accelerator coupled to the host system over a bus, including maintaining memory usage information of a global memory of the DP accelerator; and
in response to a request received from an application running within the TEE for accessing a memory location of the DP accelerator, allowing or denying the request based on the memory usage information.

### Claim 10 (depends on 9)

The machine-readable medium of claim 9, wherein the memory manager is implemented as a part of a runtime library associated with the DP accelerator, which is executed within the TEE of the host system.

### Claim 11 (depends on 9)

The machine-readable medium of claim 9, wherein maintaining memory usage information of global memory of the DP accelerator comprises maintaining a memory usage data structure to record memory allocation of memory blocks of the global memory of the DP accelerator.

### Claim 12 (depends on 11)

The machine-readable medium of claim 11, wherein the memory usage data structure comprises a plurality of entries, each entry recording a memory block of the global memory of the DP accelerator that has been allocated.

### Claim 13 (depends on 12)

The machine-readable medium of claim 12, wherein each entry stores a starting memory address of a corresponding memory block, a size of the corresponding memory block, and a flag indicating whether the corresponding memory block has been allocated.

### Claim 14 (depends on 11)

The machine-readable medium of claim 11, wherein the operations further comprise:
receiving a first request from the application to allocate a first memory block from the global memory of the DP accelerator;
in response to the first request, determining whether the first memory block has been allocated based on the memory usage information stored in the memory usage data structure, without having to interrogate the DP accelerator; and
allocating the first memory block of the global memory to the application, in response to determining that the first memory block has not been allocated.

### Claim 15

A data processing host system, comprising:
a security module;
one or more processors coupled to the security module; and
a memory coupled to the processor to store instructions, which when executed by the processor, cause the processor to perform operations, the operations including:
performing a secure boot using the security module of the host system,
establishing a trusted execution environment (TEE) associated with one or more processors of the host system,
launching a memory manager within the TEE, wherein the memory manager is configured to manage memory resources of a data processing (DP) accelerator coupled to the host system over a bus, including maintaining memory usage information of global memory of the DP accelerator, and
in response to a request received from an application running within the TEE for accessing a memory location of the DP accelerator, allowing or denying the request based on the memory usage information.

### Claim 16 (depends on 15)

The system of claim 15, wherein the memory manager is implemented as a part of a runtime library associated with the DP accelerator, which is executed within the TEE of the host system.

### Claim 17 (depends on 15)

The system of claim 15, wherein maintaining memory usage information of global memory of the DP accelerator comprises maintaining a memory usage data structure to record memory allocation of memory blocks of the global memory of the DP accelerator.

### Claim 18 (depends on 17)

The system of claim 17, wherein the memory usage data structure comprises a plurality of entries, each entry recording a memory block of the global memory of the DP accelerator that has been allocated.

### Claim 19 (depends on 18)

The system of claim 18, wherein each entry stores a starting memory address of a corresponding memory block, a size of the corresponding memory block, and a flag indicating whether the corresponding memory block has been allocated.

### Claim 20 (depends on 17)

The system of claim 17, wherein the operations further comprise:
receiving a first request from the application to allocate a first memory block from the global memory of the DP accelerator;
in response to the first request, determining whether the first memory block has been allocated based on the memory usage information stored in the memory usage data structure, without having to interrogate the DP accelerator; and
allocating the first memory block of the global memory to the application, in response to determining that the first memory block has not been allocated.
