LLM-DataDist API List
LLM-DataDist is a 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 products /Atlas A2 inference products : For theAtlas A2 training products /Atlas A2 inference products , only the Atlas 800I A2 inference server, Atlas 300I A2 inference card, and A200I A2 Box heterogeneous components are supported. When the HCCS transmission protocol is used in the server, only D2D transmission is supported.
Atlas A3 training products /Atlas A3 inference products : 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.
The LLM-DataDist APIs are listed as follows.
LLM-DataDist
API |
Description |
|---|---|
Constructs an LLM-DataDist instance. |
|
Initializes an LLM-DataDist instance. |
|
Releases an LLM-DataDist instance. |
|
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 the CacheManager instance. |
LLMConfig
API |
Description |
|---|---|
Constructs an LLMConfig instance. |
|
Generates a configuration item dictionary. |
|
Sets the device ID of the current process, corresponding to the underlying ge.exec.deviceId configuration item. |
|
Sets the timeout interval for APIs (such as the KV pull API), corresponding to the underlying llm.SyncKvCacheWaitTime configuration item. |
|
Configures additional GE configuration items. |
|
Sets the cluster listening information on the PROMPT side, corresponding to the underlying llm.listenIpInfo configuration item. |
|
Specifies whether to enable the CacheManager mode, corresponding to the underlying llm.EnableCacheManager configuration item. Set this item to True. |
|
Configures the memory pool when CacheManager is enabled. |
|
Configures the host memory pool when CacheManager is enabled. |
|
Specifies whether to enable the function of directly accessing the remote cache when CacheManager is enabled. |
|
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. |
CacheManager
API |
Description |
|---|---|
Constructs a CacheManager instance. |
|
Allocates a cache. After successful allocation, the cache is simultaneously referenced by cache_id and cache_keys. The resources occupied by the cache are not actually released until all these references are removed. |
|
Deallocates a 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 a cache key. After a cache key is removed, the corresponding cache can no longer be pulled by pull_cache. |
|
Pulls the cache from the peer node to the local cache based on the cache key. |
|
Copies the cache. |
|
Allocates the cache of multiple blocks in the PagedAttention scenario. After the cache is successfully allocated, you can call deallocate_blocks_cache to release the memory. |
|
Releases the cache allocated by allocate_blocks_cache in the PagedAttention scenario. |
|
Pulls the cache from the peer node to the local cache via a block list based on BlocksCacheKey in the PagedAttention scenario. |
|
Copies blocks in the PagedAttention scenario. |
|
Swaps in and out the cpu_cache and npu_cache. |
|
Registers a self-allocated memory. |
|
Registers a self-allocated memory in the PagedAttention scenario. |
|
Asynchronously transmits the KV cache in a hierarchical manner. |
|
Pushes the cache from the local node to the remote cache via a 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 uncorrectable error (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 erroneous 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 a Cache instance. |
|
Obtains the cache ID. |
|
Obtains the cache description. |
|
Obtains the cache address. |
|
Creates a CPU cache. |
LLMClusterInfo
API |
Description |
|---|---|
Constructs an LLMClusterInfo instance. |
|
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 instance. |
|
Waits until the transfer at all layers is complete and obtains the overall execution result. |
|
Waits until the transfer at all layers is complete and obtains the execution result of each TransferConfig. |
Other APIs
API |
Description |
|---|---|
Enumerates values of LLMRole. |
|
Enumerates values of RegisterMemStatus. |
|
Represents the device type where the cache is located. It is a field in CacheDesc. |
|
Constructs a CacheDesc instance. |
|
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 a CacheKey instance. |
|
Constructs a CacheKeyByIdAndIndex instance, which is usually used as the parameter type in pull_cache and push_cache of CacheManager. |
|
Constructs a BlocksCacheKey instance in the PagedAttention scenario. |
|
Waits for the specified layer of the model to complete execution. Users need to inherit from 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. |
|
Construct a TransferConfig instance. |
|
Constructs a TransferWithCacheKeyConfig instance. |
|
Obtains the error code of the exception. For details about the error code list, see LLMStatusCode. |
|
Enumerates values of LLMStatusCode. |
|
Enumerates values of DataType. |