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

Overly strict enforcement of type equality for Duplicated #1441

Closed
andrinr opened this issue May 13, 2024 · 2 comments
Closed

Overly strict enforcement of type equality for Duplicated #1441

andrinr opened this issue May 13, 2024 · 2 comments

Comments

@andrinr
Copy link

andrinr commented May 13, 2024

As mentioned in the FAQ:

In some ways, type equality is too strict: two different types can have the same data layout. For instance, a vector and a view of a matrix column are arranged identically in memory.

I am rather new to Julia and I might be mistaken, however I am pretty sure that using views in combination of Enzyme are best practice for differentiating explicit forward solvers. Therefore It does not some ideal that we are not allowed to use Views here.

@wsmoses
Copy link
Member

wsmoses commented May 13, 2024

You can use views. You just must use the same offset view in primal and shadow values (this is checked by the constructor).

@wsmoses wsmoses closed this as completed May 13, 2024
@andrinr
Copy link
Author

andrinr commented May 16, 2024

But in most cases, the only the primal is a view, while the shadow is not, as we not need to keep track of the entire history of shadow variables. This is even the case in the Box Model example from the Enzyme.jl documentation (no views but copies are used): https://enzyme.mit.edu/julia/stable/generated/box/

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

2 participants