Torch-style tolerances and multi-dispatch validation for accordo#85
Open
Torch-style tolerances and multi-dispatch validation for accordo#85
Conversation
…ccordo. This preserves legacy tolerance compatibility while comparing all dispatches with dispatch-aware mismatch reporting and expanded regression coverage. Made-with: Cursor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Accordo’s validation to (1) support torch.allclose/np.allclose-style tolerances (atol, rtol, equal_nan) and (2) correctly capture/validate multiple kernel dispatches rather than only the first dispatch, with IPC updated to acknowledge each dispatch batch.
Changes:
- Add
atol,rtol, andequal_nanoptions to snapshot comparison while keeping legacytoleranceas an alias for absolute tolerance. - Capture outputs for every dispatch (
Snapshot.dispatch_arrays) and validate dispatch-by-dispatch, including dispatch-count mismatch detection. - Update IPC reader logic to process output-handle records in dispatch-sized batches and respond “done” per batch to unblock the next dispatch.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| accordo/accordo/validator.py | Adds allclose-style comparison knobs and validates per-dispatch output arrays. |
| accordo/accordo/_internal/ipc/communication.py | Switches IPC ingestion to record-batching per dispatch and sends “done” per batch. |
| accordo/accordo/snapshot.py | Adds dispatch_arrays to represent multi-dispatch captures. |
| accordo/accordo/result.py | Extends mismatch reporting to include dispatch_index. |
| accordo/accordo/mcp/server.py | Plumbs new tolerance parameters through MCP validation entrypoints. |
| accordo/README.md | Updates docs/examples to use atol/rtol/equal_nan and documents dispatch_arrays. |
| accordo/accordo/init.py | Updates package-level examples to show new comparison parameters. |
| accordo/tests/test_reduction_validation.py | Adds tests for rtol/equal_nan/back-compat tolerance and multi-dispatch validation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…trics Addresses Copilot review feedback: - Snapshot.arrays docstring now states it contains first dispatch only - Mismatch metrics filter out NaN values so max_difference/mean_difference remain informative when equal_nan=False Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
atol,rtol, andequal_nanparameters tocompare_snapshots, matchingnp.allclose/torch.allclosesemantics. Legacytoleranceparameter still works as an alias foratol.Snapshotgains adispatch_arraysfield;arraysremains the first dispatch's outputs for backward compatibility.Test plan
New tests added:
test_compare_snapshots_supports_rtol— rtol proportional tolerancetest_compare_snapshots_equal_nan_toggle— NaN equality toggletest_compare_snapshots_tolerance_backward_compatibility— legacytoleranceparamtest_multi_dispatch_second_dispatch_mismatch_detected— catches mismatch in 2nd dispatchtest_multi_dispatch_count_mismatch_fails— dispatch count mismatch detection🤖 Generated with Claude Code