RegisterKvCache

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Note: For Atlas A2 training products/Atlas A2 inference products, only the Atlas 800I A2 inference server and A200I A2 Box heterogeneous subrack are supported.

Function Description

Registers the local KV cache memory.

Prototype

1
2
3
4
Status RegisterKvCache(const CacheDesc &cache_desc,
                       const std::vector<uint64_t> &addrs,
                       const RegisterCfg &cfg,
                       int64_t &cache_id);

Parameters

Parameter

Input/Output

Description

cache_desc

Input

Description of the local cache.

addrs

Input

Addresses of the local cache. The number of addresses cannot exceed 240.

cfg

Input

Reserved.

cache_id

Output

ID of the registered cache. It can be used to construct a cache reference when KV transmission APIs are called.

Returns

  • LLM_SUCCESS: Success.
  • Other values: Failure.

Constraints

This API must be called after the Initialize API is called to complete initialization.

If the HDK version is earlier than 25.5.0, a maximum of 20 GB host memory can be registered. If the HDK version is 25.5.0 or later, a maximum of 1 TB host memory can be registered. Larger registered memory results in higher OS memory usage. This restriction applies to the following products:

  • Atlas A2 training product/Atlas A2 inference product
  • Atlas A3 training product/Atlas A3 inference product