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

In-place all the things! (Arithmetic Edition) #119

Merged
merged 28 commits into from
Sep 24, 2019

Conversation

regexident
Copy link
Collaborator

@regexident regexident commented Sep 24, 2019

This PR adds …InPlace function variants (internal scoped) for every function in 'Arithmetic.swift', making use of the fact that Accelerate's functions commonly allow for aliasing of input and output buffers.

This PR is a non-breaking implementation detail change, with the main benefit of being able to have all variants of a certain arithmetic operation be based on a single efficient …InPlace implementation.

Currently these …InPlace variants are only exported public-ly by those functions with equivalent …= operators.

Given their clear performance & memory edge over their value-producing counter-parts due to a reduction of memory allocations & value copies however we might want to look into a way to export them public-ly without polluting the namespace.

Further more we might want to mark some of the thin wrapper functions as @inline as some call might trampoline several layers before reaching the actual …InPlace implementation?


Notable mention: this PR also eliminates several unnecessary temporary value allocations! 🎉

…ition/subtraction into shallow wrappers around it
… `sum`, `sq` & `sub` with minimal temporary array allocations
@regexident regexident changed the title In place all the things In-place all the things! (Arithmetic Edition) Sep 24, 2019
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