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

Use permanent temporaries in descriptor for minimum cache misses #46

Closed
mattsignorelli opened this issue Dec 19, 2023 · 5 comments
Closed

Comments

@mattsignorelli
Copy link
Contributor

No description provided.

@mattsignorelli
Copy link
Contributor Author

https://github.com/jump-dev/MutableArithmetics.jl

This (hopefully) will make it very easy to handle temporaries and increase speed

@mattsignorelli
Copy link
Contributor Author

mattsignorelli commented Dec 26, 2023

https://github.com/jump-dev/MutableArithmetics.jl

This (hopefully) will make it very easy to handle temporaries and increase speed

After a while of trying to learn the very not well documented API for this interface, I found this only works for simple arithmetic (+,-,*,/) and no other functions, therefore I think it we will have to write our own temporary management. One idea I have is to have a macro @usetemps which appends some symbol to each of the operators ( similar to @. ) and converts the product of the expression to heap allocated TPS or ComplexTPS. Those special operators with appended symbols return temporary types which have special behaviors / avoid heap allocation if possible. If a temporary is included in the evaluation, it can be reused or mutated.

@mattsignorelli
Copy link
Contributor Author

This actually doesn't work, because you'd have to basically redefine PEMDAS

@mattsignorelli
Copy link
Contributor Author

The solution for this will be to define a macro that replaces all +, -, *, /, ^ symbols with other overloaded infix symbols of same precendence (see here) . These overloaded symbols will be transparent to all types except for TPSs, which will use special temporary functions. All other known overloaded functions (sin, cos, etc) will be converted in the macro to something like _sin_t which will also be transparent to all types except TPSs. The macro will then wrap the expression in a function that copies the resulting TPS temporary type into a TPS, or be transparent if not. The macro will have to be appended to all expressions

@mattsignorelli
Copy link
Contributor Author

Implemented with @FastGTPSA

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

No branches or pull requests

1 participant