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 API adaptor No.32】Migrate paddle.distribution.Uniform into pir #60322

Closed
wants to merge 9 commits into from

Conversation

ooooo-create
Copy link
Contributor

@ooooo-create ooooo-create commented Dec 25, 2023

PR types

Others

PR changes

APIs

Description

link #58067
PIR API 推全升级
将 paddle.distribution.Uniform 迁移升级至 pir,并更新单测
单测覆盖率: 11/13

Copy link

paddle-bot bot commented Dec 25, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Dec 25, 2023
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Dec 26, 2023
Copy link

paddle-ci-bot bot commented Jan 4, 2024

Sorry to inform you that 9d9d4e3's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@YuanRisheng
Copy link
Contributor

YuanRisheng commented Jan 16, 2024

@ooooo-create hi,这个pr的问题解决看起来还需要进行kernel迁移,请问一下这个PR你这边还有时间跟进吗,如果没有时间的话就让飞桨内部同学接手做啦

@ooooo-create
Copy link
Contributor Author

@ooooo-create hi,这个pr的问题解决看起来还需要进行kernel迁移,请问一下这个PR你这边还有时间跟进吗,如果没有时间的话就让飞桨内部同学接手做啦

kernel 迁移是要怎么做呀,有时间想试试~

@0x45f
Copy link
Contributor

0x45f commented Jan 24, 2024

@ooooo-create hi,这个pr的问题解决看起来还需要进行kernel迁移,请问一下这个PR你这边还有时间跟进吗,如果没有时间的话就让飞桨内部同学接手做啦

kernel 迁移是要怎么做呀,有时间想试试~

看了下代码,应该不涉及kernel迁移。需要做如下的修改:

  • 将paddle/fluid/pir/dialect/op_generator/ops_api_gen.py内NO_NEED_GEN_STATIC_ONLY_APIS里的'uniform_random_batch_size_like'移动到NEED_GEN_STATIC_ONLY_APIS中
  • 在python/paddle/tensor/random.py的uniform_random_batch_size_like函数内添加一个pir分支,类似:
if in_pir_mode():
    return _C_ops.uniform_random_batch_size_like(xxx)

def test_uniform_distribution_static(self, sample_shape=7, tolerance=1e-6):
paddle.enable_static()
with base.program_guard(self.test_program):
def test_old_ir_uniform_distribution_static(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的修改是不是有点复杂了,原来的test_uniform_distribution_static函数是不是直接能用test_with_pir_api装饰器装饰一下复用呢?setUp函数内的self.test_program、self.executor、self.test_pir_program变量是不是直接在test_uniform_distribution_static函数内定义就可以了,别的地方也不会用到这几个变量,我们是不是也不需要InitDataContextManager这个class?单测的修改可以再斟酌一下~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,修改了一下~

43: ERROR: test_uniform_distribution_static (test_distribution_uniform.UniformTest6)
443: ----------------------------------------------------------------------
443: Traceback (most recent call last):
443:   File "/home/aistudio/Paddle/build/python/paddle/pir_utils.py", line 115, in impl
443:     func(*args, **kwargs)
443:   File "/home/aistudio/Paddle/build/test/distribution/test_distribution_uniform.py", line 133, in test_uniform_distribution_static
443:     fetch_list = self.executor.run(
443:   File "/home/aistudio/Paddle/build/python/paddle/base/executor.py", line 1764, in run
443:     res = self._run_pir_impl(
443:   File "/home/aistudio/Paddle/build/python/paddle/base/executor.py", line 2076, in _run_pir_impl
443:     ) = self._executor_cache.get_pir_program_and_executor(
443:   File "/home/aistudio/Paddle/build/python/paddle/base/executor.py", line 1110, in get_pir_program_and_executor
443:     return self._get_cached_program_and_executor_pir_mode(
443:   File "/home/aistudio/Paddle/build/python/paddle/base/executor.py", line 1139, in _get_pir_program_and_executor
443:     new_exe = _StandaloneExecutor(place, plan, scope)
443:   File "/home/aistudio/Paddle/build/python/paddle/base/executor.py", line 815, in __init__
443:     self._new_exe = self._create_new_executor()
443:   File "/home/aistudio/Paddle/build/python/paddle/base/executor.py", line 851, in _create_new_executor
443:     new_exe = core.StandaloneExecutor(self._place, self._plan, self._scope)
443: RuntimeError: (PreconditionNotMet) op [pd_op.uniform_random_batch_size_like] kernel output args defs should equal op outputs
443:   [Hint: Expected op_item->num_results() == output_defs.size(), but received op_item->num_results():1 != output_defs.size():0.] (at /home/aistudio/Paddle/paddle/fluid/pir/transforms/pd_op_to_kernel_pass.cc:1813)

这个报错是关于kernel的吗

@luotao1 luotao1 closed this Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants