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

【快乐开源】PIR test_errors 相关单测适配 #60696

Closed
zrr1999 opened this issue Jan 10, 2024 · 1 comment
Closed

【快乐开源】PIR test_errors 相关单测适配 #60696

zrr1999 opened this issue Jan 10, 2024 · 1 comment
Assignees
Labels
HappyOpenSource 快乐开源活动issue与PR PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭

Comments

@zrr1999
Copy link
Member

zrr1999 commented Jan 10, 2024

一,背景和任务列表

在之前 API 适配 PIR 的时候有⼀些 test_errors 的单测,在 PIR 下并没有适配,
因为当时 PIR 下没有check dtype 相关的逻辑。
现在我们已经完成了check dtype下沉到 cpp API 的⼯作,
所以需要将test_errors 的测试也适配⼀下 PIR。

⭐️ 提交PR 模版 ⭐️:

  • // ------- PR 标题 --------
[PIR] A-1 Adapt mean test_errors

本期需要升级的 API 如下:

第一批

序号 Python API 所在文件 贡献者 PR链接
✅ A-1 mean test/legacy_test/test_mean_op.py @zrr1999 #60695
✅ A-2 sum test/legacy_test/test_sum_op.py @zrr1999 #60693
✅ A-3 fill_constant test/legacy_test/test_fill_constant_op.py @zrr1999 #60695
✅ A-4 dropout test/legacy_test/test_dropout_op.py
✅ A-5 gelu test/legacy_test/test_gelu_op.py
✅ A-6 cast test/legacy_test/test_cast_op.py @zrr1999 #60693
✅ A-7 subtract test/legacy_test/test_subtract_op.py #63607
✅ A-8 erf test/legacy_test/test_erf_op.py
✅ A-9 greater_equal test/legacy_test/test_compare_op.py @zrr1999 #60693
✅ A-10 reshape test/legacy_test/test_reshape_op.py @zrr1999 #60693
✅ A-11 scale test/legacy_test/test_scale_op.py @zrr1999 #60693
✅ A-12 concat test/legacy_test/test_concat_op.py @enkilee #61036
✅ A-13 expand test/legacy_test/test_expand_op.py @ooooo-create #62849
✅ A-14 matmul test/legacy_test/test_matmul_op.py @enkilee #61038
✅ A-15 split test/legacy_test/test_split_op.py @enkilee #61039
✅ A-16 add_n test/legacy_test/test_add_n_op.py
✅ A-17 transpose test/legacy_test/test_transpose_op.py @enkilee #61119
✅ A-18 softmax test/legacy_test/test_softmax_op.py @enkilee #61120
✅ A-19 rms_norm test/legacy_test/test_rms_norm_op.py
✅ A-20 full_like test/legacy_test/test_full_like_op.py @zrr1999 #62118
✅ A-21 gather_nd test/legacy_test/test_gather_nd_op.py #63607
✅ A-22 shape test/legacy_test/test_shape_op.py
✅ A-23 numel test/legacy_test/test_numel_op.py @zrr1999 #60693
✅ A-24 slice test/legacy_test/test_slice_op.py - -
✅ A-25 stack test/legacy_test/test_stack_op.py @SigureMo #60863
✅ A-26 where test/legacy_test/test_where_op.py @zrr1999 #60693
✅ A-27 fill_any_like test/legacy_test/test_fill_any_like_op.py
✅ A-28 pad test/legacy_test/test_pad_op.py
✅ A-29 tile test/legacy_test/test_tile_op.py - -
✅ A-30 assign test/legacy_test/test_assign_op.py @zrr1999 #60693
✅ A-31 fill test/legacy_test/test_fill_op.py @zrr1999 #62118

第二批

序号 Python API 所在文件 贡献者 PR链接
✅ B-1 div test/legacy_test/test_elementwise_div_op.py @gouzil #61112
✅ B-2 add test/legacy_test/test_elementwise_add_op.py - -
✅ B-3 pow test/legacy_test/test_elementwise_pow_op.py - -
✅ B-4 mul test/legacy_test/test_elementwise_mul_op.py - -
✅ B-5 silu test/legacy_test/test_activation_op.py - -
✅ B-6 exp test/legacy_test/test_activation_op.py - -
✅ B-7 tanh test/legacy_test/test_activation_op.py - -
✅ B-8 rsqrt test/legacy_test/test_activation_op.py - -
✅ B-9 relu test/legacy_test/test_activation_op.py @zrr1999 #62118
✅ B-10 sqrt test/legacy_test/test_activation_op.py @zrr1999 #62118

第三批

序号 Python API 所在文件 贡献者 PR链接
✅ C-1 reduce相关 test/legacy_test/test_reduce_op.py #63607
✅ C-2 squeeze test/legacy_test/test_squeeze_squeeze2_op.py #63607
✅ C-3 unsqueeze test/legacy_test/test_unsqueeze_unsqueeze2_op.py @zrr1999 #60693
✅ C-4 uniform test/legacy_test/test_uniform_random_op.py @zrr1999 #60693
✅ C-5 embedding test/legacy_test/test_lookup_table_v2_op.py
✅ C-6 bitwise_and test/legacy_test/test_bitwise_op.py
✅ C-7 arange test/legacy_test/test_arange.py @zrr1999 #60693
✅ C-8 equal test/legacy_test/test_compare_op.py - -
✅ C-9 tril test/legacy_test/test_tril_triu_op.py

第四批

序号 Python API 所在文件 贡献者 PR链接
✅ D-1 clip test/legacy_test/test_clip_op.py @zrr1999 #61289
✅ D-2 min test/legacy_test/test_min_op.py @zrr1999 #61289
✅ D-3 prod test/legacy_test/test_prod_op.py @zrr1999 #61289
✅ D-4 gather test/legacy_test/test_gather_op.py @zrr1999 #61289
✅ D-5 dot test/legacy_test/test_dot_op.py @zrr1999 #61289
✅ D-6 transpose test/legacy_test/test_transpose_op.py
✅ D-7 pad test/legacy_test/test_pad_op.py @zrr1999 #61963
✅ D-8 conv2d test/legacy_test/test_conv2d_op.py
✅ D-9 dot test/legacy_test/test_dot_op.py
✅ D-10 cumsum test/legacy_test/test_cumsum_op.py @zrr1999 #61963
✅ D-11 linear_interp test/legacy_test/test_linear_interp_op.py
✅ D-12 bicubic_interp test/legacy_test/test_bicubic_interp_op.py @zrr1999 #61289
✅ D-13 assign test/legacy_test/test_assign_op.py
✅ D-14 conv2d test/legacy_test/test_conv2d_op.py
✅ D-15 full test/legacy_test/test_full_op.py
✅ D-16 full test/legacy_test/test_full_op.py @ooooo-create #62830
✅ D-17 softmax test/legacy_test/test_softmax_op.py
✅ D-18 randint test/legacy_test/test_randint_op.py @ooooo-create #62807
✅ D-19 conv2d test/legacy_test/test_conv2d_op.py @zrr1999 #61289
✅ D-20 solve test/legacy_test/test_solve_op.py @zrr1999 #61289
✅ D-21 eig test/legacy_test/test_eig_op.py @zrr1999 #61289
✅ D-22 eigvals test/legacy_test/test_eigvals_op.py @zrr1999 #61289
✅ D-23 randperm test/legacy_test/test_randperm_op.py @ooooo-create #62797
✅ D-24 batch_norm test/legacy_test/test_batch_norm_op.py @zrr1999 #61289

二,任务详情

需要对相关单测进行修改合并,在单测函数中,将with program_guard(Program(), Program())
with paddle.pir_utils.IrGuard(), program_guard(Program(), Program()) 合并,并添加test_with_pir_api装饰器。

def test_single_tensor_error(self):
    with base.program_guard(base.Program(), base.Program()):
        x = paddle.rand([2, 3])
        self.assertRaises(TypeError, paddle.stack, x)
    with paddle.pir_utils.IrGuard():
        x = paddle.rand([2, 3])
        self.assertRaises(TypeError, paddle.stack, x)

修改为

@test_with_pir_api
def test_single_tensor_error(self):
    with paddle.static.program_guard(
        paddle.static.Program(), paddle.static.Program()
    ):
        x = paddle.rand([2, 3])
        self.assertRaises(TypeError, paddle.stack, x)

合并针对pir和静态图的两个相同用例

def test_single_tensor_error(self):
    with base.program_guard(base.Program(), base.Program()):
        x = paddle.rand([2, 3])
        self.assertRaises(TypeError, paddle.stack, x)

def test_pir_single_tensor_error(self):
    with paddle.pir_utils.IrGuard():
        x = paddle.rand([2, 3])
        self.assertRaises(ValueError, paddle.stack, x)

修改为

@test_with_pir_api
def test_single_tensor_error(self):
    with paddle.static.program_guard(
        paddle.static.Program(), paddle.static.Program()
    ):
        x = paddle.rand([2, 3])
        self.assertRaises(TypeError, paddle.stack, x)

三、参考PR

#60863
#60693
#60695

看板信息

任务数量 提交数量 提交率 完成数量 完成率
74 74 100% 74 100%
@zrr1999 zrr1999 added status/new-issue 新建 type/others 其他问题 labels Jan 10, 2024
@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Jan 10, 2024
@0x45f 0x45f self-assigned this Jan 11, 2024
@Ligoml Ligoml removed status/new-issue 新建 type/others 其他问题 labels Jan 12, 2024
@Ligoml Ligoml unassigned ZHUI Jan 12, 2024
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jan 22, 2024
@luotao1 luotao1 moved this to In Progress in Call for Contributions Jan 22, 2024
@zrr1999 zrr1999 changed the title API单测test_errors相关case适配PIR 【快乐开源】PIR test_errors 相关单测适配 Jan 23, 2024
@luotao1
Copy link
Contributor

luotao1 commented Apr 18, 2024

【快乐开源】PIR test_errors 相关单测适配 已全部完成,感谢参与的小伙伴们!

排名不分先后: @zrr1999 @gouzil @ooooo-create @enkilee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HappyOpenSource 快乐开源活动issue与PR PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭
Projects
Development

No branches or pull requests

5 participants