aclnnLightningIndexerV2Metadata

📄 View Source Code

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Not supported
  • Atlas inference products: Not supported
  • Atlas training products: Not supported

Function

  • Description: aclnnLightningIndexerV2Metadata is the preceding operator of the aclnnLightningIndexerV2 operator. It generates a load-balanced task partitioning scheme. This operator does not perform actual LightningIndexer computation. Instead, it computes the start and end of the computation range for each AI Core on the AI CPU based on the input parameters. This maximizes the utilization of computing resources and avoids load imbalance among Cores.

    This operator is not recommended for standalone use. Use it together with the aclnnLightningIndexerV2 operator to form a complete workflow.

    1. Accepts the input data shape information of the aclnnLightningIndexerV2 API, including batchSize, qSeqlen, kSeqlen, and mask. It partitions the input and simulates the computation time, then evenly allocates the partitions to the available cores. This reduces the overall computation time of the aclnnLightningIndexerV2 operator and improves hardware utilization.
    2. The allocation result is output and then used as input for the aclnnLightningIndexerV2 operator.
    3. The allocation result contains the start point and end point of the basic block on each AIC core, and the FD task information of each AIV core. For details, see Example.

Function Prototype

Each operator uses a two-phase API. Call "aclnnLightningIndexerV2MetadataGetWorkspaceSize" first to get the workspace size, then call "aclnnLightningIndexerV2Metadata" to perform computation

aclnnStatus aclnnLightningIndexerV2MetadataGetWorkspaceSize(
    const aclTensor   *cuSeqlensQOptional,
    const aclTensor   *cuSeqlensKOptional,
    const aclTensor   *sequsedQOptional,
    const aclTensor   *sequsedKOptional,
    const aclTensor   *cmpResidualKOptional,
    int64_t            numHeadsQ,
    int64_t            numHeadsK,
    int64_t            headDim,
    int64_t            topk,
    int64_t            batchSize,
    int64_t            maxSeqlenQ,
    int64_t            maxSeqlenK,
    char              *layoutQOptional,
    char              *layoutKOptional,
    int64_t            maskMode,
    int64_t            cmpRatio,
    const aclTensor   *metadata,
    uint64_t          *workspaceSize,
    aclOpExecutor    **executor)
aclnnStatus aclnnLightningIndexerV2Metadata(
    void              *workspace,
    uint64_t           workspaceSize,
    aclOpExecutor     *executor,
    aclrtStream        stream)

aclnnLightningIndexerV2MetadataGetWorkspaceSize

  • Parameters

    Parameter Input/Output Description Instruction Data Type Data Format Dimension (shape) Non-contiguous Tensor
    cuSeqlensQOptional (aclTensor*) Input Indicates the valid Sequence Length of q in different batches.
    • Supports empty tensors
    • Shape is fixed to (B+1, ).
    INT32 ND 1D √
    cuSeqlensKOptional (aclTensor*) Input Indicates the valid Sequence Length of k in different batches.
    • Supports empty tensor.
    • Shape is fixed to (B+1, ).
    INT32 ND 1-D √
    sequsedQOptional(aclTensor*) Input Indicates the sequence length of q actually involved in the computation for different batches.
    • Supports empty tensor.
    • Shape is fixed to (B, ).
    INT32 ND 1D √
    sequsedK Optional (aclTensor*) Input Indicates different Sequence Lengths of k that actually participate in computation in different Batches.
    • Supports empty Tensor.
    • The shape is fixed to (B, ).
    INT32 ND 1D √
    cmpResidualKOptional (aclTensor*) Input Indicates the remainder of the compressed Sequence Length of k in different batches, used with cmpRatio for mask and load calculation.
    • Supports empty tensors.
    • Must be passed in for the scenario where cmpRatio is not 1 and mask is 3.
    • The shape is fixed to (B, ).
    • Each element value should be less than the input compression ratio cmpRatio.
    INT32 ND 1D √
    numHeadsQ (int64_t) Input Indicates the number of heads of q. Currently supports [1, 64]. - - - -
    numHeadsK (int64_t) Input Indicates the number of heads of k. Currently supports only 1. - - - -
    headDim (int64_t) Input Dimension of the attention head. Currently supports only 128. - - - -
    topk (int64_t) Input Indicates the number of key sparse tokens selected from q. Currently only supports [1, 8192]. - - - -
    batchSize (int64_t) Input Indicates the number of batches.
    • Supports non-negative values.
    • Recommended value: 0.
    - - - -
    maxSeqlenQ (int64_t) Input Indicates the maximum Sequence Length of q.
    • Value range: ≥-1; -1 indicates any possible length.
    • Recommended value: -1.
    - - - -
    maxSeqlenK (int64_t) Input Indicates the maximum Sequence Length of k.
    • Value range: ≥-1. -1 indicates any possible length.
    • Recommended value: -1.
    - - - -
    layoutQOptional (char*) Input Indicates the layout format of q.
    • Supports BSND and TND.
    • Recommended value: BSND.
    - - - -
    layoutKOptional (char*) Input Indicates the layout of k.
    • Supports BSND, TND, and PA_BBND.
    • Recommended value: BSND.
    - - - -
    maskMode (int64_t) Input Indicates the sparse mode.
    • 0: No mask.
    • 3: Mask of the rightDownCausal mode, corresponding to the lower-triangular use case partitioned by the right vertex.
    • The recommended value is 0.
    - - - -
    cmpRatio (int64_t) Input Indicates the compression rate of k.
    • Value Range: [1, 128]
    • Recommended Value: 1, indicating no compression
    - - - -
    metadata (aclTensor*) Output Indicates the output of the load balancing result. The shape is fixed to (1024, ). INT32 ND 1D ×
    workspaceSize (uint64_t*) Output Returns the workspace size for Device side application. - - - - -
    executor (aclOpExecutor**) Output Returns the op executor containing the operator computation flow. - - - - -
  • Return value

    Returns an aclnnStatus status code. For details, see ACLNN Return Codes.

    The first-phase API performs input parameter validation and returns an error in the following scenarios:

    Return Value Error Code Description
    ACLNN_ERR_INNER_CREATE_EXECUTOR 561101 Failed to create aclOpExecutor.
    ACLNN_ERR_INNER_NULLPTR 561103 workspaceSize or executor is a null pointer, or cuSeqlensQOptional, cuSeqlensKOptional, sequsedQOptional, sequsedKOptional, or cmpResidualKOptional is a null pointer after Contiguous processing.
    ACLNN_ERR_PARAM_INVALID 161002 The specifications of cuSeqlensQOptional, cuSeqlensKOptional, sequsedQOptional, sequsedKOptional, cmpResidualKOptional, numHeadsQ, numHeadsK, headDim, topk, batchSize, maxSeqlenQ, maxSeqlenK, layoutQOptional, layoutKOptional, maskMode, and cmpRatio are not within the supported range.

aclnnLightningIndexerV2Metadata

  • Parameters:

    Parameter Input/Output Description
    workspace Input Workspace memory address of the Device side application.
    workspaceSize Input Size of the workspace memory of the Device side application. Get it by calling the first-phase API aclnnLightningIndexerV2MetadataGetWorkspaceSize.
    executor Input op executor, which contains the operator computation flow.
    stream Input Stream for task execution.
  • Return value

    aclnnStatus: return status code. For details, see aclnn Return Codes.

Constraints

  • aclnnLightningIndexerV2Metadata defaults to a deterministic implementation.
  • B (Batch) indicates the batch size of input samples. q and k are input parameters of the matching aclnnLightningIndexerV2 operator. S1 indicates the size of the S axis in the q shape when layoutQOptional=BSND. S2 indicates the size of the S axis in the k shape when layoutKOptional=BSND.
  • The values of cuSeqlensQOptional and cuSeqlensKOptional must be the cumulative sum of the number of valid tokens in the current and preceding batches. The first element is fixed to 0, and the value of each subsequent element must be greater than or equal to that of the preceding element.
  • The values of parameters sequsedQOptional and sequsedKOptional must indicate the number of valid tokens in each batch.
  • For non-PA use cases, layoutQOptional and layoutKOptional must be the same.
  • Parameter cmpResidualKOptional must satisfy cmpResidualKOptional[i] < cmpRatio.
  • layoutQOptional=BSND scenario
    • The value of S1 must be passed to maxSeqlenQ.
  • For layoutKOptional=BSND use case
    • The value of S2 must be passed to maxSeqlenK.
  • layoutQOptional=TND scenario
    • cuSeqlensQOptional is mandatory.
  • For layoutKOptional=TND use case
    • cuSeqlensKOptional must be passed.
  • layoutKOptional=PA_BBND use case
    • sequsedKOptional must be passed.
  • Batch value rules
    • If layoutQOptional is BSND, prefer to use the shape of sequsedQOptional to derive batch. If sequsedQOptional is not passed in, obtain the number of batches through batchSize.
    • When layoutQOptional is TND, prefer to use the shape of sequsedQOptional to derive the batch; if sequsedQOptional is not passed, derive the batch from the shape of cuSeqlensQOptional.
  • q Seqlen value rules
    • When layoutQOptional is BSND, prefer to use the elements in sequsedQOptional to obtain the seqlen; if sequsedQOptional is not passed, obtain the seqlen from maxSeqlenQ.
    • When layoutQOptional is TND, prefer to use the elements in sequsedQOptional to obtain the seqlen; if sequsedQOptional is not passed, obtain the seqlen from the elements in cuSeqlensQOptional.
  • k Seqlen value rule
    • For layoutKOptional=BSND, prefer through elements in sequsedKOptional to obtain seqlen. If sequsedKOptional is not passed, obtain seqlen through maxSeqlenK.
    • For layoutKOptional=TND, prefer through elements in sequsedKOptional to obtain seqlen. If sequsedKOptional is not passed, obtain seqlen through elements in cuSeqlensKOptional.

Example

The sample code is for reference only. For details about compilation and execution, see Compile and Run Samples.

#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <limits>
#include <functional>
#include <utility>
#include "acl/acl.h"
#include "aclnnop/aclnn_lightning_indexer_v2_metadata.h"

#define CHECK_LOG_RET(cond, ret_val, fmt, ...)      \
    do {                                            \
        if (!(cond)) {                              \
            printf(fmt "\n", ##__VA_ARGS__);        \
            return (ret_val);                       \
        }                                           \
    } while (0)

// Refer to lightning_indexer_v2_metadata.h
constexpr uint32_t AIC_CORE_MAX_NUM = 36;
constexpr uint32_t AIV_CORE_MAX_NUM = 72;
constexpr uint32_t LI_V2_METADATA_TOTAL_SIZE = 1024;
constexpr uint32_t LI_V2_METADATA_SIZE = 8;
constexpr uint32_t LD_V2_METADATA_SIZE = 8;

// LI Metadata Index Definitions
constexpr uint32_t LI_V2_CORE_ENABLE_INDEX = 0;
constexpr uint32_t LI_V2_BN2_START_INDEX = 1;
constexpr uint32_t LI_V2_M_START_INDEX = 2;
constexpr uint32_t LI_V2_S2_START_INDEX = 3;
constexpr uint32_t LI_V2_BN2_END_INDEX = 4;
constexpr uint32_t LI_V2_M_END_INDEX = 5;
constexpr uint32_t LI_V2_S2_END_INDEX = 6;
constexpr uint32_t LI_V2_FIRST_LD_V2_DATA_WORKSPACE_IDX_INDEX = 7;

// LD Metadata Index Definitions
constexpr uint32_t LD_V2_CORE_ENABLE_INDEX = 0;
constexpr uint32_t LD_V2_BN2_IDX_INDEX = 1;
constexpr uint32_t LD_V2_M_IDX_INDEX = 2;
constexpr uint32_t LD_V2_WORKSPACE_IDX_INDEX = 3;
constexpr uint32_t LD_V2_WORKSPACE_NUM_INDEX = 4;
constexpr uint32_t LD_V2_M_START_INDEX = 5;
constexpr uint32_t LD_V2_M_NUM_INDEX = 6;

struct LiV2Metadata {
    uint32_t faData[AIC_CORE_MAX_NUM][LI_V2_METADATA_SIZE];
    uint32_t fdData[AIV_CORE_MAX_NUM][LD_V2_METADATA_SIZE];
};

struct ScopeGuard
{
    explicit ScopeGuard(std::function<void()> onExitScope) : m_exitFunc(std::move(onExitScope)),
        m_isDismissed(false) {}
    // Do not copy.
    ScopeGuard(const ScopeGuard&) = delete;
    ScopeGuard& operator=(const ScopeGuard&) = delete;

    ~ScopeGuard()
    {
        if (!m_isDismissed) {
            m_exitFunc();
        }
    }

    void Dismiss()
    {
        m_isDismissed = true;
    }

    std::function<void()> m_exitFunc;
    bool m_isDismissed;
};

struct Tensor {
    void *hostAddr { nullptr };
    void *deviceAddr { nullptr };
    aclTensor *data { nullptr };
};

struct ArgScenario {
    bool hasCuSeq { false };
    bool hasSeqused { false };
};

struct ArgContext {
    // required input
    int64_t numHeadsQ { 0 };
    int64_t numHeadsK { 0 };
    int64_t headDim { 0 };
    int64_t topk { 0 };
    // optional input
    Tensor cuSeqlensQOptional {};
    Tensor cuSeqlensKOptional {};
    Tensor sequsedQOptional {};
    Tensor sequsedKOptional {};
    Tensor cmpResidualKOptional {};
    int64_t batchSize { 0 };
    int64_t maxSeqlenQ { 0 };
    int64_t maxSeqlenK { 0 };
    char *layoutQOptional { nullptr };
    char *layoutKOptional { nullptr };
    int64_t maskMode { 0 };
    int64_t cmpRatio { 0 };
    // output
    Tensor metadata {};
};

int64_t GetShapeSize(const std::vector<int64_t>& shape)
{
    int64_t shapeSize = 1;
    for (auto i : shape) {
        shapeSize *= i;
    }
    return shapeSize;
}

aclnnStatus Init(int32_t deviceId, aclrtStream* stream)
{
    // Boilerplate, initialization
    auto ret = aclInit(nullptr);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclInit failed. ERROR: %d", ret);
    ret = aclrtSetDevice(deviceId);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtSetDevice failed. ERROR: %d", ret);
    ret = aclrtCreateStream(stream);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtCreateStream failed. ERROR: %d", ret);
    return ACL_SUCCESS;
}

void Finalize(int32_t deviceId, aclrtStream stream)
{
    aclrtDestroyStream(stream);
    aclrtResetDevice(deviceId);
    aclFinalize();
}

aclnnStatus CreateTensor(aclDataType dataType, const std::vector<int64_t> &shape, Tensor &tensor)
{
    auto size = GetShapeSize(shape) * aclDataTypeSize(dataType);
    // Call aclrtMallocHost to allocate host-side memory.
    auto ret = aclrtMallocHost(&(tensor.hostAddr), size);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtMallocHost failed. ERROR: %d", ret);
    memset(tensor.hostAddr, 0, size);
    // Call aclrtMalloc to allocate device-side memory.
    ret = aclrtMalloc(&(tensor.deviceAddr), size, ACL_MEM_MALLOC_HUGE_FIRST);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtMalloc failed. ERROR: %d", ret);
    // Call the aclCreateTensor API to create an aclTensor.
    tensor.data = aclCreateTensor(shape.data(), shape.size(), dataType, nullptr, 0, aclFormat::ACL_FORMAT_ND,
        shape.data(), shape.size(), tensor.deviceAddr);

    // Call aclrtMemcpy to copy host-side data to device-side memory.
    ret = aclrtMemcpy(tensor.deviceAddr, size, tensor.hostAddr, size, ACL_MEMCPY_HOST_TO_DEVICE);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtMemcpy failed. ERROR: %d", ret);
    return ACL_SUCCESS;
}

void DestroyTensor(Tensor &tensor)
{
    if (tensor.data != nullptr) {
        aclDestroyTensor(tensor.data);
        tensor.data = nullptr;
    }
    if (tensor.deviceAddr != nullptr) {
        aclrtFree(tensor.deviceAddr);
        tensor.deviceAddr = nullptr;
    }
    if (tensor.hostAddr != nullptr) {
        aclrtFreeHost(tensor.hostAddr);
        tensor.hostAddr = nullptr;
    }
}

void DestroyArgs(ArgContext &context)
{
    DestroyTensor(context.metadata);
    DestroyTensor(context.cuSeqlensQOptional);
    DestroyTensor(context.cuSeqlensKOptional);
    DestroyTensor(context.sequsedQOptional);
    DestroyTensor(context.sequsedKOptional);
    DestroyTensor(context.cmpResidualKOptional);

    if (context.layoutQOptional != nullptr) {
        free(context.layoutQOptional);
        context.layoutQOptional = nullptr;
    }
    if (context.layoutKOptional != nullptr) {
        free(context.layoutKOptional);
        context.layoutKOptional = nullptr;
    }
}

aclnnStatus CreateArgs(const ArgScenario &scenario, ArgContext &context)
{
    ScopeGuard argsGuard([&] { DestroyArgs(context); });
    aclnnStatus ret;
    int64_t batchSize = 4;

    context.numHeadsQ = 1;
    context.numHeadsK = 1;
    context.headDim = 128;
    context.topk = 0;
    ret = CreateTensor(aclDataType::ACL_INT32, { LI_V2_METADATA_TOTAL_SIZE }, context.metadata);     // 1024: Fix size
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Create meta failed. Error: %d", ret);

    context.maskMode = 0;                   // 0: no mask, 3: causal
    context.cmpRatio = 1;                   // [1, 128], 1: no compress
    context.layoutQOptional = (char *)malloc(sizeof(char) * 16);
    context.layoutKOptional = (char *)malloc(sizeof(char) * 16);
    strcpy(context.layoutQOptional, "BSND");                // BSND,TND
    strcpy(context.layoutKOptional, "BSND");                // BSND,TND,PA_BBND

    if (!scenario.hasCuSeq && !scenario.hasSeqused) {
        context.batchSize = batchSize;
        context.maxSeqlenK = 1024;
        context.maxSeqlenQ = 1024;
        argsGuard.Dismiss();
        return ACL_SUCCESS;
    }

    if (scenario.hasCuSeq) {
        // (B+1,), first element is always 0
        ret = CreateTensor(aclDataType::ACL_INT32, { batchSize + 1 }, context.cuSeqlensQOptional);
        CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Create cuSeqlensQOptional failed. Error: %d", ret);
        ret = CreateTensor(aclDataType::ACL_INT32, { batchSize + 1 }, context.cuSeqlensKOptional);
        CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Create cuSeqlensKOptional failed. Error: %d", ret);
    }

    if (scenario.hasSeqused) {
        // (B,)
        ret = CreateTensor(aclDataType::ACL_INT32, { batchSize }, context.sequsedQOptional);
        CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Create sequsedQOptional failed. Error: %d", ret);
        ret = CreateTensor(aclDataType::ACL_INT32, { batchSize }, context.sequsedKOptional);
        CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Create sequsedKOptional failed. Error: %d", ret);
    }

    argsGuard.Dismiss();
    return ACL_SUCCESS;
}

int main() {
    // 1. (Boilerplate) Initialize the device/stream. For details, see the external API list.
    // Set deviceId based on the actual device.
    int32_t deviceId = 0;
    aclrtStream stream;
    auto ret = Init(deviceId, &stream);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Init acl failed. ERROR: %d", ret);
    ScopeGuard sysGuard([&] { Finalize(deviceId, stream); });

    // 2. Construct the inputs and outputs according to the API definition.
    ArgScenario scenario {};
    scenario.hasCuSeq = true;
    scenario.hasSeqused = true;
    ArgContext context {};
    ret = CreateArgs(scenario, context);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "Create input arguments failed. ERROR: %d", ret);
    ScopeGuard argsGuard([&] { DestroyArgs(context); });

    // 3. Call the CANN operator library API. Replace it with the specific API.
    // Call the first-phase API of aclnnLightningIndexerV2Metadata.
    uint64_t workspaceSize = 0;
    aclOpExecutor *executor = nullptr;
    void *workspaceAddr = nullptr;
    ret = aclnnLightningIndexerV2MetadataGetWorkspaceSize(
        context.cuSeqlensQOptional.data, context.cuSeqlensKOptional.data, context.sequsedQOptional.data,
        context.sequsedKOptional.data, context.cmpResidualKOptional.data,
        context.numHeadsQ, context.numHeadsK, context.headDim, context.topk,
        context.batchSize, context.maxSeqlenQ, context.maxSeqlenK, context.layoutQOptional,
        context.layoutKOptional, context.maskMode, context.cmpRatio,
        context.metadata.data, &workspaceSize, &executor);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclnnLightningIndexerV2MetadataGetWorkspaceSize failed. ERROR: %d\n", ret);

    if (workspaceSize > static_cast<uint64_t>(0)) {
        ret = aclrtMalloc(&workspaceAddr, workspaceSize, ACL_MEM_MALLOC_HUGE_FIRST);
        CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "allocate workspace failed. ERROR: %d\n", ret);
    }
    ScopeGuard workspaceGuard([&] {
        if (workspaceAddr != nullptr) {
            aclrtFree(workspaceAddr);
            workspaceAddr = nullptr;
        }
    });

    // Call the second-phase API of aclnnLightningIndexerV2Metadata.
    ret = aclnnLightningIndexerV2Metadata(workspaceAddr, workspaceSize, executor, stream);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclnnLightningIndexerV2Metadata failed. ERROR: %d\n", ret);

    // 4. (boilerplate) Synchronize and wait for the task execution to complete.
    ret = aclrtSynchronizeStream(stream);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtSynchronizeStream failed. ERROR: %d\n", ret);

    // 5. Print the output.
    LiV2Metadata result {};
    ret = aclrtMemcpy(&result, sizeof(result), context.metadata.deviceAddr, sizeof(result), ACL_MEMCPY_DEVICE_TO_HOST);
    CHECK_LOG_RET(ret == ACL_SUCCESS, ret, "aclrtMemcpy failed. ERROR: %d\n", ret);

    for (uint32_t i = 0; i < AIC_CORE_MAX_NUM; ++i) {
        printf("AIC Core%u\n", i);
        printf("    Core Enable : %u\n", result.faData[i][LI_V2_CORE_ENABLE_INDEX]);
        printf("    Start BN2   : %u\n", result.faData[i][LI_V2_BN2_START_INDEX]);
        printf("    Start M     : %u\n", result.faData[i][LI_V2_M_START_INDEX]);
        printf("    Start S2    : %u\n", result.faData[i][LI_V2_S2_START_INDEX]);
        printf("    End BN2     : %u\n", result.faData[i][LI_V2_BN2_END_INDEX]);
        printf("    End M       : %u\n", result.faData[i][LI_V2_M_END_INDEX]);
        printf("    End S2      : %u\n", result.faData[i][LI_V2_S2_END_INDEX]);
        printf("    First Workspace Index : %u\n", result.faData[i][LI_V2_FIRST_LD_V2_DATA_WORKSPACE_IDX_INDEX]);
    }
    for (uint32_t i = 0; i < AIV_CORE_MAX_NUM; ++i) {
        printf("AIV Core%u\n", i);
        printf("    Core Enable             : %u\n", result.fdData[i][LD_V2_CORE_ENABLE_INDEX]);
        printf("    FD Task BN2 Idx         : %u\n", result.fdData[i][LD_V2_BN2_IDX_INDEX]);
        printf("    FD Task M Idx           : %u\n", result.fdData[i][LD_V2_M_IDX_INDEX]);
        printf("    FD Task Workspace Idx   : %u\n", result.fdData[i][LD_V2_WORKSPACE_IDX_INDEX]);
        printf("    FD Task Workspace Num   : %u\n", result.fdData[i][LD_V2_WORKSPACE_NUM_INDEX]);
        printf("    FD Subtask M Start      : %u\n", result.fdData[i][LD_V2_M_START_INDEX]);
        printf("    FD Subtask M Num        : %u\n", result.fdData[i][LD_V2_M_NUM_INDEX]);
    }

    return 0;
}