Skip to content

Conversation

@cqulilujia
Copy link
Contributor

PR Category

Custom Device

PR Types

New features

Description

Support fp16 weight_scale in op weight_only_linear for XPU

@paddle-bot
Copy link

paddle-bot bot commented Jul 10, 2025

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

@paddle-bot paddle-bot bot added the XPU label Jul 10, 2025
@cqulilujia cqulilujia changed the title [XPU] support fp16 weight_scale in op weight_only_linear [XPU] support bf16 weight_scale in op weight_only_linear Jul 10, 2025
@cqulilujia
Copy link
Contributor Author

/re-run all-failed

@cqulilujia cqulilujia force-pushed the weight_only_linear branch from b144150 to 5265396 Compare July 11, 2025 07:01
@cqulilujia
Copy link
Contributor Author

/re-run all-failed

Copy link
Contributor

@lj970926 lj970926 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@RuohengMa RuohengMa left a comment

Choose a reason for hiding this comment

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

LGTM

PADDLE_ENFORCE_XDNN_SUCCESS(r, "cast");
}
const float* weight_scale_ptr = nullptr;
if (weight_scale.dims().size() != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么上面不需要考虑weight_scale.dims().size() != 0?这种情况调用cast会出错吗?

Copy link
Contributor

Choose a reason for hiding this comment

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

考虑scalar tensor,dims().size()可能为0,但是numel为1,考虑是否是从numel来判断

Copy link
Contributor Author

Choose a reason for hiding this comment

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

原有实现中dims().size()等于零时直接传nullptr进算子,所以不需要考虑scalar。cast出错风险我修一下

@cqulilujia cqulilujia force-pushed the weight_only_linear branch from 5265396 to dcf0cd2 Compare July 15, 2025 07:51
@cqulilujia
Copy link
Contributor Author

/re-run all-failed

@dynamicheart dynamicheart merged commit 29d0104 into PaddlePaddle:develop Jul 16, 2025
71 of 72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants