Repository navigation
Commit b8c603d
Only make isbits parameter buffers static
`FullSpecialize` was turning every parameter buffer into a `StaticArray`,
including ones whose elements are heap objects. That buys nothing — an
`MVector{1, Vector{Float64}}` still holds a pointer, so it is no more
GPU-resident than a `Vector{Vector{Float64}}` — and it breaks two ways:
`MArray` refuses `setindex!` on a non-isbits eltype (the FMI array-valued
discrete write), and the `SizedVector` workaround for that makes `remake`
recurse forever, because `similar_type` is a no-op on a fully parameterized
`SizedVector{N, T, Vector{T}}`.
Gate on `isbitstype` in both places that pick a buffer type: the generated
map's `_static_initialization_buffer`, and the `get_p_constructor` closure the
reconstructor routes through. Both sides have to use the same rule or the map
and `MTKParametersReconstructor` disagree on the buffer type. `get_p_constructor`
only started seeing non-isbits buffers because this PR is what makes `pType`
static in the first place.
Tunable and initials buffers are isbits and stay `MVector`, which is the
allocation and GPU win this PR is for.
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Agent-Harness: Claude Code 2.0.14
Agent-Model: claude-opus-5[1m]
Agent-Session: https://claude.ai/code/session_01GdSpCLd7NBZuuePJmcDzU7
Claude-Session: https://claude.ai/code/session_01GdSpCLd7NBZuuePJmcDzU71 parent fed8cdb commit b8c603d
3 files changed
Lines changed: 36 additions & 4 deletions
File tree
- lib/ModelingToolkitBase
- src
- systems
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1712 | 1712 | | |
1713 | 1713 | | |
1714 | 1714 | | |
1715 | | - | |
| 1715 | + | |
1716 | 1716 | | |
1717 | 1717 | | |
1718 | 1718 | | |
| |||
1892 | 1892 | | |
1893 | 1893 | | |
1894 | 1894 | | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
1895 | 1900 | | |
1896 | 1901 | | |
1897 | 1902 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1896 | 1896 | | |
1897 | 1897 | | |
1898 | 1898 | | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
1899 | 1903 | | |
1900 | | - | |
| 1904 | + | |
1901 | 1905 | | |
1902 | 1906 | | |
1903 | 1907 | | |
| |||
1961 | 1965 | | |
1962 | 1966 | | |
1963 | 1967 | | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
1964 | 1991 | | |
1965 | 1992 | | |
1966 | 1993 | | |
| |||
0 commit comments