Closed marius311 closed 3 years ago
Since Cassette is the land of endless possibilty variants of that are indeed possible. You can write a bespoke pass that inserts Expr(:nooverdub, ...)
around the arguments to call.
Now what condition you want to have for that is up to you and depends on what you need to do.
Thanks, that's interesting. Another option I've found is basically what AutoPreallocation.jl does, just define a no-op overdub at the point you want to stop: https://github.com/oxinabox/AutoPreallocation.jl/blob/1013ac618749ac3bd3534162cb6c176e4c6d19bf/src/inference_fixes.jl#L3-L22
I'd love to use Cassette to do some nifty things with my code but just a no-op overdub already makes it run 10x slower (probably stuff related to https://github.com/jrevels/Cassette.jl/issues/91). My gut feeling (could well be wrong) is that if I could bail out of overdubbing before I get to the very bottom of my call tree, I can still do everything I want with the high-level function calls but not take the overhead. Is there any mechanism to do this, or would it even work? I'm thinking something like
prehook
could return a boolean of whether to actually overdub the expression, and if it was false, it would just call the original function.