test(fused): restore fused.rs coverage above threshold#141
Merged
Conversation
The complex `FusedScalar` implementation had no test coverage — every existing fused test used f64 — which kept `strided-kernel/src/fused.rs` below the 80% per-file coverage threshold. Real negate/conj/abs were the only real scalar ops not reached by the existing op chains. Add single-instruction plans that iterate every op over Complex64 (both the static-specialization and interpreter paths dispatch through the scalar methods), cover the real negate/conj/abs ops, and add direct tests for the plan/layout validation error branches. fused.rs line coverage 80% -> 92%. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Heads up: #140 currently cherry-picks this same commit ( |
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
strided-kernel/src/fused.rsis below the 80% per-file coverage threshold onmain(currently ~77% in CI), so thecoveragejob fails on every PR. Thisadds the missing tests to bring it back over the line.
Cause
The complex
FusedScalarimplementation (impl_complex_fused_scalar!) had notest coverage at all — every existing fused test uses
f64. Realnegate/conj/abswere also the only real scalar ops not reached by theexisting op chains.
Change
Test-only. No production code changes.
specializes_every_op_over_complex: single-instruction plans iterating everyFusedOpoverComplex64. Single-op plans always hittry_static_specialization, and both the static and interpreter pathsdispatch through the scalar methods, so this exercises the whole complex impl.
Inputs use positive real parts / nonzero operands so
divide/log/sqrt/powstay well defined, and static output is checked against theinterpreter.
specializes_real_negate_conj_abs: covers the remaining real scalar ops.validate_plan_rejects_out_of_range_output/validate_plan_rejects_zero_outputs/
is_injective_layout_rejects_rank_and_broadcast_mismatch: cover theplan/layout validation error branches the positive tests skip.
Result
fused.rsline coverage 80% → 92% (locally).cargo testandcargo fmt --checkpass;scripts/check-coverage.pyreports all files meettheir thresholds.