Skip to content

fix(ks/auto-bench): make v0/v1 comparisons deterministic - #173

Open
Jiwangreal wants to merge 3 commits into
DeepLink-org:mainfrom
Jiwangreal:fix-ks-auto-bench-input-cloning
Open

fix(ks/auto-bench): make v0/v1 comparisons deterministic#173
Jiwangreal wants to merge 3 commits into
DeepLink-org:mainfrom
Jiwangreal:fix-ks-auto-bench-input-cloning

Conversation

@Jiwangreal

Copy link
Copy Markdown

Summary

  • move both reference and optimized models to the selected accelerator with contextual errors
  • reseed model construction for deterministic parameters and add the optional --math-sdpa comparison mode
  • use reference get_inputs() as canonical data and deep-clone it for v1, avoiding CPU/device RNG mismatches
  • add focused unit tests for model movement, deterministic initialization, and independent cloned inputs

Context

This branch is rebased onto the current DeepLink-org/DLBlas:main and preserves the GCU support added by #170.

Validation

  • python3.10 tests/benchmarks/test_ks_auto_bench.py
  • 4 tests passed in the Hygon DTK 26.04 / PyTorch 2.10 container
  • git diff --check origin/main..HEAD passed

wangji added 3 commits August 8, 2026 17:25
…-sdpa flag

- Reseed RNG before constructing both v0 and v1 models in build_case
  so parameterized models start from equivalent weights.
- Add --math-sdpa flag to force PyTorch SDPA to math backend,
  bypassing incompatible FlashAttention plugins on ROCm/DCU.
- Add unit test verifying reseeded models produce identical weights.
v0/reference get_inputs is now the canonical input source.  v1
receives a deep copy of the same tensors via clone_value() instead
of generating its own inputs under the same seed, eliminating
false correctness failures from CPU vs CUDA RNG differences.

compare_case later moves both copies to the same accelerator before
executing, so device placement is unaffected.

Adds test_build_case_clones_reference_inputs_for_v1 to verify both
value equality and independent storage (distinct data_ptr).
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