Skip to content

aurora_configs/allscaip: patch radius-graph image_id dtype for FP64 inference - #221

Merged
OwenPriceSkelly merged 2 commits into
mainfrom
aurora-allscaip-fp64-radius-graph
Sep 1, 2026
Merged

aurora_configs/allscaip: patch radius-graph image_id dtype for FP64 inference#221
OwenPriceSkelly merged 2 commits into
mainfrom
aurora-allscaip-fp64-radius-graph

Conversation

@OwenPriceSkelly

Copy link
Copy Markdown
Member

Fixes the two allscaip verify failures from the first Aurora sync (manifest pushed 2026-08-28T22:47Z).

Failure

Both allscaip-md-{conserving,direct}-all-omol verifies died on xpu with:

File ".../fairchem/core/models/allscaip/utils/allscaip_radius_graph.py", line 529, in build_radius_graph
    src_pos = pos[:, None] + torch.mm(image_id, cell)[None, :]
RuntimeError: expected mat1 and mat2 to have the same dtype, but got: float != double

Root cause

biknn_radius_graph builds its PBC image-offset tensors with torch.get_default_dtype() (float32) — both the PBC torch.cartesian_prod(torch.arange(...)) path and the non-PBC identity image — while this env's InferenceSettings(base_precision_dtype=float64) casts the batch, including cell, to double. Not XPU-specific: any FP64 run of AllScAIP hits it. The nvidia config runs default fp32 and never trips it; eSEN's graph path doesn't share the pattern, which is why esen verified 3/3 on the same sync.

Fix

A guarded wrapper around batched_radius_graph (applied in setup()/setup_from_path(), same precedent as the _setup_device monkeypatch this env carried before #220) that casts each image_id to its cell's dtype. Droppable once fairchem builds image_id with the cell dtype — being reported to the fork maintainer (abagusetty) as the proper upstream fix.

Validation

  • ruff format --check clean; AST parses; deps unchanged (no rebuild needed — sync re-registers the source and re-verifies).
  • Not yet run on Aurora hardware: the patch point matches the call site (batched_radius_graph(pos_list, cell_list, image_id_list, ...), module-global lookup so the wrapper takes effect), but the proof is the next sync — the two failed verifies retry automatically.

🤖 Generated with Claude Code

OwenPriceSkelly and others added 2 commits September 1, 2026 10:21
…nference

The first Aurora sync (2026-08-28) failed both allscaip checkpoints at
verify with:

    RuntimeError: expected mat1 and mat2 to have the same dtype,
    but got: float != double

in build_radius_graph's torch.mm(image_id, cell). AllScAIP builds its PBC
image-offset tensors with torch.get_default_dtype() (float32), while this
env's InferenceSettings(base_precision_dtype=float64) casts the batch --
including cell -- to double. Not XPU-specific: any FP64 run of AllScAIP
hits it; the nvidia config runs fp32 and never did.

Cast image_id to the cell dtype via a batched_radius_graph wrapper in
setup()/setup_from_path(), to be dropped once fairchem builds image_id
with the cell dtype (reported upstream to the fork maintainer).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@OwenPriceSkelly
OwenPriceSkelly merged commit d04acdf into main Sep 1, 2026
5 checks passed
@OwenPriceSkelly
OwenPriceSkelly deleted the aurora-allscaip-fp64-radius-graph branch September 1, 2026 18:58
OwenPriceSkelly added a commit that referenced this pull request Sep 1, 2026
… inference

Reverts the FP64 forcing (and #221's image_id patch rationale) after CPU
probing against fairchem main showed AllScAIP cannot run at
base_precision_dtype=float64 at all, in three layers:

1. the radius graph builds image_id at the torch default dtype ->
   torch.mm(image_id, cell) dtype crash (the Aurora verify failure);
2. past that, the padded disp/envelope buffers are also default-dtype ->
   index_put dtype crash;
3. past both (fixed upstream in facebookresearch/fairchem#2184), the
   backbone hard-casts its node representations to float32 before the
   output heads (AllScAIP.py), which then mismatch the doubled head
   weights -- an explicit cast no default-dtype workaround can reach.

So FP64 AllScAIP needs upstream design work, not an env shim. Run the
fairchem default float32 instead -- the precision the NVIDIA deployments
verify at. If XPU float32 proves numerically inadequate (the reason
uma.py forces FP64), verification will say so and allscaip-on-Aurora is
blocked on upstream FP64 support.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
OwenPriceSkelly added a commit that referenced this pull request Sep 1, 2026
… inference (#224)

Reverts the FP64 forcing (and #221's image_id patch rationale) after CPU
probing against fairchem main showed AllScAIP cannot run at
base_precision_dtype=float64 at all, in three layers:

1. the radius graph builds image_id at the torch default dtype ->
   torch.mm(image_id, cell) dtype crash (the Aurora verify failure);
2. past that, the padded disp/envelope buffers are also default-dtype ->
   index_put dtype crash;
3. past both (fixed upstream in facebookresearch/fairchem#2184), the
   backbone hard-casts its node representations to float32 before the
   output heads (AllScAIP.py), which then mismatch the doubled head
   weights -- an explicit cast no default-dtype workaround can reach.

So FP64 AllScAIP needs upstream design work, not an env shim. Run the
fairchem default float32 instead -- the precision the NVIDIA deployments
verify at. If XPU float32 proves numerically inadequate (the reason
uma.py forces FP64), verification will say so and allscaip-on-Aurora is
blocked on upstream FP64 support.

Co-authored-by: Claude Fable 5 <noreply@anthropic.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.

1 participant