SetCustomValue
Applicability
|
Product |
Supported or Not |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Header File
#include <graph/arg_desc_info.h>
Function Usage
Sets customized values of ArgDescInfo. The setting is successful only when type is kCustomValue.
Prototype
1
|
graphStatus SetCustomValue(uint64_t custom_value) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
custom_value |
Input |
Customized value. |
Returns
ge::GRAPH_SUCCESS on success.
For details about the definition of graphStatus, see ge::graphStatus.
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 34 35 36 |
// 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; ArgDescInfo custom_value_arg(ArgDescType::kCustomValue); // Set customized values. custom_value_arg.SetCustomValue(desc.custom_value); //Convert the content of the structure into a uint64_t number and store it to ArgsFormat. aicpu_args_format.emplace_back(custom_value_arg) ... } |
Parent topic: ArgDescInfo