Skip to content

Conversation

@jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Mar 28, 2024

PR Category

CINN

PR Types

Performance

Description

pcard-76996

Test Case:

Op: paddle.sin
Shape: [1024, 4096], static shape
Dtype: float16
Improvement: 64.12%, performance is on par with phi

Before

__global__
void __launch_bounds__(256) fn_sin_0__COND__FPA__FPA__FPA_4194304llGE1ll_BPA_AND_FPA_4194304llLE2147483647ll_BPA__BPA_AND_FPA__FPA_1GE1ll_BPA_AND_FPA_1LE1ll_BPA__BPA__BPA___kernel(const float16* __restrict__ var, float16* __restrict__ var_0)
{
  if (((int)blockIdx.x < 16384)) {
    if (((int)threadIdx.x < 256)) {
      var_0[((((int)blockIdx.x / 16) * 4096ll) + ((256ll * ((int)blockIdx.x & 15)) + (int)threadIdx.x))] = cinn_nvgpu_sin_fp16(var[((((int)blockIdx.x / 16ll) * 4096ll) + ((256ll * ((int)blockIdx.x & 15)) + (int)threadIdx.x))]);
    };
  };
}
image

After

__global__
void __launch_bounds__(256) fn_sin_0__COND__FPA__FPA__FPA_4194304llGE1ll_BPA_AND_FPA_4194304llLE2147483647ll_BPA__BPA_AND_FPA__FPA_1GE1ll_BPA_AND_FPA_1LE1ll_BPA__BPA__BPA___kernel(const float16* __restrict__ var, float16* __restrict__ var_0)
{
  if (((int)blockIdx.x < 4096)) {
    if (((int)threadIdx.x < 256)) {
      var_0[((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x))] = cinn_nvgpu_sin_fp16(var[((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x))]);
      var_0[(1ll + ((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x)))] = cinn_nvgpu_sin_fp16(var[(1ll + ((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x)))]);
      var_0[(2ll + ((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x)))] = cinn_nvgpu_sin_fp16(var[(2ll + ((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x)))]);
      var_0[(3ll + ((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x)))] = cinn_nvgpu_sin_fp16(var[(3ll + ((1024ll * (int)blockIdx.x) + (4ll * (int)threadIdx.x)))]);
    };
  };
}
image

@paddle-bot
Copy link

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

@jiahy0825 jiahy0825 merged commit 1993810 into PaddlePaddle:develop Mar 29, 2024
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.

2 participants