LLM-DataDist APIs
LLM-DataDist is an LLM distributed cluster and data acceleration component. It provides clustered KV data management capabilities and supports disaggregated deployment of full graphs and incremental graphs.
- The following products are supported:
Atlas A2 training product /Atlas A2 inference product : ForAtlas A2 training product /Atlas A2 inference product , only the Atlas 800I A2 inference server and A200I A2 Box heterogeneous subrack are supported. When the HCCS transmission protocol is used in the server, only D2D transmission is supported.
Atlas A3 training product /Atlas A3 inference product : When the HCCS transmission protocol is used, the host memory cannot be used as the remote cache.
- Currently, Python 3.9, Python 3.11, and Python 3.12 are supported. For details about how to install it, visit the Python official website: https://www.python.org/.
- A maximum of 50 GB device memory and 20 GB host memory can be registered. Larger registered memory results in higher OS memory usage. This restriction applies to the following products:
Atlas A3 training product /Atlas A3 inference product Atlas A2 training product /Atlas A2 inference product : ForAtlas A2 training product /Atlas A2 inference product , only the Atlas 800I A2 inference server and A200I A2 Box heterogeneous subrack are supported.
The LLM-DataDist APIs are as follows.
LLM-DataDist
API |
Description |
|---|---|
Constructs LLMDataDist. |
|
Initializes the LLMDataDist. |
|
Releases the LLMDataDist. |
|
Establishes a link unilaterally. The request is initiated by the client. The server/client roles are independent of the prompt/decoder roles. Setting listen_ip_info on a node designates the node as the server (port listens for links). |
|
Disconnects a link unilaterally. The request can be initiated by the client to notify the server of disconnection. Alternatively, both the client and server can initiate forcible disconnection to clean up only local links. |
|
Switches the role of the current LLM-DataDist instance. You can also configure switch_options to switch the role to client or server. |
|
Establishes a link by establishing a communicator in bilateral link establishment scenarios. |
|
Disconnects a link in bilateral link establishment scenarios. |
|
Queries the status of the registered memory in bilateral link establishment scenarios. |
|
Obtains a CacheManager instance. |
LLMConfig
API |
Description |
|---|---|
Constructs LLMConfig. |
|
Generates a configuration item dictionary. |
|
Sets the device ID of the current process, corresponding to the underlying ge.exec.deviceId configuration item. |
|
Configures the timeout interval for APIs that pull the KV, corresponding to the llm.SyncKvCacheWaitTime configuration item at the bottom layer. |
|
Configures additional GE configuration items. |
|
Sets the cluster listening information on the Prompt side, corresponding to the llm.listenIpInfo configuration item at the bottom layer. |
|
Enables or disables CacheManager, corresponding to the llm.EnableCacheManager configuration item at the bottom layer. Set this item to True. |
|
When CacheManager is enabled, configures the memory pool-related settings. |
|
Configures the host memory pool when CacheManager is enabled. |
|
When CacheManager is enabled, enables or disables direct access to the remote cache. |
|
Sets the traffic class of the RDMA NIC when CacheManager is enabled. |
|
Sets the service level of the RDMA NIC when CacheManager is enabled. |
|
Configures local communication resources when CacheManager is enabled. |
|
Sets the total timeout interval for HCCL link establishment failures. |
|
Sets the number of retries upon HCCL link establishment failures. |
|
Sets the transmission backend used by LLM-DataDist. |
CacheManager
API |
Description |
|---|---|
Constructs a CacheManager instance. |
|
Allocates a cache. After a cache is successfully allocated, it is referenced by cache_id and cache_keys at the same time. The resources occupied by the cache are released only after these references are removed. |
|
Releases the cache. If the cache is associated with a cache key during allocation, the actual release is delayed until all cache keys are pulled or remove_cache_key is executed. |
|
Removes CacheKey. After CacheKey is removed, the cache cannot be pulled by pull_cache. |
|
Obtains the cache from the peer node to the local cache based on CacheKey. |
|
Copies the cache. |
|
In the PagedAttention scenario, allocates the cache with multiple blocks. After the cache is successfully allocated, the memory can be released through deallocate_blocks_cache. |
|
In the PagedAttention scenario, releases the cache allocated by allocate_blocks_cache. |
|
In the PagedAttention scenario, the cache is pulled from the peer node in block list based on BlocksCacheKey to the local cache. |
|
Copies blocks in the PagedAttention scenario. |
|
Swaps in and out the cpu_cache and npu_cache. |
|
Registers a self-allocated memory. |
|
In the PagedAttention scenario, this API is called to register a self-allocated memory. |
|
Transfers the data of cache in asynchronously hierarchical mode. |
|
Pushes the cache from the local node to the remote cache in block list based on BlocksCacheKey in the PagedAttention scenario. |
|
Pushes the cache from the local node to the remote cache based on the cache key (CacheKey). |
|
During LLM inference, if a memory UCE occurs (that is, ACL_ERROR_RT_DEVICE_MEM_ERROR is returned), the upper-layer framework needs to first determine whether the faulty memory is a KV cache memory. If it is not a KV cache memory, refer to the torch_npu.npu.restart_device API description in Ascend Extension for PyTorch Custom API Reference to obtain and fix the incorrect virtual address of the memory UCE. If it is a KV cache memory, additionally call this API to restore the KV cache memory registered with the NIC. This API is reserved, and the function is not supported currently. |
|
Deregisters a self-allocated memory. |
Cache
API |
Description |
|---|---|
Constructs cache. |
|
Obtains the cache ID. |
|
Obtains the cache description. |
|
Obtains the cache address. |
|
Creates a CPU cache. |
LLMClusterInfo
API |
Description |
|---|---|
Constructs LLMClusterInfo. |
|
Sets the peer cluster ID. |
|
Adds the IP address of the local cluster. |
|
Adds the IP address of the remote cluster. |
CacheTask
API |
Description |
|---|---|
Constructs a CacheTask. |
|
Waits until the transmission at all layers is complete and obtains the overall execution result. |
|
Waits until the transmission at all layers is complete and obtains the execution result of each TransferConfig instance. |
Others
API |
Description |
|---|---|
The enumerated values of LLMRole. |
|
The enumerated values of RegisterMemStatus. |
|
A field in CacheDesc, indicating the type of device where the cache is located. |
|
Constructs CacheDesc. |
|
Indicates the location of the address. It is usually used as the type of the mem_type parameter of MemInfo. |
|
Constructs a MemInfo instance, which is typically used as a parameter type in the remap_registered_memory API of CacheManager. |
|
Constructs CacheKey. |
|
Constructs a CacheKeyByIdAndIndex instance, which is usually used as the parameter type in pull_cache and push_cache of CacheManager. |
|
In the PagedAttention scenario, constructs BlocksCacheKey. |
|
Waits until the execution of the specified layer of the model is complete. You need to inherit LayerSynchronizer and implement this API. This API is called during the execution of transfer_cache_async. When the API returns a success status, the cache transmission for the current layer begins. |
|
Constructs TransferConfig. |
|
Constructs a TransferWithCacheKeyConfig instance. |
|
Obtains the error code of an exception. For details about the error code list, see LLMStatusCode. |
|
The enumerated values of LLMStatusCode. |
|
Enumerates values of DataType. |