Skip to content

Commit d3e79d7

Browse files
authored
【NewIR】add share_data_op (#57212)
* add share_data_op * fix share_data op
1 parent b6ea387 commit d3e79d7

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

paddle/fluid/pir/dialect/operator/ir/ops.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@
163163
args : (Tensor[] x, bool[] share_dims_and_dtype = {})
164164
output : Tensor[](out){x.size()}, Tensor[](xout){x.size()}
165165

166+
- op : share_data
167+
args : (Tensor x)
168+
output : Tensor(out)
169+
kernel:
170+
func: share_data
171+
param: [x]
172+
166173
- op : write_to_array
167174
args : (Tensor i, Tensor x)
168175
output : Tensor[](out)

paddle/fluid/pir/dialect/operator/utils/utils.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const std::unordered_set<std::string> LegacyOpList = {
3434
"pd_op.c_reduce_sum_",
3535
"pd_op.c_allreduce_max_",
3636
"pd_op.c_allgather",
37-
"pd_op.seed"};
37+
"pd_op.seed",
38+
"pd_op.share_data"};
3839

3940
enum class AttrType {
4041
UNDEFINED = 0,

paddle/phi/api/yaml/op_compat.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,6 +3191,12 @@
31913191
data_type : int64_t
31923192
tensors_name : StepsTensorList
31933193

3194+
- op: share_data
3195+
inputs :
3196+
x : X
3197+
outputs :
3198+
out : Out
3199+
31943200
- op: sigmoid_cross_entropy_with_logits
31953201
backward: sigmoid_cross_entropy_with_logits_grad
31963202
inputs :

0 commit comments

Comments
 (0)