Skip to content
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

add backward of conv2d #365

Merged
merged 11 commits into from
Feb 7, 2025
Merged

add backward of conv2d #365

merged 11 commits into from
Feb 7, 2025

Conversation

FatJhon
Copy link
Collaborator

@FatJhon FatJhon commented Dec 16, 2024

add backwards of input weight bias for conv.

Copy link
Collaborator

@Galaxy1458 Galaxy1458 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Could you provide performance data for our comparative analysis?

Copy link
Collaborator

@StrongSpoon StrongSpoon left a comment

Choose a reason for hiding this comment

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

there is error in benchmark. please solve it.

tests/test_reduction_ops.py Outdated Show resolved Hide resolved
src/flag_gems/ops/conv2d.py Show resolved Hide resolved
if stride_height > 1 or stride_width > 1:
for i in range(out_grad.shape[2]):
for j in range(out_grad.shape[3]):
new_out[:, :, i * (stride_height), j * (stride_width)] = out_grad[
Copy link
Collaborator

Choose a reason for hiding this comment

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

this assignment will cost a lot of time. is there a better way?

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe you can reference to the implementation in flip and use a copy_func to fill the elements in new_out.

src/flag_gems/ops/conv2d.py Show resolved Hide resolved
@StrongSpoon StrongSpoon mentioned this pull request Jan 20, 2025
Copy link
Collaborator

@StrongSpoon StrongSpoon left a comment

Choose a reason for hiding this comment

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

done

tests/test_reduction_ops.py Outdated Show resolved Hide resolved

gems_assert_close(res_in_grad, ref_in_grad.to(dtype), dtype)
gems_assert_close(
res_weight_grad, ref_weight_grad, dtype, reduce_dim=weight.shape[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should reconsider the value of reduce_dim. but it's alright for now.

Copy link
Collaborator

@StrongSpoon StrongSpoon left a comment

Choose a reason for hiding this comment

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

lg

@FatJhon FatJhon merged commit c7fdebd into master Feb 7, 2025
8 of 9 checks passed
@FatJhon FatJhon deleted the dev_xcoresigma_jiangbin_deconv branch February 7, 2025 08:36
DuanYaQi pushed a commit that referenced this pull request Feb 18, 2025
* add backward of conv2d

* delete useless code

* format code of tests

* modify configs for tuning

* modify autotune config

* delete test flag

* delete useless type convert

---------

Co-authored-by: Jiang Bin <[email protected]>
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.

4 participants