Skip to content

test(fused): restore fused.rs coverage above threshold#141

Merged
Ryo-wtnb11 merged 1 commit into
tensor4all:mainfrom
Ryo-wtnb11:fix/fused-coverage
Jul 9, 2026
Merged

test(fused): restore fused.rs coverage above threshold#141
Ryo-wtnb11 merged 1 commit into
tensor4all:mainfrom
Ryo-wtnb11:fix/fused-coverage

Conversation

@Ryo-wtnb11

Copy link
Copy Markdown
Contributor

Summary

strided-kernel/src/fused.rs is below the 80% per-file coverage threshold on
main (currently ~77% in CI), so the coverage job fails on every PR. This
adds the missing tests to bring it back over the line.

Cause

The complex FusedScalar implementation (impl_complex_fused_scalar!) had no
test coverage at all — every existing fused test uses f64. Real
negate / conj / abs were also the only real scalar ops not reached by the
existing op chains.

Change

Test-only. No production code changes.

  • specializes_every_op_over_complex: single-instruction plans iterating every
    FusedOp over Complex64. Single-op plans always hit
    try_static_specialization, and both the static and interpreter paths
    dispatch through the scalar methods, so this exercises the whole complex impl.
    Inputs use positive real parts / nonzero operands so divide / log /
    sqrt / pow stay well defined, and static output is checked against the
    interpreter.
  • 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 the
    plan/layout validation error branches the positive tests skip.

Result

fused.rs line coverage 80% → 92% (locally). cargo test and
cargo fmt --check pass; scripts/check-coverage.py reports all files meet
their thresholds.

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>
@Ryo-wtnb11

Copy link
Copy Markdown
Contributor Author

Heads up: #140 currently cherry-picks this same commit (304147d) so its coverage check can go green ahead of this PR landing — main is below the per-file threshold on fused.rs until this merges. Once this merges, rebasing #140 onto main drops the now-duplicate commit automatically (git detects the identical patch). This PR remains the standalone, reviewable coverage fix.

@Ryo-wtnb11
Ryo-wtnb11 merged commit d759d2a into tensor4all:main Jul 9, 2026
5 checks passed
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