-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Reshard] Support reshard s to s on same placement #57210
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
17f53e7
to
0316a9c
Compare
|
||
#include "paddle/phi/core/distributed/auto_parallel/s_to_s_reshard_function.h" | ||
|
||
#include "glog/logging.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个头文件好像没有使用
const auto& logical_ddim = in.dims(); | ||
int64_t nranks = in_process_ids.size(); | ||
int64_t in_split_axis = | ||
GetSplitAxisWithDimsMapping(in.dist_attr().dims_mapping()).begin()->first; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
会不会第一个之后还有非-1的维度
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在这个场景下,是没有的,因为限制了mesh的维度是1,也就是说这里只会出现一次shard axis。
|
||
DenseTensor out_reshape1; | ||
RESHARD_FUNCTOR( | ||
dev_ctx, Reshape, dtype, in.value(), pre_shape_vec, &out_reshape1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里reshape有没有可能引入不必要的拷贝,浅拷贝一个输入传进去会不会好一点
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reshape会修改值的排列顺序,暂时先避免可能对input底层DenseTensor产生的修改,后续有需要可以进一步优化
dev_ctx, Reshape, dtype, in.value(), pre_shape_vec, &out_reshape1); | ||
|
||
// 1.2 calc the the desire axis and transpose | ||
std::vector<int> axis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int64_t到int极端情况下是不是有可能截断,要不直接用vector int64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为axis不会超过32位的限制,已经全部改成vector int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for set_tests_properties(test_reshard_s_to_s PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 100)
* support reshard s to s * refine, remove useless code * reduce changable file
PR types
New features
PR changes
Others
Description
Pcard-73145
在一维mesh上shard到shard状态的转换,工作原理:
以形状为(a, b, c)的tensor在有n个进程的一维mesh上做切分转换为例。
TODO: