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

Improve new executor static build #51149

Merged
merged 57 commits into from
Apr 4, 2023

Conversation

From00
Copy link
Contributor

@From00 From00 commented Mar 3, 2023

PR types

Others

PR changes

Others

Describe

Pcard-67003

在PR #50670 新执行器全静态选kernel方案跑通Resnet50和Transformer模型的基础上,本PR对方案做进一步完善,通过在开启全静态选kernel的情况下修复大量的CI单测问题,达到跑通所有CI测试的程度。

部分暂未做修复的特殊场景当前通过退化回“半静态”选kernel处理,包括:

  1. 一些未迁移到phi的算子(当前可迁移的算子issue [PHI] Functionalization for Fluid kernel #52395 支持中,另有部分短期无法迁移的算子,包括控制流、cinn_launch、run_program等)
  2. 未正确注册输出参数信息的算子(issue Good first issue for phi kernel output definition #51292 支持中)
  3. mkldnn(依赖于layout解耦onednn)
  4. cuda graph(之前第一轮无法做capture,全静态选kernel后可以做capture,但需做代码适配)
  5. 用户自定义算子(需另出方案支持)

后续全静态选kernel将在进行更多模型测试之后默认开启。

@paddle-bot
Copy link

paddle-bot bot commented Mar 3, 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.

From00 added 28 commits March 5, 2023 15:24
Comment on lines +382 to +386
template void Copy(const DeviceContext& dev_ctx,
const TensorArray& src,
Place dst_place,
bool blocking,
TensorArray* dst);
Copy link
Contributor

Choose a reason for hiding this comment

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

需要实例化基类DeviceContext的接口吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

实际调用是通过基类DeviceContext调用。
有部分Context实例化当前还没有场景使用到,这里接口的实例化对齐了TenosrBase的其它子类,对所有可能涉及的Context类型都统一做了实例化,后续有新需求时不用额外补充,避免零散化。

kernel->OutputAt(1).SetDataType(phi::DataType::UNDEFINED);
const phi::DataType& dtype = kernel_key.dtype();
const phi::DataType& out_dtype =
IsComplexType(dtype) ? dtype : ToComplexType(dtype);
Copy link
Contributor

@zyfncg zyfncg Apr 3, 2023

Choose a reason for hiding this comment

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

这里为什么没有使用phi::dtype::ToComplex

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

zhiqiu
zhiqiu previously approved these changes Apr 3, 2023
Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

lgtm for change tools/windows/run_unittests.sh

Copy link
Contributor

@XieYunshen XieYunshen left a comment

Choose a reason for hiding this comment

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

LGTM
单测执行时间设置

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@From00 From00 merged commit 5bac67d into PaddlePaddle:develop Apr 4, 2023
@From00 From00 deleted the improve-new-executor-static-build branch April 5, 2023 09:03
@engineer1109
Copy link
Contributor

engineer1109 commented Apr 6, 2023

paddle/phi/core/selected_rows.h
出错
void set_type(const DataType dtype) { impl_->set_type(dtype); }

[build] In file included from ../third_party/paddle/include/paddle/phi/core/selected_rows.h:24,
[build]                  from ../third_party/paddle/include/paddle/phi/core/tensor_utils.h:19,
[build]                  from ../third_party/paddle/include/paddle/phi/core/kernel_context.h:24,
[build]                  from ../third_party/paddle/include/paddle/phi/include/core.h:20,
[build]                  from ../third_party/paddle/include/paddle/phi/extension.h:9,
[build]                  from ../source/paddle_opencl_plugin/xdx_divide_kernel.cc:3:
[build] ../third_party/paddle/include/paddle/phi/core/selected_rows_impl.h: In member function ‘void phi::SelectedRowsImpl::set_type(phi::DataType)’:
[build] ../third_party/paddle/include/paddle/phi/core/selected_rows_impl.h:162:49: error: ‘class phi::DenseTensor’ has no member named ‘set_type’
[build]   162 |   void set_type(const DataType dtype) { value_->set_type(dtype); }

Custom Device插件模式下引用出错tensor_utils.h出错
set_type是PADDLE_WITH_CUSTOM_KERNEL下不可见的函数

void set_layout(const DataLayout layout) { value_->set_layout(layout); }

也一样

@From00
Copy link
Contributor Author

From00 commented Apr 6, 2023

paddle/phi/core/selected_rows.h 出错 void set_type(const DataType dtype) { impl_->set_type(dtype); }

[build] In file included from ../third_party/paddle/include/paddle/phi/core/selected_rows.h:24,
[build]                  from ../third_party/paddle/include/paddle/phi/core/tensor_utils.h:19,
[build]                  from ../third_party/paddle/include/paddle/phi/core/kernel_context.h:24,
[build]                  from ../third_party/paddle/include/paddle/phi/include/core.h:20,
[build]                  from ../third_party/paddle/include/paddle/phi/extension.h:9,
[build]                  from ../source/paddle_opencl_plugin/xdx_divide_kernel.cc:3:
[build] ../third_party/paddle/include/paddle/phi/core/selected_rows_impl.h: In member function ‘void phi::SelectedRowsImpl::set_type(phi::DataType)’:
[build] ../third_party/paddle/include/paddle/phi/core/selected_rows_impl.h:162:49: error: ‘class phi::DenseTensor’ has no member named ‘set_type’
[build]   162 |   void set_type(const DataType dtype) { value_->set_type(dtype); }

Custom Device插件模式下引用出错tensor_utils.h出错 set_type是PADDLE_WITH_CUSTOM_KERNEL下不可见的函数

void set_layout(const DataLayout layout) { value_->set_layout(layout); }

也一样

@engineer1109 已提PR修复:#52591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants