Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1380,3 +1380,61 @@ this section verbatim). Each entry is one bullet starting with `- `.
retaining `memory_spans` as the extension fallback. Preserve its exact
emptiness semantics: a zero-length contiguous span is still one span, but
a strided view with an empty outer dimension has none.

125. **A separately serialized header can sever a raw buffer's aliases.**
A struct's array can also be reachable through a Dict, Ref, non-isbits
array, SimpleVector, or cyclic header graph. Serializing that header
apart from its raw array duplicates the array and loses sharing. Trace
serialized header contents with an identity visited set and fall back
for sharing or unsupported array backends. Dict serializes entries, so
scalar key/value dictionaries need no graph allocation; Julia 1.11+
Memory storage must be handled when walking ordinary containers. Test
actual serialization and cross-rank identity, not a fallback that simply
returns the original object.
Empty arrays share object identity even though `mightalias` reports no
memory overlap. Check `===` too, and inspect immutable array-wrapper
fields: an isbits element type does not make the wrapper's parent scalar.
Flat immutable wrapper headers need no visited-set allocation when their
direct fields are atomic metadata or host buffers of bits. Keep the full
identity memo for complex graphs; repeated immutable subgraphs can share
mutable descendants too.

A header's custom Serialization codec can reach raw arrays through a
registry even when no field contains them. Check codecs before scalar or
isbits shortcuts, including nested bits fields and scalar Dict entries.
A graph walk only describes supported standard codecs; custom dispatch
must keep the whole object in one stream. Invalidate both header and outer
eligibility answers after later Serialization method definitions.

Transport also creates containers the original stream never serialized:
the tuple of retained fields, the tuple of shapes, and the complete header
tuple. A custom codec for any such tuple can run
unexpectedly even when every original field uses standard serialization.
Validate these synthetic containers and their exact type-value metadata
before taking the raw path. Preserve the dimensions tuples' codecs too:
ordinary multidimensional array serialization already calls them. Compare
ordinary struct serialization with the transport round trip; checking only
the original fields misses this case.

126. **Reflect type-value dispatch with `Core.Typeof`, not `Type{T}`.**
Julia 1.14's closed type values have exact egality dispatch keys. A
`which(deserialize, Tuple{Serializer{IOBuffer}, Type{T}})` query can fail
even though deserializing the actual concrete type calls the generic
`DataType` codec; catching that error silently disabled every automatic
raw transport. Query `Core.Typeof(T)` instead. For a type-valued header,
distinguish its exact serializer key from its runtime type passed to
deserialization, and retain custom-codec guards and world invalidation.

127. **Type values are serialized graphs, not scalar metadata.** The standard
DataType codec serializes each parameter, and a custom codec for an
isbits parameter can recover a raw array from a registry. Check parameter
codecs before treating a type-valued header as atomic. Include the outer
value's type, which MPI sends alongside its header, and the serialized
type of every header value, even an empty dictionary. Visit actual Type
keys/values in dictionaries instead of skipping them by their field type.
Keep function metadata, whole type definitions and unsupported type
representations in the ordinary stream. Cache codec checks by both
serializer key and the type passed to deserialization when they differ.
Memoize atomic metadata per method world too: a shared type DAG such as
`T = Tuple{T,T}` has linear serialized size, but an uncached recursive
validation walks exponentially many parameter occurrences.
Loading
Loading