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

Optimize TensorBase::copy_from for non-contiguous self #166

Merged
merged 1 commit into from
May 10, 2024

Conversation

robertknight
Copy link
Owner

Replace the slow iterator-based fallback in TensorBase::copy_from with a much faster version which uses nested loops over the innermost 4 dimensions.

This reduces time in the Pad operator from ~4.5ms to ~0.8ms in Piper TTS models. That operator used the fallback because it creates a non-contiguous view of the non-padded region into which it copies the source.

Replace the slow iterator-based fallback in `TensorBase::copy_from` with a much
faster version which uses nested loops over the innermost 4 dimensions.

This reduces time in the `Pad` operator from ~4.5ms to ~0.8ms in Piper TTS
models. That operator used the fallback because it creates a non-contiguous view
of the non-padded region into which it copies the source.
@robertknight robertknight merged commit 41d8653 into main May 10, 2024
2 checks passed
@robertknight robertknight deleted the faster-non-contiguous-copy branch May 10, 2024 17:11
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.

1 participant