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

feat: reduce computations in backprop of lfilter #3831

Merged
merged 5 commits into from
Sep 14, 2024

Conversation

yoyolicoris
Copy link
Collaborator

This PR update the backpropagation computation of DifferentiableIIR.
The update is based on my recent work (https://arxiv.org/abs/2406.05128), which uses just one DifferentiableIIR::apply instead of two to compute the gradients for both input and a_coeffs. The algorithm has been tested in torchlpc.

Below is the benchmark to version 2.4.1 lfilter.
The backward computation runs slightly faster especially when using just one thread.

v2.4.1

[-------------- IIR filter -------------]
                  |  forward  |  backward
1 threads: ------------------------------
      [32, 256]   |    404.0  |   1104.5
      [32, 1024]  |    694.3  |   1783.2
      [32, 4096]  |   2637.1  |   6579.2
2 threads: ------------------------------
      [32, 256]   |    381.5  |   1110.2
      [32, 1024]  |    574.7  |   1638.3
      [32, 4096]  |   1729.0  |   5724.7
4 threads: ------------------------------
      [32, 256]   |    362.9  |   1084.0
      [32, 1024]  |    502.0  |   1537.7
      [32, 4096]  |   1485.5  |   5376.4

Times are in microseconds (us).

This version

[-------------- IIR filter -------------]
                  |  forward  |  backward
1 threads: ------------------------------
      [32, 256]   |    391.9  |    935.1
      [32, 1024]  |    678.7  |   1499.8
      [32, 4096]  |   2481.2  |   5782.2
2 threads: ------------------------------
      [32, 256]   |    371.5  |    994.5
      [32, 1024]  |    550.3  |   1551.0
      [32, 4096]  |   1655.0  |   5896.0
4 threads: ------------------------------
      [32, 256]   |    349.1  |    981.6
      [32, 1024]  |    484.8  |   1518.2
      [32, 4096]  |   1380.2  |   4969.1

Times are in microseconds (us).

Copy link

pytorch-bot bot commented Sep 10, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/audio/3831

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

❌ 2 New Failures, 3 Cancelled Jobs, 6 Unrelated Failures

As of commit 28575a7 with merge base 97ed7b3 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

Copy link
Collaborator

@mthrok mthrok left a comment

Choose a reason for hiding this comment

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

Thanks, looks good. Do you want to update the docstring to mention the new algorithm / paper?

@yoyolicoris
Copy link
Collaborator Author

Thanks, looks good. Do you want to update the docstring to mention the new algorithm / paper?

Oh, sure, I totally forgot. Will update the docstring later this week.

@yoyolicoris
Copy link
Collaborator Author

The code passes related unit tests on my computer.

@yoyolicoris yoyolicoris merged commit ba696ea into pytorch:main Sep 14, 2024
35 of 46 checks passed
@yoyolicoris yoyolicoris deleted the feat/faster-lfilter-backprop branch September 14, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants