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

cache construction is no longer type stable #469

Open
avik-pal opened this issue Oct 1, 2024 · 10 comments
Open

cache construction is no longer type stable #469

avik-pal opened this issue Oct 1, 2024 · 10 comments

Comments

@avik-pal
Copy link
Member

avik-pal commented Oct 1, 2024

I will generate a MWE but the DI extras is not type stable, atleast in the bruss case I tested.

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

That is unfortunately expected, as preparation implies dynamically choosing a chunk/batch size B and then putting seeds in batches with type NTuple{B}. It is a bit similar to ForwardDiff's preparation in that sense. I have opened gdalle/DifferentiationInterface.jl#534 to keep track and brainstorm

@avik-pal
Copy link
Member Author

avik-pal commented Oct 3, 2024

In this case I was testing with a concrete chunksize specified. Without chunksize our code was type-unstable as well.

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

On my way to fixing it in gdalle/DifferentiationInterface.jl#535

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

Can you confirm that cache construction only used to be type-stable for sparse Jacobians? For dense Jacobians with ForwardDiff I don't see a way to get past ForwardDiff.Chunk(x), which is type-unstable

@avik-pal
Copy link
Member Author

avik-pal commented Oct 3, 2024

For dense it used to be type stable if AutoForwardDiff had chunksize specified, else it would be type-unstable.

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

Okay I need to look at how you achieved type stability in the dense case. Can you point me to where that code lived?
nevermind, I figured it out

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

Wait no I still don't have it, how do you statically set a chunk size while ensuring it always remains smaller than the vector length? Do you just let it error if the chunk is too big?

@avik-pal
Copy link
Member Author

avik-pal commented Oct 3, 2024

I think that case should be an error

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

Alright I hadn't understood it that way.

@gdalle
Copy link
Collaborator

gdalle commented Oct 3, 2024

This issue should be fixed by DI v0.6.5, wanna check?

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