Skip to content

Conversation

hsharma35
Copy link
Contributor

Summary: Diff uses op_add_sub_impl to add bias after optimized gemm call.

Differential Revision: D75491158

Copy link

pytorch-bot bot commented May 29, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11210

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c6d1d2a with merge base 6875c8e (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 29, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

@hsharma35 hsharma35 added the release notes: none Do not include this in the release notes label May 29, 2025
hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 29, 2025
Summary:

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:
Pull Request resolved: pytorch#11210

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:

Diff uses `op_add_sub_impl` to add bias after optimized gemm call.

Reviewed By: zonglinpeng

Differential Revision: D75491158
hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 30, 2025
Summary:
Pull Request resolved: pytorch#11210

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

Copy link
Contributor

@kimishpatel kimishpatel left a comment

Choose a reason for hiding this comment

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

I want to block this for now in favor of landing the other fix for bias. mm.out -> linear.out is the right change though

Copy link
Contributor

@kimishpatel kimishpatel left a comment

Choose a reason for hiding this comment

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

ok so this diff does incorporate "idea" from the other diff so seems ok to me. but would like the test case to be updated

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 31, 2025
Summary:

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 31, 2025
Summary:
Pull Request resolved: pytorch#11210

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 31, 2025
Summary:

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 31, 2025
Summary:

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

hsharma35 added a commit to hsharma35/executorch that referenced this pull request May 31, 2025
Summary:

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

@hsharma35 hsharma35 requested a review from kimishpatel May 31, 2025 15:48
// Output is a n x m x scalar_t, while bias is m x scalar_t.
const size_t row_size = static_cast<size_t>(m) * sizeof(scalar_t);
for (const auto col : c10::irange(n)) {
std::memcpy(
Copy link
Contributor

Choose a reason for hiding this comment

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

To handle 2d bias, you need to fix this. Bias pointer is not advancing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, it's more complicated than that. bias can be 1xm, nx1, or nxm.

Copy link
Contributor

@kimishpatel kimishpatel left a comment

Choose a reason for hiding this comment

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

I am accepting this but do note that you want either some random values or "not-all-outputs-are-same" values. The test as is, is quite weak IMO.

Summary:

Diff initializes the output tensor before calling gemm with beta=1 when bias is non-nullopt.

Reviewed By: larryliu0820, zonglinpeng, kimishpatel

Differential Revision: D75491158
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75491158

@facebook-github-bot facebook-github-bot merged commit 95a1db5 into pytorch:main May 31, 2025
95 of 98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants