Merged
fix(ffn_worker_batching): 修复原型未并入合并产物并补 OPS_PROTO_DEF 隔离宏 #10634
zl_hwAdd on Aug 25
fix(ffn_worker_batching): 修复原型未并入合并产物并补 OPS_PROTO_DEF 隔离宏 #10634
Merged
Total: 1 files changed+48-44
| @@ -20,50 +20,54 @@ | |||
| 20 | 20 | ||
| 21 | namespace ge { | 21 | namespace ge { |
| 22 | 22 | ||
| 23 | - /** | 23 | +/** |
| 24 | - * @brief Fusion op of sort, gather_out and group_list | 24 | + * @brief Fusion op of sort, gather_out and group_list |
| 25 | - * | 25 | + * |
| 26 | - * @par Inputs: | 26 | + * @par Inputs: |
| 27 | - * one input, including: | 27 | + * one input, including: |
| 28 | - * @li schedule_context: A tensor, support INT8. | 28 | + * @li schedule_context: A tensor, support INT8. |
| 29 | - * | 29 | + * |
| 30 | - * @par Outputs: | 30 | + * @par Outputs: |
| 31 | - * @li y: A tensor, support INT8, FP16, BF16, shape [Y, H], Y=A*BS*(topk+1). | 31 | + * @li y: A tensor, support INT8, FP16, BF16, shape [Y, H], Y=A*BS*(topk+1). |
| 32 | - * @li group_list: A tensor list, support INT64, formatted as [expert_id, expert_token_num]. Example: [[1,20], [10,40], [22,15], …]. | 32 | + * @li group_list: A tensor list, support INT64, formatted as [expert_id, expert_token_num]. Example: [[1,20], [10,40], |
| 33 | - * @li session_ids: A tensor, support INT32, the attention_worker_id to which the data is sent. | 33 | + * [22,15], …]. |
| 34 | - * @li micro_batch_ids: A tensor, support INT32, the micro_batch_id that each token belongs to. | 34 | + * @li session_ids: A tensor, support INT32, the attention_worker_id to which the data is sent. |
| 35 | - * @li token_ids: A tensor, support INT32, the batch-wise offset of each token within its micro_batch. | 35 | + * @li micro_batch_ids: A tensor, support INT32, the micro_batch_id that each token belongs to. |
| 36 | - * @li expert_offsets: A tensor, support INT32, the index within the top-k selection. | 36 | + * @li token_ids: A tensor, support INT32, the batch-wise offset of each token within its micro_batch. |
| 37 | - * @li dynamic_scale: A tensor, support FP32, dynamic_scale[i] = token_data[session_id, micro_batch_id, bs, k, H]. | 37 | + * @li expert_offsets: A tensor, support INT32, the index within the top-k selection. |
| 38 | - * @li actual_token_num: A tensor, support INT64, the actual number of tokens processed. | 38 | + * @li dynamic_scale: A tensor, support FP32, dynamic_scale[i] = token_data[session_id, micro_batch_id, bs, k, H]. |
| 39 | - * | 39 | + * @li actual_token_num: A tensor, support INT64, the actual number of tokens processed. |
| 40 | - * @par Attributes: | 40 | + * |
| 41 | - * @li expert_num: A scalar, the total number of experts. | 41 | + * @par Attributes: |
| 42 | - * @li max_out_shape: A scalar list, [A, BS, topk+1, H], inferred output shape for Y and H, Y=A*BS*(topk+1). | 42 | + * @li expert_num: A scalar, the total number of experts. |
| 43 | - * @li token_dtype: A scalar, support FP16, BF16, quantization type of the input tokens. | 43 | + * @li max_out_shape: A scalar list, [A, BS, topk+1, H], inferred output shape for Y and H, Y=A*BS*(topk+1). |
| 44 | - * @li need_schedule: A scalar, whether the op should be scheduled. | 44 | + * @li token_dtype: A scalar, support FP16, BF16, quantization type of the input tokens. |
| 45 | - * @li layer_num: A scalar, the number of layers. | 45 | + * @li need_schedule: A scalar, whether the op should be scheduled. |
| 46 | - * | 46 | + * @li layer_num: A scalar, the number of layers. |
| 47 | - * @par Restrictions: | 47 | + * |
| 48 | - * Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. | 48 | + * @par Restrictions: |
| 49 | - */ | 49 | + * Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. |
| 50 | - REG_OP (FfnWorkerBatching) | 50 | + */ |
| 51 | - .INPUT(schedule_context, TensorType({DT_INT8})) | 51 | +#ifndef OPS_PROTO_DEF_FFNWORKERBATCHING |
| 52 | - .OUTPUT(y, TensorType({DT_INT8, DT_FLOAT16, DT_BFLOAT16})) | 52 | +#define OPS_PROTO_DEF_FFNWORKERBATCHING |
| 53 | - .OUTPUT(group_list, TensorType({DT_INT64})) | 53 | +REG_OP(FfnWorkerBatching) |
| 54 | - .OUTPUT(session_ids, TensorType({DT_INT32})) | 54 | + .INPUT(schedule_context, TensorType({DT_INT8})) |
| 55 | - .OUTPUT(micro_batch_ids, TensorType({DT_INT32})) | 55 | + .OUTPUT(y, TensorType({DT_INT8, DT_FLOAT16, DT_BFLOAT16})) |
| 56 | - .OUTPUT(token_ids, TensorType({DT_INT32})) | 56 | + .OUTPUT(group_list, TensorType({DT_INT64})) |
| 57 | - .OUTPUT(expert_offsets, TensorType({DT_INT32})) | 57 | + .OUTPUT(session_ids, TensorType({DT_INT32})) |
| 58 | - .OUTPUT(dynamic_scale, TensorType({DT_FLOAT32})) | 58 | + .OUTPUT(micro_batch_ids, TensorType({DT_INT32})) |
| 59 | - .OUTPUT(actual_token_num, TensorType({DT_INT64})) | 59 | + .OUTPUT(token_ids, TensorType({DT_INT32})) |
| 60 | - .REQUIRED_ATTR(expert_num, Int) | 60 | + .OUTPUT(expert_offsets, TensorType({DT_INT32})) |
| 61 | - .REQUIRED_ATTR(max_out_shape, ListInt) | 61 | + .OUTPUT(dynamic_scale, TensorType({DT_FLOAT32})) |
| 62 | - .ATTR(token_dtype, Int, 0) | 62 | + .OUTPUT(actual_token_num, TensorType({DT_INT64})) |
| 63 | - .ATTR(need_schedule, Int, 0) | 63 | + .REQUIRED_ATTR(expert_num, Int) |
| 64 | - .ATTR(layer_num, Int, 0) | 64 | + .REQUIRED_ATTR(max_out_shape, ListInt) |
| 65 | - .OP_END_FACTORY_REG(FfnWorkerBatching) | 65 | + .ATTR(token_dtype, Int, 0) |
| 66 | + .ATTR(need_schedule, Int, 0) | ||
| 67 | + .ATTR(layer_num, Int, 0) | ||
| 68 | + .OP_END_FACTORY_REG(FfnWorkerBatching) | ||
| 69 | +#endif // OPS_PROTO_DEF_FFNWORKERBATCHING | ||
| 66 | 70 | ||
| 67 | } // namespace ge | 71 | } // namespace ge |
| 68 | 72 | ||
| 69 | -#endif // OP_GRAPH_FFN_WORKER_BATCHING_PROTO_H | 73 | +#endif // OP_GRAPH_FFN_WORKER_BATCHING_PROTO_H |