Array optimization: cull before fuse_roots#8560
Conversation
Because `fuse_roots` materializes Blockwise layers, if you have a situation where you're sub-selecting a few items out of a large initial Blockwise array, culling the graph (cheap) before materializing it (slow) can be massively more performant.
|
Although I’d like to remove I spent some time exploring One case where |
I'm all in favor of removing |
I took a rough pass at something like this in #9273 |
Because
fuse_rootsmaterializes Blockwise layers, if you have a situation where you're sub-selecting a few items out of a large initial Blockwise array, culling the graph (cheap) before materializing it (slow) can be massively more performant. As more becomes Blockwise (#7417), this will become more relevant. For example:I doubt this is exactly correct—maybe we need to cull again after
fuse_roots? (Culling is cheap but not that cheap; I'd like to not do it twice if possible.)Because it materializes, I also think
fuse_rootsshould perhaps go after theif config.get("optimization.fuse.active") is False: return dskbailout.Frankly, I don't understand
fuse_roots. The situation described in #5451 (comment), and the test for it, are already handled by plain Blockwise fusion. In fact, if I removefuse_rootsentirely,test_fuse_rootsstill passes!cc @rjzamora @ian-r-rose
pre-commit run --all-files