Skip to content

Commit

Permalink
【NewIR】add share_data_op (#57212)
Browse files Browse the repository at this point in the history
* add share_data_op

* fix share_data op
  • Loading branch information
yangguohao authored Sep 15, 2023
1 parent b6ea387 commit d3e79d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions paddle/fluid/pir/dialect/operator/ir/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@
args : (Tensor[] x, bool[] share_dims_and_dtype = {})
output : Tensor[](out){x.size()}, Tensor[](xout){x.size()}

- op : share_data
args : (Tensor x)
output : Tensor(out)
kernel:
func: share_data
param: [x]

- op : write_to_array
args : (Tensor i, Tensor x)
output : Tensor[](out)
Expand Down
3 changes: 2 additions & 1 deletion paddle/fluid/pir/dialect/operator/utils/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const std::unordered_set<std::string> LegacyOpList = {
"pd_op.c_reduce_sum_",
"pd_op.c_allreduce_max_",
"pd_op.c_allgather",
"pd_op.seed"};
"pd_op.seed",
"pd_op.share_data"};

enum class AttrType {
UNDEFINED = 0,
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 @@ -3191,6 +3191,12 @@
data_type : int64_t
tensors_name : StepsTensorList

- op: share_data
inputs :
x : X
outputs :
out : Out

- op: sigmoid_cross_entropy_with_logits
backward: sigmoid_cross_entropy_with_logits_grad
inputs :
Expand Down

0 comments on commit d3e79d7

Please sign in to comment.