Skip to content

Fix 32-bit failures: Difference hash seed widening and optimal_svht Int32 - #688

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/difference-hash-32bit
Oct 10, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/difference-hash-32bit

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

Summary

Two genuine 32-bit bugs in DataDrivenDiffEq (not dependency build failures):

  1. Base.hash(D::Difference, u::UInt) (src/difference.jl:41) xored the native-width seed u against a bare literal 0x055640d6d952f101, which does not fit in UInt32. On 32-bit builds the xor silently widens to UInt64, then hash(D.t, ::UInt64) has no SymbolicUtils method (hashcons expects native UInt). Fix: 0x055640d6d952f101 % UInt.

  2. optimal_svht(m::Int64, n::Int64) (src/utils/utils.jl:6) — size(...) returns Int (Int32 on 32-bit), so Optimal Shrinkage in test/Core/utils.jl threw MethodError: no method matching optimal_svht(::Int32, ::Int32) on the PR's x86 lane after (1) was fixed. Fix: widen to optimal_svht(m::Integer, n::Integer; ...).

This is unrelated to #680 (BFloat16s/NNlib i686). BFloat16s installed cleanly in the failing runs; these are DataDrivenDiffEq hashing / Int-width bugs.

Verification

Hash seed (julia +1~x86, no packages):

WORD_SIZE=32 UInt=UInt32
xor(UInt(1), lit) typeof=UInt64   # widens — MethodError downstream
xor(UInt(1), lit % UInt) typeof=UInt32  # stays native

optimal_svht (julia +1~x86):

BEFORE Int FAIL: MethodError: no method matching optimal_svht_old(::Int32, ::Int32)
AFTER Int: 0.5
AFTER Int32: 0.5
AFTER Int64: 0.5

CI evidence: master run https://github.com/SciML/DataDrivenDiffEq.jl/actions/runs/35188714123 (hash MethodError); PR x86 job after hash-only commit still failed on optimal_svht(::Int32, ::Int32) in test/Core/utils.jl:20.

Risk assessment

  • Risk: low
  • Blast radius: Difference hash (discrete-time ops) and optimal_svht/optimal_shrinkage (SVD threshold). No public API signature removals; Integer is a strict widening of Int64.
  • Evidence: fail-before/pass-after probes on real 32-bit Julia 1.13.1 above; prior PR commit already greened implicit_basis.jl on x86 CI.
  • Independent review: Claude Code (claude-opus-5-5) top-reviewer pass on head ea74885: MERGE, no blocking findings; it notes that the hash test only discriminates on 32-bit CI. The hash fix was written by Claude Code (Sonnet), so a non-Claude top review (Astra) is still pending.
  • Merge: needs human review — Ignore until reviewed by @ChrisRackauckas

🤖 Generated with Cursor Agent CLI (model: auto) — session: local transcript ~/sandbox/goals/ci-green/work/cig-x86/log.txt on amdci2

🤖 Hash-seed fix (6c1d2a3) generated with Claude Code (model: claude-sonnet-5-5), subagent of the qa-hygiene head session https://claude.ai/code/session_01QgnmpexRwud38wrs3XvBfV

ChrisRackauckas and others added 3 commits October 3, 2026 08:18
Base.hash(::Difference, ::UInt) xored the native-width seed `u`
against a bare literal (0x055640d6d952f101), which only fits
UInt64. On 32-bit builds, where UInt == UInt32, this silently
widens the xor result to UInt64, so the subsequent
hash(D.t, ::UInt64) call on the SymbolicUtils term has no matching
method (SymbolicUtils's hashconsing expects the platform's native
UInt). Reducing the literal with `% UInt` keeps the result in the
caller's native width on every platform.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Agent-Harness: Claude Code
Agent-Model: claude-sonnet-5-5
Agent-Session: subagent of the qa-hygiene head session on amdci2
size(...) returns Int, which is Int32 on 32-bit Julia. optimal_svht was
only defined for Int64, so Optimal Shrinkage in test/Core/utils.jl threw
MethodError on the x86 Core lane after the Difference hash fix landed.
Widen the signature to Integer so both architectures dispatch.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent CLI
Agent-Model: auto
Agent-Session: ~/sandbox/goals/ci-green/work/cig-x86/log.txt (local transcript, amdci2)
Call optimal_svht with Int32 arguments so unfixed Int64-only code
fails on every platform, and rewrite the new test comments as
invariants (no CI links or history narration).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent CLI
Agent-Model: auto
Agent-Session: ~/sandbox/goals/ci-green/work/cig-x86/log.txt (local transcript, amdci2)
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Fix Difference hash seed widening on 32-bit (UInt == UInt32) Fix 32-bit failures: Difference hash seed widening and optimal_svht Int32 Oct 7, 2026
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 10, 2026 00:28
@ChrisRackauckas
ChrisRackauckas merged commit 148d096 into SciML:master Oct 10, 2026
24 checks passed
ChrisRackauckas referenced this pull request Oct 14, 2026
Agent-Harness: Devin CLI 3000.11.3
Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants