CreateCustomValue
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Header File
#include <graph/arg_desc_info.h>
Function Usage
Creates an ArgDescInfo object of the kCustomValue type (user-defined parameter type), indicating that the Args address is used to store customized content.
Prototype
1 | static ArgDescInfo CreateCustomValue(uint64_t custom_value) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
custom_value |
Input |
Customized data stored in the memory block with the Args address. |
Returns
ArgDescInfo object of the kCustomValue type.
Constraints
None
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | // Store a structure in Args. struct HcclCommParamDesc { uint64_t version : 4; uint64_t group_num : 4; uint64_t has_ffts : 1; uint64_t tiling_off : 7; uint64_t is_dyn : 48; }; graphStatus Mc2GenTaskCallback(const gert::ExeResGenerationContext *context, std::vector<std::vector<uint8_t>> &tasks) { ... // Set an AI CPU task. auto aicpu_task = KernelLaunchInfo::CreateAicpuKfcTask(context, "libccl_kernel.so", "RunAicpuKfcSrvLaunch"); size_t input_size = context->GetComputeNodeInfo()->GetIrInputsNum(); size_t output_size = context->GetComputeNodeInfo()->GetIrOutputsNum(); const size_t offset = 3UL; union { HcclCommParamDesc hccl_desc; uint64_t custom_value; } desc; //Assign values. desc.hccl_desc.version = 1; desc.hccl_desc.group_num = 1; desc.hccl_desc.has_ffts = 0; desc.hccl_desc.tiling_off = offset + input_size + output_size; desc.hccl_desc.is_dyn = 0; std::vector<ArgDescInfo> aicpu_args_format; //Convert the content of the structure into a uint64_t number and store it to ArgsFormat. aicpu_args_format.emplace_back(ArgDescInfo::CreateCustomValue(desc.custom_value)); ... } |
Parent topic: ArgDescInfo