Closed devmotion closed 5 years ago
The user is supposed to pass a value type. The partials have to be known at compile time for the tuple length.
If all we have is the length, we determine it at cache construction time so the type is gotten once, and then further function calls have it all inferred. It's the same in ForwardDiff and not the bad example there.
I'm just desperately trying to find all possible issues and was confused by the default_chunk_size
function and the fact that integers are "converted" to Val
s. But then this is probably not a major issue, it seems.
It seems, the function in lines https://github.com/JuliaDiffEq/SparseDiffTools.jl/blob/master/src/differentiation/compute_jacobian_ad.jl#L10-L16 is equivalent to the bad example in https://docs.julialang.org/en/v1/manual/performance-tips/index.html#Types-with-values-as-parameters-1? Should it just be
chunksize = max(maximum(colors), DEFAULT_CHUNK_SIZE)
in https://github.com/JuliaDiffEq/SparseDiffTools.jl/blob/master/src/differentiation/compute_jacobian_ad.jl#L27 instead? Or could theVal
instance still be helpful when callinggenerate_chunked_partials
?But then still the same problem appears in https://github.com/JuliaDiffEq/SparseDiffTools.jl/blob/master/src/differentiation/compute_jacobian_ad.jl#L46?