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

dev empty op #4720

Merged
merged 25 commits into from
Apr 26, 2021
Merged

dev empty op #4720

merged 25 commits into from
Apr 26, 2021

Conversation

doombeaker
Copy link
Contributor

@doombeaker doombeaker commented Apr 23, 2021

概述

empty 算子,即根据用户设置的形状和类型,创建张量(分配内存空间),但是不写内存。

功能 CheckList

注意 : 功能复选框均为可选项,若未选择,说明理由即可。例如:该 Op 由 Python 接口拼接而成,因此无 SetBatchAxisInferFn Op 注册;再比如:该 Op 无输入,因此无 SetInputArgModifyFn

模板中自带的复选框可留空,但是不能删除。可根据实际情况增加复选框选项。

Op

  • Op SetBatchAxisInferFn 系统已经没有了(这个模板需要更新)
  • Op SetGetSbpFn
  • Op SetInputArgModifyFn 没有相关需求(如 inplace)
  • SetInferDataTypeFn
  • Op 反向梯度注册:参考的 constant,它没注册,所以就没个 empty 注册反向。逻辑上感觉 empty 也没有反向。

Kernel

  • CPU in:float32

  • CPU in:float64

  • CPU in:int32

  • CPU in:int64

  • CPU in:int8

  • GPU in:float32

  • GPU in:float64

  • GPU in:int32

  • GPU in:int64

  • GPU in:float16

  • GPU in:int8

Python Wrapper

  • Python API 参数检查及异常提示
  • 接口注释
  • Example 

测试

本地原本测试了:

  • 单机单卡 CPU Test Case
  • 单机单卡 GPU Test Case
  • 单机多卡 CPU Test Case
  • 单机多卡 GPU Test Case
  • 分布式 CPU Test Case
  • 分布式 GPU Test Case

不过 PR 转正前根据 comment 去掉了 test case

GPU 有效带宽

带 GPU 的 Op,请参考 https://github.com/Oneflow-Inc/OneTeam/issues/167 测试有效带宽,并附带测试报告。
以下是报告样例:

Kernel 里,没有内存的写入操作,未做。

PR Checklist

  • PR 标题语句通畅,明确表达 PR 内容,适合直接作为新版本发布时的 changelog
  • 代码格式化
  • 已经本地编译通过
  • 已本地针对改动测试
  • 已添加 type 标签:(填写 type 标签名,如 bug, enhancement, purge, feature, documentation)
  • 已添加 component 标签:(填写 component 标签名,如 op, system, eager, build, xla, python, ci, test, tooling, onnx)
  • Draft 转正式 PR 前已请人 Review

@doombeaker doombeaker requested review from clackhan and oneflow-ci-bot and removed request for oneflow-ci-bot April 23, 2021 12:25
Comment on lines 56 to 60
@flow.global_function()
def empty_Job() -> tp.Numpy:
empty_blob = flow.empty(shape=(1, 3, 3),
dtype=flow.float)
return empty_blob
Copy link
Contributor

Choose a reason for hiding this comment

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

这些注释回头都得改为multi-client下的。

Copy link
Contributor

Choose a reason for hiding this comment

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

这一加一个ToDo(yaochi):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个 “multi-client 下的” 的意思,是不是指 interface 正在做的,按 Module 方式调用的新 API 呢?
如果是这样的话,我就暂时不写 TODO 了,因为未来(1.0发布之前),所有的注释会集中改一遍。

@doombeaker

This comment has been minimized.

Comment on lines 56 to 60
@flow.global_function()
def empty_Job() -> tp.Numpy:
empty_blob = flow.empty(shape=(1, 3, 3),
dtype=flow.float)
return empty_blob
Copy link
Contributor

Choose a reason for hiding this comment

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

这一加一个ToDo(yaochi):

@doombeaker doombeaker marked this pull request as ready for review April 26, 2021 07:39
@clackhan clackhan requested a review from oneflow-ci-bot April 26, 2021 07:50
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot April 26, 2021 08:39
@oneflow-ci-bot oneflow-ci-bot merged commit 591021f into master Apr 26, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the dev_empty_op branch April 26, 2021 09:31
liujuncheng pushed a commit that referenced this pull request Jun 3, 2021
* startup

* empty op finished

* add sbp signature

* refine test case for fp16

* try to fix sbp problem

* refien sbpGetFn

* add sbp config attr

* refine

* refine

* add balancedSpliter and add parallel check on py

* refine

* add partialSum parallel support

* unexported empty and rm its test case

* rm python wrapper for empty op

Co-authored-by: Li Xinqi <lixinqi2010@gmail.com>
Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
Former-commit-id: 591021f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants