Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 6th Fundable Projects 3 No.97】fluid operator dgc #64424

Merged
merged 5 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions paddle/fluid/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ endif()

set(OP_HEADER_DEPS ${OP_HEADER_DEPS} phi common phi_utils static_prim_api get_expected_kernel_func)

register_operators(EXCLUDES py_func_op dgc_op generated_op1 generated_op2 generated_op3 generated_op4 load_combine_op lstm_op run_program_op quantize_linear_op
register_operators(EXCLUDES py_func_op generated_op1 generated_op2 generated_op3 generated_op4 load_combine_op lstm_op run_program_op quantize_linear_op
recurrent_op save_combine_op sync_batch_norm_op activation_op ${OP_MKL_DEPS} DEPS ${OP_HEADER_DEPS} processgroup_comm_utils)

op_library(generated_op UNITY SRCS generated_op1.cc generated_op2.cc generated_op3.cc generated_op4.cc DEPS ${OP_HEADER_DEPS})
Expand Down Expand Up @@ -119,7 +119,6 @@ endif()
set(COMMON_OP_DEPS ${OP_HEADER_DEPS})

if (WITH_DGC)
op_library(dgc_op DEPS dgc)
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} dgc)
endif()

Expand Down
143 changes: 0 additions & 143 deletions paddle/fluid/operators/dgc_op.cc

This file was deleted.

8 changes: 0 additions & 8 deletions paddle/fluid/pir/dialect/operator/ir/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,6 @@
func: dequantize_log
data_type: x

- op : dgc
args : (Tensor u, Tensor v, Tensor grad, Tensor param, Tensor current_step, Tensor nranks, float[] sparsity, float m=0.9, bool use_nesterov=true, float rampup_begin_step=0.0, float rampup_step=0.0, float regular_coeff=0.0, int regular_type=0)
output : Tensor(u_out), Tensor(v_out), Tensor(encode_grad), Tensor(grad_out), Tensor(k), Tensor(gather_buff)
kernel :
func : dgc
param : [u, v, grad, param, current_step, nranks, m, use_nesterov, sparsity, rampup_begin_step, rampup_step, regular_coeff, regular_type]
optional: param

- op : dgc_momentum
args : (Tensor param, Tensor grad, Tensor velocity, Tensor learning_rate, Tensor master_param, Tensor current_step_tensor, Tensor nranks_tensor, float mu, bool use_nesterov=false, str regularization_method="", float regularization_coeff=0.0f, bool multi_precision=false, float rescale_grad=1.0f, float rampup_begin_step=-1.0f)
output : Tensor(param_out), Tensor(velocity_out), Tensor(master_param_out), Tensor(grad_out)
Expand Down
6 changes: 6 additions & 0 deletions paddle/phi/api/yaml/op_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3921,6 +3921,12 @@
outputs:
{u_out: U_out, v_out: V_out, encode_grad: EncodeGrad, grad_out: Grad_out, gather_buff: GatherBuff}

- op: dgc
inputs:
{u : U, v : V, grad : Grad, param : Param}
outputs:
{u_out : U_out, v_out : V_out, encode_grad : EncodeGrad, grad_out : Grad_out, gather_buff : GatherBuff}

- op: distribute_fpn_proposals
inputs :
{fpn_rois: FpnRois, rois_num: RoisNum}
Expand Down
13 changes: 13 additions & 0 deletions paddle/phi/api/yaml/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,19 @@
data_type: detect_res
optional: has_state, pos_count, true_pos, false_pos

- op : dgc
args : (Tensor u, Tensor v, Tensor grad, Tensor param, Tensor current_step, Tensor nranks, float m=0.9, bool use_nesterov=true, float[] sparsity={}, float rampup_begin_step=0.0, float rampup_step=0.0, float regular_coeff=0.0, int regular_type=0)
output : Tensor(u_out), Tensor(v_out), Tensor(encode_grad), Tensor(grad_out), Tensor(k), Tensor(gather_buff)
infer_meta:
func: DgcInferMeta
param : [u, v, grad, param, current_step, nranks]
kernel :
func : dgc
param : [u, v, grad, param, current_step, nranks, m, use_nesterov, sparsity, rampup_begin_step, rampup_step, regular_coeff, regular_type]
optional: param
data_transform :
skip_transform : current_step, nranks

- op : diag
args : (Tensor x, int offset = 0, float padding_value = 0.0)
output : Tensor
Expand Down
13 changes: 13 additions & 0 deletions paddle/phi/infermeta/multiary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,19 @@ void DetectionMapInferMeta(const MetaTensor& detect_res,
m_ap->set_dims(common::make_ddim({1}));
}

void DgcInferMeta(const MetaTensor& u,
const MetaTensor& v,
const MetaTensor& grad,
const MetaTensor& param,
const MetaTensor& current_step_tensor,
const MetaTensor& nranks_tensor,
MetaTensor* u_out,
MetaTensor* v_out,
MetaTensor* encode_grad_out,
MetaTensor* grad_out,
MetaTensor* k_out,
MetaTensor* gather_buff) {}

void DGCMomentumInferMeta(const MetaTensor& param,
const MetaTensor& grad,
const MetaTensor& velocity,
Expand Down
13 changes: 13 additions & 0 deletions paddle/phi/infermeta/multiary.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@ void DetectionMapInferMeta(const MetaTensor& detect_res,
MetaTensor* m_ap,
MetaConfig config = MetaConfig());

void DgcInferMeta(const MetaTensor& u,
const MetaTensor& v,
const MetaTensor& grad,
const MetaTensor& param,
const MetaTensor& current_step_tensor,
const MetaTensor& nranks_tensor,
MetaTensor* u_out,
MetaTensor* v_out,
MetaTensor* encode_grad_out,
MetaTensor* grad_out,
MetaTensor* k_out,
MetaTensor* gather_buff);

void DGCMomentumInferMeta(const MetaTensor& param,
const MetaTensor& grad,
const MetaTensor& velocity,
Expand Down