Skip to content

Conversation

@yuanlehome
Copy link
Contributor

@yuanlehome yuanlehome commented Jul 4, 2024

PR Category

Inference

PR Types

Performance

Description

pcard-71500
Optimizing the performance of fused_layer_norm and top_p_sampling operators.

@paddle-bot
Copy link

paddle-bot bot commented Jul 4, 2024

你的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.

@yuanlehome yuanlehome changed the title optim fused_layer_norm and top_p_sampling Optimizing the performance of fused_layer_norm and top_p_sampling operators Jul 4, 2024
float random_ratio = exponential_transform(curand_uniform(&state), 1.0f);
float random_ratio =
exponential_transform(curand_uniform(states + bid), 1.0f);
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

这里也可以用GPU(rand_uniform)包起来

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

for (int i = idx; i < bs; i += gridDim.x * blockDim.x) {
if (need_batch_random) {
#ifdef PADDLE_WITH_HIP
hiprand_init(seed, i, offset, &state[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

函数也可以用宏定义:GPU(rand_init)

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

PD_THROW(
"the input data shape has error in the topp_beam_topk kernel.");
}
if (mode == "truncate") {
Copy link
Contributor

Choose a reason for hiding this comment

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

需要对应修改search.py的python接口的默认mode 为“truncate”

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.

3 participants