Skip to content

[XPU] matmul support new shapes #65963

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

Merged
merged 2 commits into from
Jul 12, 2024
Merged

Conversation

lj970926
Copy link
Contributor

@lj970926 lj970926 commented Jul 11, 2024

PR Category

Custom Device

PR Types

New features

Description

  1. fix bugs when x_dims >= 3, y_dims <= 2, and trans_x == True
    d9ed2ea4c8b0b193db5f128e6097507c

  2. support cases where x_dims <= 2, y_dims >= 3 and trans_y == True.

image

Copy link

paddle-bot bot commented Jul 11, 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.

y_dims.to_str(),
mat_dim_a.trans_,
mat_dim_b.trans_));
if (mat_dim_a.width_ == mat_dim_b.batch_size_ * mat_dim_b.height_) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里把b矩阵的batch_size和height拼在一起的行为是非法的,b矩阵的height必须严格等于a矩阵的width,具体可以看下面这个numpy的例子(Paddle的matmul接口在设计上与numpy.matmul行为保持一致):
image
这个分支唯一合法的情况是batch_size为1时,这种情况下该分支语句的语义和修改后的新写法是一致的

Copy link
Contributor

@cqulilujia cqulilujia left a comment

Choose a reason for hiding this comment

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

LGTM

@houj04 houj04 merged commit a55fec0 into PaddlePaddle:develop Jul 12, 2024
30 of 32 checks passed
lixcli pushed a commit to lixcli/Paddle that referenced this pull request Jul 22, 2024
* support matmul with x_dim >=3, y_dim <= 2 and trans_x = True

* add more tests
@houj04 houj04 added the XPU label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants