Make Polyester a weak dependency (extension)#73
Merged
ChrisRackauckas merged 4 commits intoSciML:masterfrom Mar 29, 2026
Merged
Make Polyester a weak dependency (extension)#73ChrisRackauckas merged 4 commits intoSciML:masterfrom
ChrisRackauckas merged 4 commits intoSciML:masterfrom
Conversation
…ispatch v0.4.0 removed Static.jl but broke runtime threading dispatch — `@.. thread=var` where `var` is a runtime variable now always takes the threaded path because the macro checks `if threadarg` which is truthy for any non-false Symbol/Expr. This adds: - `Sequential` and `PolyesterThreads` exported types for explicit threading control - Runtime-dispatched `fast_materialize!(::Sequential, dst, bc)` and `fast_materialize!(::PolyesterThreads, dst, bc)` methods - Bool backwards compat methods - Macro logic to emit runtime dispatch when `thread=` receives a non-literal value This enables OrdinaryDiffEqCore to use these types in algorithm structs instead of `Static.True`/`Static.False`, removing the Static.jl dependency chain which causes ~2200 method invalidations. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.4.0 removed Static.jl but broke runtime threading dispatch — `@.. thread=var` where `var` is a runtime variable always takes the threaded path because the macro checks `if threadarg` which is truthy for any non-false Symbol/Expr. This adds: - `fast_materialize!(::Bool, dst, bc)` and `fast_materialize(::Bool, bc)` methods for runtime dispatch (true → Polyester threaded, false → serial) - Macro logic to emit runtime dispatch when `thread=` receives a non-literal value, and keep compile-time selection for literal `true`/`false` Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move threaded broadcast implementation (`fast_materialize_threaded!`, `fast_materialize_threaded`, `_batch_broadcast_fn`) to FastBroadcastPolyesterExt. The main module defines bare function stubs that get methods added when Polyester is loaded. This removes Polyester (and its transitive deps: Static, CommonWorldInvalidations, StrideArraysCore, CloseOpenIntervals, etc.) from the mandatory dependency tree, reducing load time and method invalidations for users who don't need threaded broadcasting. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Closed
1 task
Member
|
needs docs, a fallback method with a good error and the code looks a little janky, but looks good in theory |
2 tasks
- Add docstrings to fast_materialize_threaded/fast_materialize_threaded! - Add fallback methods that error with a clear message when Polyester isn't loaded - Update @.. docstring to mention Polyester requirement for threading Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Addressed review:
|
oscardssmith
approved these changes
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fast_materialize_threaded!/fast_materialize_threaded/_batch_broadcast_fntoFastBroadcastPolyesterExt[deps]to[weakdeps]with an[extensions]entry[extras]/[targets]so tests still load itBuilds on #72 (runtime Bool dispatch fix).
Motivation
Polyester pulls in Static.jl, CommonWorldInvalidations, StrideArraysCore, CloseOpenIntervals, and other packages that cause significant method invalidations. Users who don't need threaded broadcasting (the common case —
thread=falseis the default) shouldn't pay this cost.For OrdinaryDiffEqCore, Polyester is already a direct dependency for
@threaded/@batch, so the extension loads automatically. But lighter downstream packages that only use@..without threading avoid the entire Polyester dep tree.Test plan
🤖 Generated with Claude Code