-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
add maximum limit for grid of index_select #41127
add maximum limit for grid of index_select #41127
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -21,6 +21,15 @@ | |||
|
|||
namespace phi { | |||
|
|||
namespace { | |||
template <typename Context> | |||
void LimitGridDim(const Context& ctx, unsigned int* grid_dim) { |
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.
这个函数是不是可以抽取出来,放在公共的文件中,不用每个算子都再定义一次?
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.
已经挪动至paddle/fluid/platform/device/gpu/gpu_launch_config.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.
LGTM
fc66134
to
417f5a5
Compare
417f5a5
to
841c148
Compare
stream>>>(in_grad_data, numel); | ||
int block_dim = 256; | ||
dim3 grid_dim = | ||
dim3((numel + PADDLE_CUDA_NUM_THREADS - 1) / PADDLE_CUDA_NUM_THREADS); |
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.
这里block和grid的设置没有对应上,设置了block dim为256,grid就应该向上对齐block_dim
,PADDLE_CUDA_NUM_THREADS
是512
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.
已经修改,感谢!
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
dd7fb6c
to
acfcfe7
Compare
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 op benchmark
PR types
Bug fixes
PR changes
OPs
Describe
The grid number of index_select has not been limited, which may raise a bug like:
So we add a maximum limit for grid of index_select kernel.