Public report of Jianqoq/Hpt, published 16 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 16 November 2026, 22:54 UTC · Survey ID cd_5825b23e35a441ca8d755756f3f4dd3e

Jianqoq/Hpt

Measured 16 November 2026, 22:53 UTC, at code version 79305ab

First survey, so nothing to compare with yet Supply-chain provenance & signing: not measured

Supply-chain provenance & signing is not measured: Supply-chain provenance is not scored (this pipeline releases no artifact), but its build steps or GitHub Actions workflows have integrity defects, or nothing watches its dependency set for published advisories.

CAI score 65.7out of 100 Adequate
CriticalWeakAdequateStrongExemplary

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A large codebase: 174,765 lines of product code in 18 projects, tests not counted · Estimated rebuild effort: about 1.5 person-years · Weakest lens: Maturity, 60.8

Findings by how serious they are

8 critical 1523 serious 525 minor

11 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
16 November 2026, 22:53 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

42of 42 dimensions measured by tools.
2048of 2056 findings point to an exact file and line, so you can open each one in the code. The other 8 concern the repository as a whole, such as missing documentation.
42dimensions across 6 lenses, read from 174,765 lines of product code in 18 projects.
Chapters

Executive summary

Jianqoq/Hpt falls short of our standard for a preview release because its Git mining dimensions are rated Weak, and 493 files are no longer known to anyone active in the project. It scores 65.7 out of 100, which alone would earn Strong, but it is rated Adequate: a rating can't sit more than one step above its weakest group.

Maturity, at 60.8, is the weakest lens by a small margin, and the weakest lens counts most in the score. The best first step is recording design decisions, worth about 4.9 points. Having someone learn and document the 493 files no active contributor knows comes next, also worth about 4.9.

Seven pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. One pipeline step installs packages that can change without warning. Pinning each tool to an exact version and pinning what the pipeline installs would close both risks.

The product code is 174,765 lines, about €210,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Maturity 60.8 · counts for 46%Production Readiness 63.6 · counts for 25%Code Health 65.3 · counts for 14%Security and Compliance 84.1 · counts for 8%Performance 85.0 · counts for 4%Architecture 92.3 · counts for 2%

The weakest lenses score close to each other, so improving any of them moves the score.

Code composition: what the lines of code are
Product code 97%Tests 3%
Rebuild cost: about €210,000 · Estimate
Cost to rebuild€71,000 to €360,000, for 1,186 to 3,764 hours of work, about 1.5 person-years for 1 to 3 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.9 at a score of 66. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 174,765 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.
Raises the score by about 4.9 points · Low effort · ADR Quality
2
Resolve the 493 Orphaned file finding(s) in Knowledge Freshness — start with lib.rs (9), matmul.rs (9), shape_manipulate.rs (9).
Raises the score by about 4.9 points · High effort · Knowledge Freshness
3
Record your significant design decisions.
Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Raises the score by about 2.7 points · Medium effort · Architecture documentation

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €210,000 to build again, about 1.5 person-years of work. Its weakest lens is Maturity, at 60.8 (Adequate). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 4.9 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 4.8 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 8% to 18% on every change. The history of the code shows how much it changes: about 161,979 lines over the last 90 days, which is about 656,915 lines a year. At that pace, the extra work comes to an estimated 131 to 786 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch hpt hpt hpt-allocator hpt-allocator hpt->hpt-allocator hpt-common hpt-common hpt->hpt-common hpt-cudakernels hpt-cudakernels hpt->hpt-cudakernels hpt-dataloader hpt-dataloader hpt->hpt-dataloader hpt-display hpt-display hpt->hpt-display hpt-iterator hpt-iterator hpt->hpt-iterator hpt-macros hpt-macros hpt->hpt-macros hpt-matmul hpt-matmul hpt->hpt-matmul hpt-traits hpt-traits hpt->hpt-traits hpt-types hpt-types hpt->hpt-types hpt-allocator->hpt-common hpt-bench hpt-bench hpt-bench->hpt hpt-dyn hpt-dyn hpt-bench->hpt-dyn hpt-codegen hpt-codegen hpt-common->hpt-types hpt-conv hpt-conv hpt-conv->hpt-matmul matconv_simd matconv_simd hpt-conv->matconv_simd hpt-dataloader->hpt-common hpt-dataloader->hpt-traits hpt-dataloader->hpt-types hpt-display->hpt-common hpt-display->hpt-traits hpt-display->hpt-types hpt-docs hpt-docs hpt-dyn->hpt-allocator hpt-dyn->hpt-common hpt-dyn->hpt-dataloader hpt-dyn->hpt-display hpt-dyn->hpt-iterator hpt-dyn->hpt-macros hpt-dyn->hpt-matmul hpt-dyn->hpt-traits hpt-dyn->hpt-types hpt-dyn->matconv_simd hpt-iterator->hpt-common hpt-iterator->hpt-traits hpt-iterator->hpt-types hpt-matmul->matconv_simd hpt-traits->hpt-common hpt-traits->hpt-types hpt-types->hpt-macros hpt-workspace hpt-workspace hpt-workspace->hpt hpt-workspace->hpt-dyn

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

374 modules, with 767 dependencies between them. 15 loops run through 68 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 334 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 hpt_codegen.fuse.cfg2 hpt_common.strides.strides3 hpt_common.utils.pointer4 hpt_iterator5 hpt_types.dtype6 hpt_types.type_promote7 hpt_types.vectors.traits8 matconv_simd9 hpt_common.shape.shape10 hpt_types.vectors.arch_simd._128bit.common.u64x211 hpt_types.vectors.arch_simd._256bit.common.u16x1612 hpt_common.layout.layout13 hpt_dataloader.compression_trait14 hpt_types.vectors.arch_simd._128bit.common.f64x215 hpt_types.vectors.arch_simd._256bit.common.i16x1616 hpt.tensor_base17 hpt_dyn.tensor18 hpt_iterator.iterator_traits19 hpt_types.vectors.arch_simd._128bit.common.i64x220 hpt.tensor21 hpt_types.vectors.arch_simd._128bit.common.usizex222 hpt_types.vectors.arch_simd._128bit.common.u32x423 hpt_types.vectors.arch_simd._128bit.common.i32x424 hpt_types.vectors.arch_simd._128bit.common.f32x425 hpt_types.vectors.arch_simd._128bit.common.isizex226 hpt_types.vectors.arch_simd._256bit.common.u32x827 hpt_types.vectors.arch_simd._256bit.common.u64x428 hpt_types.vectors.arch_simd._256bit.common.i32x829 hpt_types.vectors.arch_simd._256bit.common.i64x430 hpt_types.vectors.arch_simd._256bit.common.f32x831 hpt_types.vectors.arch_simd._256bit.common.f64x432 hpt_types.vectors.arch_simd._256bit.common.f16x1633 hpt_types.vectors.arch_simd._256bit.common.bf16x1634 hpt_types.convertion35 hpt_types.vectors.arch_simd._128bit.common.f16x836 hpt_types.vectors.arch_simd._256bit.common.usizex437 hpt_types.vectors.arch_simd._512bit.common.i32x1638 hpt_types.vectors.arch_simd._512bit.common.f32x1639 hpt_types.vectors.arch_simd._512bit.common.u64x840 hpt_types.vectors.arch_simd._512bit.common.i64x8
1 hpt_codegen.fuse.cfg
2 hpt_common.strides.strides
3 hpt_common.utils.pointer
4 hpt_iterator
5 hpt_types.dtype
6 hpt_types.type_promote
7 hpt_types.vectors.traits
8 matconv_simd
9 hpt_common.shape.shape1
10 hpt_types.vectors.arch_simd._128bit.common.u64x24411111
11 hpt_types.vectors.arch_simd._256bit.common.u16x16431111
12 hpt_common.layout.layout11
13 hpt_dataloader.compression_trait22
14 hpt_types.vectors.arch_simd._128bit.common.f64x24311111
15 hpt_types.vectors.arch_simd._256bit.common.i16x16441111
16 hpt.tensor_base1111111
17 hpt_dyn.tensor121212
18 hpt_iterator.iterator_traits444
19 hpt_types.vectors.arch_simd._128bit.common.i64x24411111
20 hpt.tensor1111131
21 hpt_types.vectors.arch_simd._128bit.common.usizex22112111
22 hpt_types.vectors.arch_simd._128bit.common.u32x44311111
23 hpt_types.vectors.arch_simd._128bit.common.i32x44411111
24 hpt_types.vectors.arch_simd._128bit.common.f32x44311111
25 hpt_types.vectors.arch_simd._128bit.common.isizex221111211
26 hpt_types.vectors.arch_simd._256bit.common.u32x84311111
27 hpt_types.vectors.arch_simd._256bit.common.u64x44311111
28 hpt_types.vectors.arch_simd._256bit.common.i32x84411111
29 hpt_types.vectors.arch_simd._256bit.common.i64x44411111
30 hpt_types.vectors.arch_simd._256bit.common.f32x84311111
31 hpt_types.vectors.arch_simd._256bit.common.f64x44311111
32 hpt_types.vectors.arch_simd._256bit.common.f16x16431111
33 hpt_types.vectors.arch_simd._256bit.common.bf16x164311111
34 hpt_types.convertion111111111111
35 hpt_types.vectors.arch_simd._128bit.common.f16x84311
36 hpt_types.vectors.arch_simd._256bit.common.usizex411211111
37 hpt_types.vectors.arch_simd._512bit.common.i32x16441111
38 hpt_types.vectors.arch_simd._512bit.common.f32x16431111
39 hpt_types.vectors.arch_simd._512bit.common.u64x843111
40 hpt_types.vectors.arch_simd._512bit.common.i64x844111
Uses a module listed above itPart of a loopThe module itself
1 hpt_codegen.fuse.cfg2 hpt_common.strides.strides3 hpt_common.utils.pointer4 hpt_iterator5 hpt_types.dtype6 hpt_types.type_promote7 hpt_types.vectors.traits8 matconv_simd9 hpt_common.shape.shape10 hpt_types.vectors.arch_simd._128bit.common.u64x211 hpt_types.vectors.arch_simd._256bit.common.u16x1612 hpt_common.layout.layout13 hpt_dataloader.compression_trait14 hpt_types.vectors.arch_simd._128bit.common.f64x215 hpt_types.vectors.arch_simd._256bit.common.i16x1616 hpt.tensor_base17 hpt_dyn.tensor18 hpt_iterator.iterator_traits19 hpt_types.vectors.arch_simd._128bit.common.i64x220 hpt.tensor21 hpt_types.vectors.arch_simd._128bit.common.usizex222 hpt_types.vectors.arch_simd._128bit.common.u32x423 hpt_types.vectors.arch_simd._128bit.common.i32x424 hpt_types.vectors.arch_simd._128bit.common.f32x425 hpt_types.vectors.arch_simd._128bit.common.isizex226 hpt_types.vectors.arch_simd._256bit.common.u32x827 hpt_types.vectors.arch_simd._256bit.common.u64x428 hpt_types.vectors.arch_simd._256bit.common.i32x829 hpt_types.vectors.arch_simd._256bit.common.i64x430 hpt_types.vectors.arch_simd._256bit.common.f32x831 hpt_types.vectors.arch_simd._256bit.common.f64x432 hpt_types.vectors.arch_simd._256bit.common.f16x1633 hpt_types.vectors.arch_simd._256bit.common.bf16x1634 hpt_types.convertion35 hpt_types.vectors.arch_simd._128bit.common.f16x836 hpt_types.vectors.arch_simd._256bit.common.usizex437 hpt_types.vectors.arch_simd._512bit.common.i32x1638 hpt_types.vectors.arch_simd._512bit.common.f32x1639 hpt_types.vectors.arch_simd._512bit.common.u64x840 hpt_types.vectors.arch_simd._512bit.common.i64x8hpt_codegen.fuse.cfg1hpt_common.strides.strides2hpt_common.utils.pointer3hpt_iterator4hpt_types.dtype5hpt_types.type_promote6hpt_types.vectors.traits7matconv_simd8hpt_common.shape.shape9hpt_types.vectors.arch_simd._128bit.common.u64x210hpt_types.vectors.arch_simd._256bit.common.u16x1611hpt_common.layout.layout12hpt_dataloader.compression_trait13hpt_types.vectors.arch_simd._128bit.common.f64x214hpt_types.vectors.arch_simd._256bit.common.i16x1615hpt.tensor_base16hpt_dyn.tensor17hpt_iterator.iterator_traits18hpt_types.vectors.arch_simd._128bit.common.i64x219hpt.tensor20hpt_types.vectors.arch_simd._128bit.common.usizex221hpt_types.vectors.arch_simd._128bit.common.u32x422hpt_types.vectors.arch_simd._128bit.common.i32x423hpt_types.vectors.arch_simd._128bit.common.f32x424hpt_types.vectors.arch_simd._128bit.common.isizex225hpt_types.vectors.arch_simd._256bit.common.u32x826hpt_types.vectors.arch_simd._256bit.common.u64x427hpt_types.vectors.arch_simd._256bit.common.i32x828hpt_types.vectors.arch_simd._256bit.common.i64x429hpt_types.vectors.arch_simd._256bit.common.f32x830hpt_types.vectors.arch_simd._256bit.common.f64x431hpt_types.vectors.arch_simd._256bit.common.f16x1632hpt_types.vectors.arch_simd._256bit.common.bf16x1633hpt_types.convertion34hpt_types.vectors.arch_simd._128bit.common.f16x835hpt_types.vectors.arch_simd._256bit.common.usizex436hpt_types.vectors.arch_simd._512bit.common.i32x1637hpt_types.vectors.arch_simd._512bit.common.f32x1638hpt_types.vectors.arch_simd._512bit.common.u64x839hpt_types.vectors.arch_simd._512bit.common.i64x840144111114311111122431111144111111111111212124444411111111113121121114311111441111143111112111121143111114311111441111144111114311111431111143111143111111111111111114311112111114411114311114311144111+334 more modules (most-connected shown)

At a glance — Code Health · 65.3 · Adequate · gated by D4, IC1 ·

At a glance — Architecture · 92.3 · Exemplary ·

At a glance — Maturity · 60.8 · Adequate · gated by D34 ·

At a glance — Readiness · 63.6 · Strong ·

At a glance — Security · 84.1 · Strong ·

At a glance — Performance · 85.0 · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A05:2025 — Injection12High / Critical

Roadmap

Top priorities: Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml; Resolve the 493 Orphaned file finding(s) in Knowledge Freshness — start with lib.rs (9), matmul.rs (9), shape_manipulate.rs (9); Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.+4.9 ptsLowADR Quality
Resolve the 493 Orphaned file finding(s) in Knowledge Freshness — start with lib.rs (9), matmul.rs (9), shape_manipulate.rs (9).+4.9 ptsHighKnowledge Freshness
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+2.7 ptsMediumArchitecture documentation
Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.+2.3 ptsMediumIncompleteness & stubs
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.+2.0 ptsMediumDocumentation (README)
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.+1.6 ptsMediumObservability
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+1.4 ptsMediumRelease Hygiene
Resolve the 16 Hotspot finding(s) in Churn × Complexity Hotspots — start with matmul.rs (3), utils.rs (2), operators.rs.+0.7 ptsHighChurn × Complexity Hotspots

File quality

Per-file score 0–10 — a quality signature. Of 251 files carrying findings, judged against the Preview bar: 1% slop · 8% mixed · 91% near-clean.

FileScoreBandWorst signal
REDACTED0.9SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.4SlopStatic Analysis (SAST): High: REDACTED
hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs5.5MixedGod Classes: ClassTooLong: bf16x16
hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs5.5MixedGod Classes: ClassTooLong: bf16x8
hpt-codegen/src/fuse/build_graph.rs5.5MixedCyclomatic Complexity: Graph::visit_expr_binary (cyclomatic 36)
hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs5.5MixedCode Duplication: Edited copy of a member (12 corresponding lines)
hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs5.5MixedCode Duplication: Edited copies of one member (6 members, 7+ corresponding lines)
hpt-dyn/src/tensor.rs5.6MixedCyclomatic Complexity: Tensor::from_onnx_tensor (cyclomatic 23)
hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs5.6MixedCode Duplication: Edited copy of a member (13 corresponding lines)
hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs5.6MixedCode Duplication: Edited copies of one member (6 members, 7+ corresponding lines)
hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs5.7MixedGod Classes: ClassTooLong: bf16x32
hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs5.7MixedCode Duplication: Edited copies of one member (5 members, 13+ corresponding lines)
hpt-types/src/vectors/arch_simd/_256bit/common/u16x16.rs5.7MixedCode Duplication: Duplicated block (7 lines × 2)
hpt-types/src/vectors/arch_simd/_256bit/common/u32x8.rs5.7MixedCode Duplication: Duplicated block (7 lines × 2)
hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs5.9MixedCode Duplication: Edited copies of one member (4 members, 4+ corresponding lines)
hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs5.9MixedCode Duplication: Edited copies of one member (6 members, 10+ corresponding lines)
hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs5.9MixedCode Duplication: Edited copies of one member (4 members, 7+ corresponding lines)
hpt-tests/src/hpt/cpu/reduce.rs6.0MixedExplicit Debt: TodoComment
hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs6.3MixedCode Duplication: Members sharing a duplicated core (5 members, 50+ identical tokens)
hpt-types/src/vectors/arch_simd/_128bit/common/i16x8.rs6.3MixedCode Duplication: Edited copies of one member (3 members, 8+ corresponding lines)

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 8

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 1523

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 525

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 11

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 42 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.7, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 42 dimensions across the health lenses
D1D2D3D4D5D6D13D15D17D19D20D26D28D29D30D34D35D43AX10AX3AX4AX8AX9GD1IC1M1M2M3P1P10P2P3P6PF1X1X12X16X18X23X25X30X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 2048 of 2056 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1e690-b87e-79df-acba-aabbadf08aab.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs) and this repository declares a Cargo test suite (repository root, 73 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D12 Dependency Hygiene — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 61 direct Cargo declaration(s) were read, but the outdated signal needs crates.io, and no committed Cargo.lock resolves them to versions, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D14 License Compliance — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — this repository declares Cargo manifests but commits no Cargo.lock, so its dependency graph was closed from the manifests over the crates.io index, and part of it could not be read: no published release of lazy_static satisfies `0.2.*`. A licence verdict over part of a dependency graph is not a licence verdict. NOT a finding that this repository's licences are compliant: this dimension asserts nothing about its licensing in either direction.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-contributor repository — bus factor is not applicable (1 contributor(s) across 1952 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D30 Dependency Vulnerabilities — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. The scanner produced no output at all, so no dependency was actually scanned. 1 of 2 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; osv was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that osv is free of known-vulnerable dependencies. osv: the scanner produced no output at all, so no dependency was actually scanned. This is reported as a measurement gap rather than a clean pass. osv-scanner documents exit 128 as "no package sources found" — but this scan only invoked it because the tree declares a source it supports (`pom.xml` and the resolved lockfiles among them), so the tool's report and this repository disagree. Check that those sources are reachable from the directory the scan ran in before concluding anything is missing. If this tree really does commit only range-pinned manifests, commit the lockfile your package manager produces — but only where your ecosystem HAS one and commits it: Maven has none at all (osv-scanner reads `pom.xml` directly) and Gradle writes one only under opt-in dependency locking, while a published Composer package and a published Dart library both deliberately exclude theirs. In those three, generate one in CI before the scan instead — a resolved dependency list or an SBOM fed to the scanner.
  • D43 Malicious Dependencies — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. The scanner produced no output at all, so no dependency was actually scanned. 1 of 2 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; osv was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that osv is free of known-vulnerable dependencies. osv: the scanner produced no output at all, so no dependency was actually scanned. This is reported as a measurement gap rather than a clean pass. osv-scanner documents exit 128 as "no package sources found" — but this scan only invoked it because the tree declares a source it supports (`pom.xml` and the resolved lockfiles among them), so the tool's report and this repository disagree. Check that those sources are reachable from the directory the scan ran in before concluding anything is missing. If this tree really does commit only range-pinned manifests, commit the lockfile your package manager produces — but only where your ecosystem HAS one and commits it: Maven has none at all (osv-scanner reads `pom.xml` directly) and Gradle writes one only under opt-in dependency locking, while a published Composer package and a published Dart library both deliberately exclude theirs. In those three, generate one in CI before the scan instead — a resolved dependency list or an SBOM fed to the scanner.
  • D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • GD1 Unfinished & placeholder code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 129 further occurrence(s) are not listed individually; the score already reflects all 169.
  • IC1 Incompleteness & stubs — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 340 further occurrence(s) are not listed individually; the score already reflects all 380.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and none applies: this repository publishes a library and deploys nothing (no container, IaC or deployment manifest), so it holds no runtime state of its own. Any data-access dependency it declares is the store it is a CLIENT for, not one it operates. The DR control belongs to whoever runs that data.
  • X5 Nullable reference types — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 571 further occurrence(s) are not listed individually; the score already reflects all 611.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity5.7 / 10Adequate✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 5.7 / 10 · rule-coverage 100% · ceiling Prevented

54 function(s) exceeded the cyclomatic complexity threshold of 15; the worst was Operator::outputs at 131. A further 26 function(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being Tensor::cast at 171 — they are counted neither in the figure above nor in this dimension's score. 9 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: hpt-dyn/src/ops/tensor/unary.rs (Tensor::cast at 171), hpt-dyn/src/ops/tensor/binary.rs (Tensor::func_name at 170), hpt-types/src/promotion/utils.rs (hpt_types::promotion::utils::func_name at 169), hpt-dyn/src/utils/onnx/run_fwd.rs (hpt_dyn::utils::onnx::run_fwd::run_fwd at 127), hpt-macros/src/type_utils.rs (hpt_macros::type_utils::type_simd_lanes at 64), and 4 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

hpt_dyn::ops::tensor::copy::_copy_from (cyclomatic 39) · ×8hpt-dyn/src/ops/tensor/copy.rs:35
hpt::backends::cpu::kernels::pooling::common::pooling_template (cyclomatic 33) · ×7hpt/src/backends/cpu/kernels/pooling/common.rs:18
hpt_macros::scalar_convert::__impl_scalar_convert (cyclomatic 42) · ×5hpt-macros/src/scalar_convert.rs:7
hpt_codegen::fuse::codegen::stmt (cyclomatic 31) · ×5hpt-codegen/src/fuse/codegen.rs:4
Operator::outputs (cyclomatic 131) · ×4hpt-dyn/src/utils/onnx/operators.rs:1142

+ 14 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 4 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with Operator::outputs (cyclomatic 131), Operator::outputs_mut (cyclomatic 131), Operator::inputs (cyclomatic 125). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 4 together lifts Cyclomatic Complexity from 5.7 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity6.0 / 10Adequate✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Prevented

117 function(s) exceeded the cognitive complexity threshold of 15; the worst was VarCoalescer::run at 98.

hpt::backends::cpu::kernels::pooling::common::pooling_template (cognitive 77) · ×36hpt/src/backends/cpu/kernels/pooling/common.rs:18
hpt_dyn::ops::tensor::pooling::template::pooling_template (cognitive 77) · ×27hpt-dyn/src/ops/tensor/pooling/template.rs:15
hpt_matmul::utils::pack_a (cognitive 54) · ×7hpt-matmul/src/utils.rs:482
hpt_codegen::fuse::start::fuse_impl (cognitive 85) · ×6hpt-codegen/src/fuse/start.rs:40
CFG::insert_phi_functions (cognitive 93) · ×5hpt-codegen/src/fuse/cfg.rs:450

+ 17 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 11 bodies over 60 down to 60 or less in Cognitive Complexity — start with VarCoalescer::run (cognitive 98), CFG::insert_phi_functions (cognitive 93), hpt_macros::scalar_convert::__impl_scalar_convert (cognitive 92). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 11 together lifts Cognitive Complexity from 6.0 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.8 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.8 / 10 · rule-coverage 100% · ceiling Prevented

125 over-large unit(s) detected — types, modules or files that carry too much.

FunctionTooLong: hpt::backends::cpu::tensor_internal::matmul::matmul_with_out · ×58hpt/src/backends/cpu/tensor_internal/matmul.rs:31
FileTooLong: reduce/reduce.rs · ×37hpt-dyn/src/ops/tensor/reduce/reduce.rs
MethodTooLong: Tensor.cast · ×16hpt-dyn/src/ops/tensor/unary.rs:610
ClassTooLong: CFGBuilder · ×9hpt-codegen/src/fuse/cfg_builder.rs:12
TooManyFunctions: hpt_types::vectors::arch_simd::sleef::arch::helper_avx512 · ×4hpt-types/src/vectors/arch_simd/sleef/arch/helper_avx512.rs:6

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 58 FunctionTooLong finding(s) in God Classes — start with matmul.rs (6), reduce.rs (6), template.rs (4). — One of this dimension's main actionable groups (58 warning-level).
  2. Resolve the 37 FileTooLong finding(s) in God Classes — start with reduce.rs (4), matmul.rs (3), std_ops.rs (2). — One of this dimension's main actionable groups (37 warning-level).
  3. Resolve the 16 MethodTooLong finding(s) in God Classes — start with operators.rs (7), unary.rs, binary.rs. — One of this dimension's main actionable groups (16 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication2.7 / 10Weak✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

Maturity: Documented → Verified → Prevented · effective 2.7 / 10 · rule-coverage 100% · ceiling Verified

711 duplicated block group(s) detected. 18.3 % of the production lines (31,947 of 174,765) are in a reported copy. A further 317 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 91 of the 1028 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (7 lines × 2) · ×56hpt-common/src/shape/shape_utils.rs:776
Duplicated block (6 lines × 4) · ×48hpt-codegen/src/fuse/cfg_builder.rs:741
Edited copy of a member (6 corresponding lines) · ×42hpt-types/src/cuda_types/convertion.rs:99
Duplicated block (8 lines × 2) · ×28hpt-common/src/prg_update.rs:16
Duplicated block (12 lines × 2) · ×27hpt-codegen/src/fuse/cfg_builder.rs:1143

+ 357 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 56 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with binary.rs (4), binary_normal.rs (4), f16x8.rs (4). — One of this dimension's main actionable groups (56 warning-level).
  2. Resolve the 48 Duplicated block (6 lines × 4) finding(s) in Code Duplication — start with bf16x8.rs (40), cfg_builder.rs, kernels.rs. — One of this dimension's main actionable groups (48 warning-level).
  3. Resolve the 42 Edited copy of a member (6 corresponding lines) finding(s) in Code Duplication — start with f16x16.rs (41), convertion.rs. — One of this dimension's main actionable groups (42 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling9.6 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Prevented

18 production modules (Cargo+npm), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 3 module(s) off the main sequence, with abstractness counted on 12 of the 18 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: matconv_simd
Off the main sequence: hpt-cudakernels · ×2

What to do

  1. Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)4.8 / 10Weak✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 4.8 / 10 · rule-coverage 100% · ceiling Verified

52 of 120 classes have LCOM4 above 3.

Low cohesion: Tensor (LCOM4 49) · ×52hpt-dyn/src/tensor.rs:29

What to do

  1. Resolve the 52 Low cohesion finding(s) in Cohesion (LCOM4) — start with bf16x8.rs (2), f32x4.rs (2), f64x2.rs (2). — One of this dimension's main actionable groups (52 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D15 · Churn × Complexity Hotspots9.7 / 10Stronggated by 16 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: hpt-dyn/src/utils/onnx/operators.rs (10×131=1310); hpt-dyn/src/ops/tensor/matmul/matmul.rs (22×20=440); hpt-matmul/src/matmul.rs (12×31=372)

Hotspot: hpt-dyn/src/utils/onnx/operators.rs · ×16hpt-dyn/src/utils/onnx/operators.rs:1142

What to do

  1. Resolve the 16 Hotspot finding(s) in Churn × Complexity Hotspots — start with matmul.rs (3), utils.rs (2), operators.rs. — One of this dimension's main actionable groups (16 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

1 deducted task-comment markers across 174765 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoCommenthpt-tests/src/hpt/cpu/reduce.rs:358

What to do

  1. Resolve the 1 TodoComment finding(s) in Explicit Debt — start with reduce.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 272 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs foundCargo.toml:121

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion6.5 / 10Adequate✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 6.5 / 10 · rule-coverage 100% · ceiling Documented

3 of 17 build units (Cargo, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion · ×3hpt-types/Cargo.toml:1

What to do

  1. Resolve the 3 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with Cargo.toml (3). — One of this dimension's main actionable groups (3 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)6.8 / 10Adequate✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 6.8 / 10 · rule-coverage 100% · ceiling Documented

12 finding(s): 0 critical, 8 high, 4 medium, 0 low. 7 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 warning-level).
  3. No action in Static Analysis (SAST) — all 7 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (7 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No known-vulnerable dependencies in the 1 ecosystem(s) that were scanned (npm). Partial dependency scan: 1 of 2 declared ecosystem(s) were scanned (npm), and the findings above are real and complete for them. osv was not scanned (osv: the scanner produced no output at all, so no dependency was actually scanned), so this is not the whole dependency surface and the result is reported at reduced confidence.

✓ On the Gold path — maintain.

Detailed fixes: d30_recommendation.md.

D34 · Knowledge Freshness0.0 / 10Critical✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

496 of 496 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is hpt-types/src/vectors/arch_simd/sleef/table.rs. Counted over 496 of the 758 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file · ×493hpt-dyn/src/ops/tensor/reduce/reduce.rs:1
Most significant orphaned file · ×3hpt-types/src/vectors/arch_simd/sleef/table.rs:1
Dormant codebase

What to do

  1. Resolve the 493 Orphaned file finding(s) in Knowledge Freshness — start with lib.rs (9), matmul.rs (9), shape_manipulate.rs (9). — One of this dimension's main actionable groups (493 recommendation-level).
  2. Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with table.rs, tests.rs, std_ops.rs. — One of this dimension's main actionable groups (3 recommendation-level).
  3. Resolve the 1 Dormant codebase finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.9 / 10Stronggated by 2 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: cfg_builder.rs↔main.rs 100%; build_graph.rs↔main.rs 90%; codegen.rs↔main.rs 85%

Change-coupling hub: main.rs → build_graph.rs, cfg.rs, cfg_builder.rs, codegen.rs, gen_fuse.rs, start.rs, save.rs, matmul.rs, reduce.rssrc/main.rs
Change coupling: build_graph.rs ↔ start.rshpt-codegen/src/fuse/build_graph.rs:1

What to do

  1. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with main.rs. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Change coupling finding(s) in Change Coupling — start with build_graph.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No known-vulnerable dependencies in the 1 ecosystem(s) that were scanned (npm). Partial dependency scan: 1 of 2 declared ecosystem(s) were scanned (npm), and the findings above are real and complete for them. osv was not scanned (osv: the scanner produced no output at all, so no dependency was actually scanned), so this is not the whole dependency surface and the result is reported at reduced confidence.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

GD1 · Unfinished & placeholder code9.8 / 10Exemplary✓ Tool-verified

Other · Code Health — Unreviewed-generation residue in this repository's Rust: functions whose whole body is still `todo!()`/`unimplemented!()` or only panics with a "not implemented" message, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.

Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.

  • `visit_abi` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:278
  • `visit_angle_bracketed_generic_arguments` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:282
  • `visit_arm` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:289
  • `visit_assoc_const` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:293
  • `visit_assoc_type` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:297
  • `visit_bare_fn_arg` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:301
  • `visit_bare_variadic` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:305
  • `visit_bin_op` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:309
  • `visit_bound_lifetimes` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:313
  • `visit_captured_param` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:317
  • `visit_const_param` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:321
  • `visit_constraint` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:325
  • `visit_data` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:329
  • `visit_data_enum` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:333
  • `visit_data_struct` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:337
  • `visit_data_union` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:341
  • `visit_derive_input` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:345
  • `visit_expr_async` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:368
  • `visit_expr_block` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:372
  • `visit_expr_closure` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:376
  • `visit_expr_const` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:380
  • `visit_expr_for_loop` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:384
  • `visit_expr_group` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:388
  • `visit_expr_loop` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:392
  • `visit_expr_match` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:396
  • `visit_expr_raw_addr` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:400
  • `visit_expr_while` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:448
  • `visit_field` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:452
  • `visit_field_mutability` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:456
  • `visit_fields_named` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:462
  • `visit_fields_unnamed` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:466
  • `visit_file` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:470
  • `visit_foreign_item` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:474
  • `visit_foreign_item_fn` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:478
  • `visit_foreign_item_macro` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:482
  • `visit_foreign_item_static` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:486
  • `visit_foreign_item_type` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:490
  • `visit_generic_argument` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:494
  • `visit_generic_param` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:498
  • `visit_impl_item` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:502

What to do

  • Finish or delete the functions that are still `todo!()`/`unimplemented!()` or panic "not implemented", and replace placeholder text before shipping.
IC1 · Incompleteness & stubs3.5 / 10Weak✓ Tool-verified

Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's Rust: functions whose body is `todo!()`/`unimplemented!()` or only panics with a "not implemented" message, match arms and branches left as `todo!()`, functions that take inputs and return a constant (`Ok(())`, `None`, `Default::default()`, an empty `Vec`) or do nothing, and impls most of whose methods are holes.

Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.

  • `visit_abi` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:278
  • `visit_angle_bracketed_generic_arguments` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:282
  • `visit_arm` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:289
  • `visit_assoc_const` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:293
  • `visit_assoc_type` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:297
  • `visit_bare_fn_arg` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:301
  • `visit_bare_variadic` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:305
  • `visit_bin_op` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:309
  • `visit_bound_lifetimes` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:313
  • `visit_captured_param` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:317
  • `visit_const_param` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:321
  • `visit_constraint` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:325
  • `visit_data` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:329
  • `visit_data_enum` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:333
  • `visit_data_struct` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:337
  • `visit_data_union` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:341
  • `visit_derive_input` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:345
  • `visit_expr_assign` does real work, but one of its branches is `unimplemented!` — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled. — hpt-codegen/src/fuse/build_graph.rs:363
  • `visit_expr_async` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:368
  • `visit_expr_block` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:372
  • `visit_expr_closure` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:376
  • `visit_expr_const` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:380
  • `visit_expr_for_loop` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:384
  • `visit_expr_group` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:388
  • `visit_expr_loop` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:392
  • `visit_expr_match` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:396
  • `visit_expr_raw_addr` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:400
  • `visit_expr_unary` does real work, but one of its branches is `todo!` — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled. — hpt-codegen/src/fuse/build_graph.rs:430
  • `visit_expr_while` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:448
  • `visit_field` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:452
  • `visit_field_mutability` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:456
  • `visit_fields_named` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:462
  • `visit_fields_unnamed` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:466
  • `visit_file` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:470
  • `visit_foreign_item` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:474
  • `visit_foreign_item_fn` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:478
  • `visit_foreign_item_macro` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:482
  • `visit_foreign_item_static` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:486
  • `visit_foreign_item_type` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:490
  • `visit_generic_argument` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface. — hpt-codegen/src/fuse/build_graph.rs:494

What to do

  • Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
M1 · Documentation (README)6.8 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability4.6 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 1/5 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `hpt-bench`, `hpt-examples`, `hpt-tests`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

  • `package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — package.json:13

What to do

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
PF1 · Benchmark discipline8.5 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X5 · Nullable reference types8.6 / 10Strong✓ Tool-verified

Other · Code Health — Whether Rust's absent values are handled rather than forced — `Option` and `Result` make absence a value the caller must handle in every crate, and each `.unwrap()` or `.expect()` that no guard on its path proves present is a panic the first time the value is `None` or `Err`.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • `std::alloc::Layout::from_size_align(mem_size,ALIGN)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `prepack_rhs` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-matmul/src/matmul.rs:695
  • `CString::new(name)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `get_cache_info` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-matmul/src/utils.rs:185
  • `CString::new("hw.cachelinesize")` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `get_cache_info` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-matmul/src/utils.rs:195
  • `attr.parse_nested_meta(|meta|{if meta.path.is_ident("algo"){let value:syn::LitStr=meta.value()?.parse()?;let algo=match value.value().as_str().to_lowercase().as_str(){"gzip"=>quote!(Gzip),"deflate"=>quote!(Deflate),"zlib"=>quote!(Zlib),"none"=>quote!(NoCompression),_=>panic!("Unsupported compression algorithm, supported: gzip, deflate, zlib, none"),};compression_algo=Some(quote!(hpt::save_load::CompressionAlgo::#algo));}else if meta.path.is_ident("level"){let value:syn::LitStr=meta.value()?.parse()?;let tmp:u32=value.value().parse().map_err(|e|{syn::Error::new(value.span(),format!("Invalid level: {}",e))})?;level=Some(quote!(#tmp));}Ok(())})` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `impl_save` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-macros/src/lib.rs:842
  • `hpt::save_load::parse_header_compressed::<Self,_>(&path)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `load` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-macros/src/lib.rs:957
  • `value.base10_parse::<usize>()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `impl_from_safetensors` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-macros/src/lib.rs:1003
  • `inner_type` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `impl_from_safetensors` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-macros/src/lib.rs:1017
  • `path.path.get_ident()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `parse` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×4) — hpt-macros/src/matmul_microkernels_asm.rs:127, hpt-macros/src/matmul_microkernels_asm.rs:141, hpt-macros/src/matmul_microkernels_asm.rs:153, …
  • `predict_broadcast_shape(&self.shape(),&other.shape())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `zip` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×3) — hpt-iterator/src/iterator_traits.rs:180, hpt-iterator/src/iterator_traits.rs:223, hpt-iterator/src/iterator_traits.rs:283
  • `predict_broadcast_shape(self.shape(),other.shape())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `zip` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/iterator_traits.rs:338
  • `tensor.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `new` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/par_strided.rs:86
  • `tensor.strides().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `new` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/par_strided.rs:103
  • `self.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `inner_loop_size` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×4) — hpt-iterator/src/par_strided.rs:187, hpt-iterator/src/par_strided.rs:524, hpt-iterator/src/strided.rs:134, …
  • `self.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `split` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×2) — hpt-iterator/src/par_strided.rs:250, hpt-iterator/src/par_strided.rs:572
  • `U::empty(self.iter.shape().clone())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `collect` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×4) — hpt-iterator/src/par_strided_map.rs:98, hpt-iterator/src/par_strided_map.rs:160, hpt-iterator/src/strided_map.rs:61, …
  • `self.base.ptr.get_ptr().add(index*(self.base.last_stride as usize)).as_mut()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `inner_loop_next` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×3) — hpt-iterator/src/par_strided_mut.rs:185, hpt-iterator/src/par_strided_mut.rs:392, hpt-iterator/src/strided_mut.rs:286
  • `right_b` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `split` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). (×2) — hpt-iterator/src/par_strided_zip.rs:254, hpt-iterator/src/par_strided_zip.rs:464
  • `get_broadcast_axes_from(&self_shape,&res_shape)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `par_reshape` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:39
  • `ShapeError::check_size_match(iterator._layout().shape().size(),res_shape.size())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `par_reshape` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:57
  • `process_axes(axes,iterator._layout().shape().len())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `par_transpose` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:77
  • `iterator._layout().expand_strides(&res_shape)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `par_expand` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:115
  • `get_broadcast_axes_from(&self_shape,&res_shape)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `reshape` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:148
  • `ShapeError::check_size_match(iterator._layout().shape().inner().iter().product(),res_shape.size(),)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `reshape` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:169
  • `iterator._layout().expand_strides(&res_shape)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `expand` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:190
  • `process_axes(axes,iterator._layout().shape().len())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `transpose` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — hpt-iterator/src/shape_manipulate.rs:199

What to do

  • Each row is a forced `Option`/`Result` no guard on its path proves present. Handle the absent case where it arises rather than forcing it: `?` to hand it to the caller, `if let` / `match` / `let … else` to branch on it, `unwrap_or` / `unwrap_or_default` / `unwrap_or_else` where a default is right. Where the value genuinely cannot be absent, say so in a way a reader can check from the line: test it first (`if x.is_none() { return … }`), look the key up with `contains_key` or the index against `len()`, or construct the value so it cannot be absent.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health65.3Adequate — gated by D4, IC1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture92.3ExemplaryStrongest area.
Maturity60.8Adequate — gated by D34Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness63.6StrongSolid.
Security84.1StrongSolid.
Performance85.0ExemplarySolid.
Unscored — 3 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • D36 Supply-chain Provenance & Signing — 2 observation(s) recorded · The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
  • SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X10 Duplicated predicate — 17 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 70 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
  • AX2 Stateful singletons — Not applicable: Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written.
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~4933 lines of test source are present (.rs) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • D12 Dependency Hygiene — Not scored — 61 direct Cargo declaration(s) were read, but the outdated signal needs crates.io, and no committed Cargo.lock resolves them to versions, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D14 License Compliance — Crate licences not graded — the lock-less Cargo graph could not be read in full
  • D16 Bus Factor — single-contributor repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — N/A — too few peers to establish a naming convention (23457 declarations, no unit with a dominant convention).
  • D22 Internal API Consistency — API consistency is measured on C#, TypeScript, Go only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — Rust suite
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (97 value object(s))
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • M4 Documentation accuracy — Not applicable: the 200 current-state document(s) make no claim of a kind M4 checks. 6 claim(s) of kinds M4 does not check were not checked (path 6); M4 checks only links and versions and artefact counts.
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
  • S1 Web-Security Posture — No web surface: 681 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — no C# was loaded; this repository's Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X7 Silent fallback defaults — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 8 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 1523 finding(s)
D3 · God Classes · FunctionTooLong · ×58
  • FunctionTooLong: hpt::backends::cpu::tensor_internal::matmul::matmul_with_out hpt/src/backends/cpu/tensor_internal/matmul.rs:31 — FunctionTooLong — hpt::backends::cpu::tensor_internal::matmul::matmul_with_out runs 307 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 207 over it, 3.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cuda::utils::binary::binary_normal::binary_fn_with_out_simd hpt/src/backends/cuda/utils/binary/binary_normal.rs:29 — FunctionTooLong — hpt::backends::cuda::utils::binary::binary_normal::binary_fn_with_out_simd runs 298 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 198 over it, 2.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_macros::simd_float_out_unary::impl_float_out_unary hpt-macros/src/simd_float_out_unary.rs:5 — FunctionTooLong — hpt_macros::simd_float_out_unary::impl_float_out_unary runs 250 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 150 over it, 2.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_macros::float_unary::impl_float_out_unary hpt-macros/src/float_unary.rs:5 — FunctionTooLong — hpt_macros::float_unary::impl_float_out_unary runs 230 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 130 over it, 2.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_macros::float_unary::impl_cuda_float_out_unary hpt-macros/src/float_unary.rs:327 — FunctionTooLong — hpt_macros::float_unary::impl_cuda_float_out_unary runs 213 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 113 over it, 2.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::utils::reduce::reduce::contiguous_reduce hpt/src/backends/cpu/utils/reduce/reduce.rs:367 — FunctionTooLong — hpt::backends::cpu::utils::reduce::reduce::contiguous_reduce runs 208 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 108 over it, 2.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:120 — FunctionTooLong — hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::ops::tensor::reduce::reduce::contiguous_reduce hpt-dyn/src/ops/tensor/reduce/reduce.rs:42 — FunctionTooLong — hpt_dyn::ops::tensor::reduce::reduce::contiguous_reduce runs 204 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 104 over it, 2.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_codegen::fuse::gen_fuse::_cmp_gen_fuse hpt-codegen/src/fuse/gen_fuse.rs:63 — FunctionTooLong — hpt_codegen::fuse::gen_fuse::_cmp_gen_fuse runs 200 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 100 over it, 2.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_matmul::matmul::addmm hpt-matmul/src/matmul.rs:438 — FunctionTooLong — hpt_matmul::matmul::addmm runs 200 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 100 over it, 2.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::kernels::conv2d::conv2d_new_mp::conv2d hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:25 — FunctionTooLong — hpt::backends::cpu::kernels::conv2d::conv2d_new_mp::conv2d runs 194 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 94 over it, 1.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd hpt/src/backends/cpu/utils/binary/binary_normal.rs:51 — FunctionTooLong — hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd runs 186 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cuda::utils::reduce::reduce::not_keep_last_dim hpt/src/backends/cuda/utils/reduce/reduce.rs:346 — FunctionTooLong — hpt::backends::cuda::utils::reduce::reduce::not_keep_last_dim runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::tensor_internal::gemm::gemm_with_out hpt/src/backends/cpu/tensor_internal/gemm.rs:23 — FunctionTooLong — hpt::backends::cpu::tensor_internal::gemm::gemm_with_out runs 176 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::ops::tensor::copy::_copy_from hpt-dyn/src/ops/tensor/copy.rs:35 — FunctionTooLong — hpt_dyn::ops::tensor::copy::_copy_from runs 173 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_matmul::template::func_name hpt-matmul/src/template.rs:32 — FunctionTooLong — hpt_matmul::template::func_name runs 173 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_macros::scalar_convert::__impl_scalar_convert hpt-macros/src/scalar_convert.rs:7 — FunctionTooLong — hpt_macros::scalar_convert::__impl_scalar_convert runs 172 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 72 over it, 1.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_types::promotion::utils::func_name hpt-types/src/promotion/utils.rs:147 — FunctionTooLong — hpt_types::promotion::utils::func_name runs 171 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 71 over it, 1.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::utils::onnx::init::lstm_init hpt-dyn/src/utils/onnx/init.rs:962 — FunctionTooLong — hpt_dyn::utils::onnx::init::lstm_init runs 162 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 62 over it, 1.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::kernels::matmul::template::func_name hpt/src/backends/cpu/kernels/matmul/template.rs:154 — FunctionTooLong — hpt::backends::cpu::kernels::matmul::template::func_name runs 161 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::ops::tensor::binary::binary_fn_with_out hpt-dyn/src/ops/tensor/binary.rs:26 — FunctionTooLong — hpt_dyn::ops::tensor::binary::binary_fn_with_out runs 158 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::kernels::matmul::matmul_mp_post::matmul_mixed_precision_template hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:47 — FunctionTooLong — hpt::backends::cpu::kernels::matmul::matmul_mp_post::matmul_mixed_precision_template runs 158 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::ops::tensor::conv2d::dwconv2d::dwconv2d hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:16 — FunctionTooLong — hpt_dyn::ops::tensor::conv2d::dwconv2d::dwconv2d runs 153 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:16 — FunctionTooLong — hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d runs 153 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hpt_dyn::utils::onnx::run_fwd::run_fwd hpt-dyn/src/utils/onnx/run_fwd.rs:13 — FunctionTooLong — hpt_dyn::utils::onnx::run_fwd::run_fwd runs 152 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 33 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×56
  • Duplicated block (7 lines × 2) hpt-common/src/shape/shape_utils.rs:776 — hpt-common/src/shape/shape_utils.rs:776-782 | hpt-common/src/shape/shape_utils.rs:790-796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-common/src/shape/shape_utils.rs:776` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:85 — hpt-dyn/src/ops/tensor/binary.rs:85-91 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:131-137 — before extracting anything, compare `hpt-dyn/src/ops/tensor/binary.rs` and `hpt/src/backends/cpu/utils/binary/binary_normal.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/binary.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt-dyn/src/ops/tensor/creation.rs:204 — hpt-dyn/src/ops/tensor/creation.rs:204-210 | hpt-dyn/src/ops/tensor/creation.rs:232-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:161 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:161-167 | hpt/src/backends/cpu/utils/reduce/reduce.rs:486-492 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:161` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:361 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:361-367 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:607-613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:361` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:107 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:107-113 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:130-136 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:105 — hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:105-111 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:128-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt/src/backends/cpu/tensor_internal/matmul.rs:561 — hpt/src/backends/cpu/tensor_internal/matmul.rs:561-567 | hpt/src/backends/cpu/tensor_internal/matmul.rs:577-583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/tensor_internal/matmul.rs:561` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:119 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:119-125 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:183-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt/src/backends/cpu/utils/reduce/reduce.rs:413 — hpt/src/backends/cpu/utils/reduce/reduce.rs:413-419 | hpt/src/backends/cpu/utils/reduce/reduce.rs:634-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/reduce/reduce.rs:413` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:205 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:205-211 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:341-347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:205` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1264 — hpt-codegen/src/fuse/cfg_builder.rs:1264-1270 | hpt-codegen/src/fuse/cfg_builder.rs:1725-1731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1264` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:729 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:729-735 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:832-838 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) hpt-macros/src/from_scalar.rs:30 — hpt-macros/src/from_scalar.rs:30-36 | hpt-macros/src/scalar_convert.rs:32-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/from_scalar.rs:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:98 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:98-104 | hpt/src/backends/common/reduce.rs:90-96 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/common/reduce.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:83 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:83-89 | matconv_simd/src/simd/_128bit/common/bf16x8.rs:12-18 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `matconv_simd/src/simd/_128bit/common/bf16x8.rs` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:107 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:107-113 | matconv_simd/src/simd/_128bit/common/bf16x8.rs:24-30 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `matconv_simd/src/simd/_128bit/common/bf16x8.rs` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:81 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:81-87 | matconv_simd/src/simd/_128bit/common/boolx16.rs:46-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:103 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:103-109 | matconv_simd/src/simd/_128bit/common/boolx16.rs:58-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:63 — hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:63-69 | matconv_simd/src/simd/_128bit/common/cplx32x2.rs:47-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:85 — hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:85-91 | matconv_simd/src/simd/_128bit/common/cplx32x2.rs:58-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/cplx64x1.rs:57 — hpt-types/src/vectors/arch_simd/_128bit/common/cplx64x1.rs:57-63 | matconv_simd/src/simd/_128bit/common/cplx64x1.rs:48-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/cplx64x1.rs:79 — hpt-types/src/vectors/arch_simd/_128bit/common/cplx64x1.rs:79-85 | matconv_simd/src/simd/_128bit/common/cplx64x1.rs:59-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs:38 — hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs:38-44 | matconv_simd/src/simd/_128bit/common/u32x4.rs:21-27 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs` and `matconv_simd/src/simd/_128bit/common/u32x4.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs:65 — hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs:65-71 | matconv_simd/src/simd/_128bit/common/u32x4.rs:29-35 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs` and `matconv_simd/src/simd/_128bit/common/u32x4.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • + 31 more in this group — see findings.md.
D6 · Cohesion (LCOM4) · Low cohesion · ×52
  • Low cohesion: Tensor (LCOM4 49) hpt-dyn/src/tensor.rs:29 — Tensor's methods fall into 49 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 49 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: cplx32x2 (LCOM4 17) hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:14 — cplx32x2's methods fall into 17 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 17 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: cplx64x1 (LCOM4 17) hpt-types/src/vectors/arch_simd/_128bit/common/cplx64x1.rs:13 — cplx64x1's methods fall into 17 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 17 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: cplx32x4 (LCOM4 14) hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs:14 — cplx32x4's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: cplx64x2 (LCOM4 14) hpt-types/src/vectors/arch_simd/_256bit/common/cplx64x2.rs:14 — cplx64x2's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: cplx32x8 (LCOM4 14) hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:14 — cplx32x8's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: cplx64x4 (LCOM4 14) hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:15 — cplx64x4's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: bf16x8 (LCOM4 13) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:12 — bf16x8's methods fall into 13 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 13 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: boolx16 (LCOM4 10) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:13 — boolx16's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: f32x4 (LCOM4 10) hpt-types/src/vectors/arch_simd/_128bit/common/f32x4.rs:13 — f32x4's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: f64x2 (LCOM4 10) hpt-types/src/vectors/arch_simd/_128bit/common/f64x2.rs:17 — f64x2's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: boolx32 (LCOM4 10) hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:13 — boolx32's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: i32x4 (LCOM4 9) hpt-types/src/vectors/arch_simd/_128bit/common/i32x4.rs:14 — i32x4's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: i64x2 (LCOM4 9) hpt-types/src/vectors/arch_simd/_128bit/common/i64x2.rs:15 — i64x2's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: u32x4 (LCOM4 9) hpt-types/src/vectors/arch_simd/_128bit/common/u32x4.rs:17 — u32x4's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: u64x2 (LCOM4 9) hpt-types/src/vectors/arch_simd/_128bit/common/u64x2.rs:18 — u64x2's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: boolx64 (LCOM4 9) hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:13 — boolx64's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: f32x8 (LCOM4 7) hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:11 — f32x8's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: f64x4 (LCOM4 7) hpt-types/src/vectors/arch_simd/_256bit/common/f64x4.rs:13 — f64x4's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: f32x16 (LCOM4 7) hpt-types/src/vectors/arch_simd/_512bit/common/f32x16.rs:11 — f32x16's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: f64x8 (LCOM4 7) hpt-types/src/vectors/arch_simd/_512bit/common/f64x8.rs:13 — f64x8's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: i32x8 (LCOM4 6) hpt-types/src/vectors/arch_simd/_256bit/common/i32x8.rs:12 — i32x8's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: i64x4 (LCOM4 6) hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs:13 — i64x4's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: u32x8 (LCOM4 6) hpt-types/src/vectors/arch_simd/_256bit/common/u32x8.rs:15 — u32x8's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: u64x4 (LCOM4 6) hpt-types/src/vectors/arch_simd/_256bit/common/u64x4.rs:15 — u64x4's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • + 27 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×48
  • Duplicated block (6 lines × 4) hpt-codegen/src/fuse/cfg_builder.rs:741 — hpt-codegen/src/fuse/cfg_builder.rs:741-746 | hpt-codegen/src/fuse/cfg_builder.rs:824-829 | hpt-codegen/src/fuse/cfg_builder.rs:843-848 | hpt-codegen/src/fuse/cfg_builder.rs:862-867 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:741` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `i` to `&'ast syn::ExprCast` in one and `&'ast syn::ExprField` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:461 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:461-466 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:871-876 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:458-463 | hpt/src/backends/cpu/kernels/softmax.rs:459-464 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:461` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:50 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:50-55 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:47-52 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:54-59 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:53-58 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:49` calls `to_dtype` and `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:53` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:12 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:12-17 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:36-41 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:8-13 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:32-37 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `matconv_simd/src/simd/_256bit/avx2/f16x16.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:12` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:12 — hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:12-17 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:37-42 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:8-13 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:34-39 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` and `matconv_simd/src/simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:12` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) hpt/src/backends/cpu/utils/binary/binary_normal.rs:102 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:102-107 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:121-126 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:166-171 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:185-190 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:47 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:47-52 | hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:74-79 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:51-56 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:78-83 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:47` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:154 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:154-159 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:105-110 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:149-154 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:132-137 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:161 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:161-166 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:112-117 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:156-161 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:139-144 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:168 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:168-173 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:119-124 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:163-168 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:146-151 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:175 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:175-180 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:126-131 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:170-175 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:153-158 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:182 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:182-187 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:133-138 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:177-182 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:160-165 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:189 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:189-194 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:140-145 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:184-189 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:167-172 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:196 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:196-201 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:147-152 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:191-196 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:174-179 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:203 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:203-208 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:154-159 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:198-203 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:181-186 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:210 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:210-215 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:161-166 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:205-210 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:188-193 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:217 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:217-222 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:168-173 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:212-217 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:195-200 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:232 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:232-237 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:192-197 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:227-232 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:210-215 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:239 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:239-244 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:199-204 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:234-239 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:217-222 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:254 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:254-259 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:214-219 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:249-254 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:232-237 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:261 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:261-266 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:221-226 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:256-261 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:239-244 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:268 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:268-273 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:228-233 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:263-268 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:246-251 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:275 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:275-280 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:235-240 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:270-275 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:253-258 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:282 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:282-287 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:242-247 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:277-282 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:260-265 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:289 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:289-294 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:249-254 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:284-289 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:267-272 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 23 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×42
  • Edited copy of a member (6 corresponding lines) hpt-types/src/cuda_types/convertion.rs:99 — hpt-types/src/cuda_types/convertion.rs:99-104 | hpt-types/src/cuda_types/convertion.rs:106-111 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:193 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:193-198 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:209-214 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:200 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:200-205 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:216-221 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:207 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:207-212 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:223-228 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:214 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:214-219 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:230-235 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:221 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:221-226 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:237-242 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:228 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:228-233 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:244-249 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:235 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:235-240 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:251-256 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:242 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:242-247 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:258-263 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:249 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:249-254 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:265-270 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:256 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:256-261 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:272-277 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:271 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:271-276 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:287-292 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:278 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:278-283 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:294-299 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:293 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:293-298 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:309-314 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:300 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:300-305 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:316-321 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:307 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:307-312 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:323-328 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:314 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:314-319 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:330-335 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:321 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:321-326 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:337-342 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:328 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:328-333 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:344-349 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:335 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:335-340 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:351-356 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:342 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:342-347 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:358-363 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:349 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:349-354 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:365-370 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:356 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:356-361 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:372-377 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:363 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:363-368 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:379-384 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:370 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:370-375 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:386-391 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 17 more in this group — see findings.md.
GD1 · Unfinished & placeholder code · Unfinished stub · ×40
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:278 — `visit_abi` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:282 — `visit_angle_bracketed_generic_arguments` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:289 — `visit_arm` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:293 — `visit_assoc_const` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:297 — `visit_assoc_type` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:301 — `visit_bare_fn_arg` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:305 — `visit_bare_variadic` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:309 — `visit_bin_op` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:313 — `visit_bound_lifetimes` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:317 — `visit_captured_param` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:321 — `visit_const_param` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:325 — `visit_constraint` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:329 — `visit_data` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:333 — `visit_data_enum` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:337 — `visit_data_struct` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:341 — `visit_data_union` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:345 — `visit_derive_input` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:368 — `visit_expr_async` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:372 — `visit_expr_block` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:376 — `visit_expr_closure` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:380 — `visit_expr_const` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:384 — `visit_expr_for_loop` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:388 — `visit_expr_group` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:392 — `visit_expr_loop` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:396 — `visit_expr_match` is a shipped function whose whole body is still `todo!()`/`unimplemented!()` — generated scaffolding that was never completed. Implement it or remove the dead surface.
  • + 15 more in this group — see findings.md.
X5 · Nullable reference types · Symbol treated as nullable, then dereferenced unguarded · ×40
  • Symbol treated as nullable, then dereferenced unguarded hpt-matmul/src/matmul.rs:695 — `std::alloc::Layout::from_size_align(mem_size,ALIGN)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `prepack_rhs` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-matmul/src/utils.rs:185 — `CString::new(name)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `get_cache_info` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-matmul/src/utils.rs:195 — `CString::new("hw.cachelinesize")` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `get_cache_info` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/lib.rs:842 — `attr.parse_nested_meta(|meta|{if meta.path.is_ident("algo"){let value:syn::LitStr=meta.value()?.parse()?;let algo=match value.value().as_str().to_lowercase().as_str(){"gzip"=>quote!(Gzip),"deflate"=>quote!(Deflate),"zlib"=>quote!(Zlib),"none"=>quote!(NoCompression),_=>panic!("Unsupported compression algorithm, supported: gzip, deflate, zlib, none"),};compression_algo=Some(quote!(hpt::save_load::CompressionAlgo::#algo));}else if meta.path.is_ident("level"){let value:syn::LitStr=meta.value()?.parse()?;let tmp:u32=value.value().parse().map_err(|e|{syn::Error::new(value.span(),format!("Invalid level: {}",e))})?;level=Some(quote!(#tmp));}Ok(())})` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `impl_save` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/lib.rs:957 — `hpt::save_load::parse_header_compressed::<Self,_>(&path)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `load` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/lib.rs:1003 — `value.base10_parse::<usize>()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `impl_from_safetensors` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/lib.rs:1017 — `inner_type` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `impl_from_safetensors` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/matmul_microkernels_asm.rs:127 — `path.path.get_ident()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `parse` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/matmul_microkernels_asm.rs:141 — `path.path.get_ident()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `parse` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/matmul_microkernels_asm.rs:153 — `path.path.get_ident()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `parse` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-macros/src/matmul_microkernels_asm.rs:165 — `path.path.get_ident()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `parse` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/iterator_traits.rs:180 — `predict_broadcast_shape(&self.shape(),&other.shape())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `zip` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/iterator_traits.rs:223 — `predict_broadcast_shape(&self.shape(),&other.shape())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `zip` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/iterator_traits.rs:283 — `predict_broadcast_shape(&self.shape(),&other.shape())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `zip` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/iterator_traits.rs:338 — `predict_broadcast_shape(self.shape(),other.shape())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `zip` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided.rs:86 — `tensor.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `new` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided.rs:103 — `tensor.strides().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `new` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided.rs:187 — `self.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `inner_loop_size` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided.rs:250 — `self.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `split` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided.rs:524 — `self.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `inner_loop_size` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided.rs:572 — `self.shape().last()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `split` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided_map.rs:98 — `U::empty(self.iter.shape().clone())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `collect` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided_map.rs:160 — `U::empty(self.iter.shape().clone())` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `collect` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided_mut.rs:185 — `self.base.ptr.get_ptr().add(index*(self.base.last_stride as usize)).as_mut()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `inner_loop_next` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded hpt-iterator/src/par_strided_mut.rs:392 — `self.base.ptr.get_ptr().add(index*(self.base.last_stride as usize)).as_mut()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.unwrap()` in `inner_loop_next` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • + 15 more in this group — see findings.md.
IC1 · Incompleteness & stubs · Unfinished stub · ×38
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:278 — `visit_abi` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:282 — `visit_angle_bracketed_generic_arguments` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:289 — `visit_arm` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:293 — `visit_assoc_const` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:297 — `visit_assoc_type` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:301 — `visit_bare_fn_arg` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:305 — `visit_bare_variadic` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:309 — `visit_bin_op` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:313 — `visit_bound_lifetimes` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:317 — `visit_captured_param` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:321 — `visit_const_param` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:325 — `visit_constraint` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:329 — `visit_data` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:333 — `visit_data_enum` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:337 — `visit_data_struct` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:341 — `visit_data_union` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:345 — `visit_derive_input` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:368 — `visit_expr_async` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:372 — `visit_expr_block` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:376 — `visit_expr_closure` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:380 — `visit_expr_const` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:384 — `visit_expr_for_loop` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:388 — `visit_expr_group` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:392 — `visit_expr_loop` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • Unfinished stub — body is todo!() / unimplemented!() hpt-codegen/src/fuse/build_graph.rs:396 — `visit_expr_match` is a shipped function whose whole body is `todo!()`/`unimplemented!()` — scaffolding that was never completed, and a panic on the first call. Implement it or remove the dead surface.
  • + 13 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×37
  • FileTooLong: reduce/reduce.rs hpt-dyn/src/ops/tensor/reduce/reduce.rs — FileTooLong — 2007 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1507 over it, 4.01× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: libm/sleefsimddp.rs hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs — FileTooLong — 1815 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 49 free functions. The bar is 500 significant lines; this is 1315 over it, 3.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: cpu/std_ops.rs hpt/src/backends/cpu/std_ops.rs — FileTooLong — 1787 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1287 over it, 3.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: libm/sleefsimdsp.rs hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs — FileTooLong — 1581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 67 free functions. The bar is 500 significant lines; this is 1081 over it, 3.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: cuda/std_ops.rs hpt/src/backends/cuda/std_ops.rs — FileTooLong — 1574 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1074 over it, 3.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: onnx/operators.rs hpt-dyn/src/utils/onnx/operators.rs — FileTooLong — 1573 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 74% of them inside a single declaration: Operator (3 blocks, 363-1757). The bar is 500 significant lines; this is 1073 over it, 3.15× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: fuse/cfg_builder.rs hpt-codegen/src/fuse/cfg_builder.rs — FileTooLong — 1462 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: CFGBuilder (3 blocks, 12-1908). The bar is 500 significant lines; this is 962 over it, 2.92× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: onnx/init.rs hpt-dyn/src/utils/onnx/init.rs — FileTooLong — 1148 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 39 free functions. The bar is 500 significant lines; this is 648 over it, 2.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/microkernels.rs hpt-matmul/src/microkernels.rs — FileTooLong — 1134 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 634 over it, 2.27× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/dtype.rs hpt-types/src/dtype.rs — FileTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 551 over it, 2.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: matmul/microkernels.rs hpt/src/backends/cpu/kernels/matmul/microkernels.rs — FileTooLong — 1043 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 543 over it, 2.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs hpt-macros/src/lib.rs — FileTooLong — 1038 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 39 free functions. The bar is 500 significant lines; this is 538 over it, 2.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tensor_external/float_out_unary.rs hpt/src/backends/cpu/tensor_external/float_out_unary.rs — FileTooLong — 998 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 63% of them inside a single declaration: DiffTensor (548-1479). The bar is 500 significant lines; this is 498 over it, 2.00× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: cuda_types/convertion.rs hpt-types/src/cuda_types/convertion.rs — FileTooLong — 993 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Scalar (17 blocks, 45-1333). The bar is 500 significant lines; this is 493 over it, 1.99× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: fuse/cfg.rs hpt-codegen/src/fuse/cfg.rs — FileTooLong — 848 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 348 over it, 1.70× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tensor/unary.rs hpt-dyn/src/ops/tensor/unary.rs — FileTooLong — 841 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 89% of them inside a single declaration: Tensor (116-977). The bar is 500 significant lines; this is 341 over it, 1.68× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: rnn/lstm.rs hpt-dyn/src/ops/tensor/rnn/lstm.rs — FileTooLong — 829 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 329 over it, 1.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: arch/helper_avx2.rs hpt-types/src/vectors/arch_simd/sleef/arch/helper_avx2.rs — FileTooLong — 776 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 199 free functions. The bar is 500 significant lines; this is 276 over it, 1.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tensor/random.rs hpt-dyn/src/ops/tensor/random.rs — FileTooLong — 764 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 95% of them inside a single declaration: Tensor (49-1002). The bar is 500 significant lines; this is 264 over it, 1.53× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: matmul/matmul.rs hpt-dyn/src/ops/tensor/matmul/matmul.rs — FileTooLong — 726 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 226 over it, 1.45× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: reduce/reduce.rs hpt/src/backends/cuda/utils/reduce/reduce.rs — FileTooLong — 690 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 190 over it, 1.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: normalization/kernels.rs hpt-dyn/src/ops/tensor/normalization/kernels.rs — FileTooLong — 686 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 186 over it, 1.37× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tensor/binary.rs hpt-dyn/src/ops/tensor/binary.rs — FileTooLong — 682 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: Tensor (3 blocks, 221-763). The bar is 500 significant lines; this is 182 over it, 1.36× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: fuse/build_graph.rs hpt-codegen/src/fuse/build_graph.rs — FileTooLong — 658 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 89% of them inside a single declaration: Graph (4 blocks, 82-994). The bar is 500 significant lines; this is 158 over it, 1.32× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: reduce/reduce.rs hpt/src/backends/cpu/utils/reduce/reduce.rs — FileTooLong — 652 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 152 over it, 1.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 12 more in this group — see findings.md.
D2 · Cognitive Complexity · hpt · ×36
  • hpt::backends::cpu::kernels::pooling::common::pooling_template (cognitive 77) hpt/src/backends/cpu/kernels/pooling/common.rs:18 — hpt::backends::cpu::kernels::pooling::common::pooling_template has cognitive complexity 77 (threshold 15). Drivers by points: loops 15 (39 pts), if/else 13 (31 pts), boolean chains 7 (nesting depth added 42). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d (cognitive 62) hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:16 — hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d has cognitive complexity 62 (threshold 15). Drivers by points: loops 12 (28 pts), if/else 11 (27 pts), boolean chains 7 (nesting depth added 32). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd (cognitive 62) hpt/src/backends/cpu/utils/binary/binary_normal.rs:51 — hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd has cognitive complexity 62 (threshold 15). Drivers by points: if/else 28 (58 pts), boolean chains 4 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • hpt::backends::cpu::tensor_internal::matmul::matmul_with_out (cognitive 51) hpt/src/backends/cpu/tensor_internal/matmul.rs:31 — hpt::backends::cpu::tensor_internal::matmul::matmul_with_out has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 4 (10 pts), match/switch 4 (9 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cpu::kernels::conv2d::utils::pack_kernel (cognitive 50) hpt/src/backends/cpu/kernels/conv2d/utils.rs:66 — hpt::backends::cpu::kernels::conv2d::utils::pack_kernel has cognitive complexity 50 (threshold 15). Drivers by points: loops 13 (47 pts), if/else 2 (3 pts) (nesting depth added 35). Of this number, 49 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::pooling::common::adaptive_pooling_template (cognitive 50) hpt/src/backends/cpu/kernels/pooling/common.rs:216 — hpt::backends::cpu::kernels::pooling::common::adaptive_pooling_template has cognitive complexity 50 (threshold 15). Drivers by points: loops 15 (39 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::matmul::template::func_name (cognitive 46) hpt/src/backends/cpu/kernels/matmul/template.rs:154 — hpt::backends::cpu::kernels::matmul::template::func_name has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 5 (15 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cpu::tensor_internal::fft::fftn_template (cognitive 45) hpt/src/backends/cpu/tensor_internal/fft.rs:33 — hpt::backends::cpu::tensor_internal::fft::fftn_template has cognitive complexity 45 (threshold 15). Drivers by points: loops 9 (26 pts), if/else 10 (16 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 24). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::matmul::common::pack_b_mixed_precision (cognitive 41) hpt/src/backends/cpu/kernels/matmul/common.rs:146 — hpt::backends::cpu::kernels::matmul::common::pack_b_mixed_precision has cognitive complexity 41 (threshold 15). Drivers by points: loops 11 (37 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::utils::unary::unary::cumulate (cognitive 39) hpt/src/backends/cpu/utils/unary/unary.rs:127 — hpt::backends::cpu::utils::unary::unary::cumulate has cognitive complexity 39 (threshold 15). Drivers by points: loops 8 (24 pts), if/else 7 (14 pts), match/switch 1 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hpt::backends::cpu::tensor_internal::gemm::gemm_with_out (cognitive 38) hpt/src/backends/cpu/tensor_internal/gemm.rs:23 — hpt::backends::cpu::tensor_internal::gemm::gemm_with_out has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 5 (14 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cpu::kernels::conv2d::utils::img2col_nhwc (cognitive 37) hpt/src/backends/cpu/kernels/conv2d/utils.rs:20 — hpt::backends::cpu::kernels::conv2d::utils::img2col_nhwc has cognitive complexity 37 (threshold 15). Drivers by points: loops 7 (29 pts), if/else 2 (7 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::matmul::matmul_mixed_precision::matmul_mixed_precision_template (cognitive 33) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:46 — hpt::backends::cpu::kernels::matmul::matmul_mixed_precision::matmul_mixed_precision_template has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 5 (15 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cpu::kernels::matmul::matmul_mp_post::matmul_mixed_precision_template (cognitive 33) hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:47 — hpt::backends::cpu::kernels::matmul::matmul_mp_post::matmul_mixed_precision_template has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 5 (15 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cpu::kernels::conv2d::conv2d_group::conv2d_group (cognitive 32) hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:17 — hpt::backends::cpu::kernels::conv2d::conv2d_group::conv2d_group has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (21 pts), if/else 8 (9 pts), boolean chains 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::reduce::reduce_dim_not_include_simd (cognitive 32) hpt/src/backends/cpu/kernels/reduce.rs:405 — hpt::backends::cpu::kernels::reduce::reduce_dim_not_include_simd has cognitive complexity 32 (threshold 15). Drivers by points: loops 7 (24 pts), if/else 4 (8 pts) (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::matmul::template::pack_b (cognitive 27) hpt/src/backends/cpu/kernels/matmul/template.rs:394 — hpt::backends::cpu::kernels::matmul::template::pack_b has cognitive complexity 27 (threshold 15). Drivers by points: loops 6 (17 pts), if/else 6 (9 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::normalization::logsoftmax::contiguous_dim_include (cognitive 27) hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:203 — hpt::backends::cpu::kernels::normalization::logsoftmax::contiguous_dim_include has cognitive complexity 27 (threshold 15). Drivers by points: loops 9 (25 pts), if/else 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::softmax::contiguous_dim_include (cognitive 27) hpt/src/backends/cpu/kernels/softmax.rs:204 — hpt::backends::cpu::kernels::softmax::contiguous_dim_include has cognitive complexity 27 (threshold 15). Drivers by points: loops 9 (25 pts), if/else 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::conv2d::conv2d_new_mp::conv2d (cognitive 26) hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:25 — hpt::backends::cpu::kernels::conv2d::conv2d_new_mp::conv2d has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 7 (8 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::utils::reduce::reduce_template::uncontiguos_reduce_template (cognitive 26) hpt/src/backends/cpu/utils/reduce/reduce_template.rs:404 — hpt::backends::cpu::utils::reduce::reduce_template::uncontiguos_reduce_template has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (26 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cpu::utils::reduce::reduce_template::contiguous_reduce_template (cognitive 25) hpt/src/backends/cpu/utils/reduce/reduce_template.rs:165 — hpt::backends::cpu::utils::reduce::reduce_template::contiguous_reduce_template has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (25 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt::backends::cuda::tensor_internal::softmax::contiguous_softmax (cognitive 25) hpt/src/backends/cuda/tensor_internal/softmax.rs:85 — hpt::backends::cuda::tensor_internal::softmax::contiguous_softmax has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (25 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • hpt::backends::cpu::kernels::conv2d::utils::pack_kernel_mp (cognitive 24) hpt/src/backends/cpu/kernels/conv2d/utils.rs:149 — hpt::backends::cpu::kernels::conv2d::utils::pack_kernel_mp has cognitive complexity 24 (threshold 15). Drivers by points: loops 9 (24 pts) (nesting depth added 15). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cuda::tensor_internal::conv2d::conv2d (cognitive 24) hpt/src/backends/cuda/tensor_internal/conv2d.rs:30 — hpt::backends::cuda::tensor_internal::conv2d::conv2d has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×28
  • Duplicated block (8 lines × 2) hpt-common/src/prg_update.rs:16 — hpt-common/src/prg_update.rs:16-23 | hpt-common/src/prg_update.rs:43-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-common/src/prg_update.rs:16` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:190 — hpt-dyn/src/ops/tensor/binary.rs:190-197 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:252-259 — before extracting anything, compare `hpt-dyn/src/ops/tensor/binary.rs` and `hpt/src/backends/cpu/utils/binary/binary_normal.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/binary.rs:190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:32 — hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:32-39 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:32-39 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs` and `hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:32` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:144 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:144-151 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:321-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/matmul/matmul.rs:318` calls `Some` and `hpt-dyn/src/ops/tensor/matmul/matmul.rs:143` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) hpt-iterator/src/par_strided.rs:270 — hpt-iterator/src/par_strided.rs:270-277 | hpt-iterator/src/par_strided.rs:594-601 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) hpt-macros/src/float_unary.rs:272 — hpt-macros/src/float_unary.rs:272-279 | hpt-macros/src/float_unary.rs:555-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:272` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) hpt-macros/src/float_unary.rs:281 — hpt-macros/src/float_unary.rs:281-288 | hpt-macros/src/float_unary.rs:563-570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:281` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) hpt-macros/src/lib.rs:1153 — hpt-macros/src/lib.rs:1153-1160 | hpt-macros/src/lib.rs:1330-1337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1153` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) hpt-macros/src/normal_out.rs:38 — hpt-macros/src/normal_out.rs:38-45 | hpt-macros/src/simd_normal_out.rs:70-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) hpt-macros/src/normal_out.rs:62 — hpt-macros/src/normal_out.rs:62-69 | hpt-macros/src/simd_normal_out.rs:58-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `rhs` to `#rhs_dtype` in one and `#rhs_simd` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-macros/src/normal_out.rs:59` calls `_rem`, `__rem` and `hpt-macros/src/simd_normal_out.rs:56` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:184 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:184-191 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:188-195 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:194 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:194-201 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:198-205 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:641 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:641-648 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:659-666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-types/src/vectors/arch_simd/sleef/common/df.rs:667` calls `vmla_vf_vf_vf_vf`, `vf2gety_vf_vf2` and `hpt-types/src/vectors/arch_simd/sleef/common/df.rs:650` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:240 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:240-247 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:380-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) hpt/src/backends/cuda/tensor_internal/layernorm.rs:164 — hpt/src/backends/cuda/tensor_internal/layernorm.rs:164-171 | hpt/src/backends/cuda/tensor_internal/softmax.rs:450-457 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:49 — hpt-dyn/src/ops/tensor/binary.rs:49-56 | hpt-dyn/src/ops/tensor/binary.rs:94-101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) hpt-matmul/src/utils.rs:87 — hpt-matmul/src/utils.rs:87-94 | hpt/src/backends/cpu/kernels/matmul/common.rs:92-99 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/common.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/utils.rs:87` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:57 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:57-64 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:136-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) hpt/src/backends/cuda/utils/binary/binary_normal.rs:102 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:102-109 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:201-208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:43 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:43-50 | hpt/src/backends/common/reduce.rs:35-42 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/common/reduce.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:82 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:82-89 | matconv_simd/src/simd/_256bit/common/bf16x16.rs:49-56 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` and `matconv_simd/src/simd/_256bit/common/bf16x16.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) hpt-codegen/src/fuse/ty_infer.rs:159 — hpt-codegen/src/fuse/ty_infer.rs:159-166 | hpt-codegen/src/fuse/ty_infer.rs:176-185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/ty_infer.rs:159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1127 — hpt-codegen/src/fuse/cfg_builder.rs:1127-1135 | hpt-codegen/src/fuse/cfg_builder.rs:1221-1228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1127` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-codegen/src/fuse/cfg_builder.rs:1228` calls `to_token_stream`, `to_string` and `hpt-codegen/src/fuse/cfg_builder.rs:1135` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) hpt-codegen/src/fuse/codegen.rs:75 — hpt-codegen/src/fuse/codegen.rs:75-82 | hpt-codegen/src/fuse/codegen.rs:112-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/codegen.rs:75` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) hpt/src/backends/cpu/tensor_internal/gemm.rs:45 — hpt/src/backends/cpu/tensor_internal/gemm.rs:45-52 | hpt/src/backends/cpu/tensor_internal/gemm.rs:99-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 3 more in this group — see findings.md.
D2 · Cognitive Complexity · hpt_dyn · ×27
  • hpt_dyn::ops::tensor::pooling::template::pooling_template (cognitive 77) hpt-dyn/src/ops/tensor/pooling/template.rs:15 — hpt_dyn::ops::tensor::pooling::template::pooling_template has cognitive complexity 77 (threshold 15). Drivers by points: loops 15 (39 pts), if/else 13 (31 pts), boolean chains 7 (nesting depth added 42). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::dwconv2d::dwconv2d (cognitive 62) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:16 — hpt_dyn::ops::tensor::conv2d::dwconv2d::dwconv2d has cognitive complexity 62 (threshold 15). Drivers by points: loops 12 (28 pts), if/else 11 (27 pts), boolean chains 7 (nesting depth added 32). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::utils::pack_kernel (cognitive 51) hpt-dyn/src/ops/tensor/conv2d/utils.rs:63 — hpt_dyn::ops::tensor::conv2d::utils::pack_kernel has cognitive complexity 51 (threshold 15). Drivers by points: loops 13 (47 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 35). Of this number, 50 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::pooling::template::adaptive_pooling_template (cognitive 50) hpt-dyn/src/ops/tensor/pooling/template.rs:216 — hpt_dyn::ops::tensor::pooling::template::adaptive_pooling_template has cognitive complexity 50 (threshold 15). Drivers by points: loops 15 (39 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::utils::onnx::init::lstm_init (cognitive 43) hpt-dyn/src/utils/onnx/init.rs:962 — hpt_dyn::utils::onnx::init::lstm_init has cognitive complexity 43 (threshold 15). Drivers by points: if/else 32 (36 pts), loops 2 (7 pts) (nesting depth added 9). Of this number, 35 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • hpt_dyn::ops::tensor::conv2d::utils::img2col_nhwc (cognitive 37) hpt-dyn/src/ops/tensor/conv2d/utils.rs:17 — hpt_dyn::ops::tensor::conv2d::utils::img2col_nhwc has cognitive complexity 37 (threshold 15). Drivers by points: loops 7 (29 pts), if/else 2 (7 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::copy::_copy_from (cognitive 37) hpt-dyn/src/ops/tensor/copy.rs:35 — hpt_dyn::ops::tensor::copy::_copy_from has cognitive complexity 37 (threshold 15). Drivers by points: loops 5 (18 pts), if/else 10 (13 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::utils::onnx::optimize::constant_fold::pre_transpose (cognitive 36) hpt-dyn/src/utils/onnx/optimize/constant_fold.rs:7 — hpt_dyn::utils::onnx::optimize::constant_fold::pre_transpose has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 7 (13 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_dyn::ops::tensor::binary::binary_fn_with_out (cognitive 33) hpt-dyn/src/ops/tensor/binary.rs:26 — hpt_dyn::ops::tensor::binary::binary_fn_with_out has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_dyn::ops::tensor::conv2d::conv2d_group::conv2d_group (cognitive 32) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:16 — hpt_dyn::ops::tensor::conv2d::conv2d_group::conv2d_group has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (21 pts), if/else 8 (9 pts), boolean chains 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::reduce::kernels::reduce_dim_not_include_simd (cognitive 32) hpt-dyn/src/ops/tensor/reduce/kernels.rs:402 — hpt_dyn::ops::tensor::reduce::kernels::reduce_dim_not_include_simd has cognitive complexity 32 (threshold 15). Drivers by points: loops 7 (24 pts), if/else 4 (8 pts) (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d (cognitive 29) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:120 — hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d has cognitive complexity 29 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 9 (10 pts), boolean chains 3, match/switch 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::rnn::lstm::lstm_step (cognitive 28) hpt-dyn/src/ops/tensor/rnn/lstm.rs:179 — hpt_dyn::ops::tensor::rnn::lstm::lstm_step has cognitive complexity 28 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 8, match/switch 2 (4 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::normalization::kernels::contiguous_softmax_dim_include (cognitive 27) hpt-dyn/src/ops/tensor/normalization/kernels.rs:206 — hpt_dyn::ops::tensor::normalization::kernels::contiguous_softmax_dim_include has cognitive complexity 27 (threshold 15). Drivers by points: loops 9 (25 pts), if/else 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (hpt_dyn::ops::tensor::normalization::kernels::contiguous_logsoftmax_dim_include) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • hpt_dyn::ops::tensor::normalization::kernels::contiguous_logsoftmax_dim_include (cognitive 27) hpt-dyn/src/ops/tensor/normalization/kernels.rs:616 — hpt_dyn::ops::tensor::normalization::kernels::contiguous_logsoftmax_dim_include has cognitive complexity 27 (threshold 15). Drivers by points: loops 9 (25 pts), if/else 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (hpt_dyn::ops::tensor::normalization::kernels::contiguous_softmax_dim_include) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • hpt_dyn::ops::tensor::rnn::lstm::lstm_step_onnx (cognitive 27) hpt-dyn/src/ops/tensor/rnn/lstm.rs:423 — hpt_dyn::ops::tensor::rnn::lstm::lstm_step_onnx has cognitive complexity 27 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 8 (9 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::utils::pack_kernel_mp (cognitive 24) hpt-dyn/src/ops/tensor/conv2d/utils.rs:146 — hpt_dyn::ops::tensor::conv2d::utils::pack_kernel_mp has cognitive complexity 24 (threshold 15). Drivers by points: loops 9 (24 pts) (nesting depth added 15). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::normalization::kernels::softmax_dim_not_include (cognitive 23) hpt-dyn/src/ops/tensor/normalization/kernels.rs:83 — hpt_dyn::ops::tensor::normalization::kernels::softmax_dim_not_include has cognitive complexity 23 (threshold 15). Drivers by points: loops 10 (23 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (hpt_dyn::ops::tensor::normalization::kernels::uncontiguous_softmax_dim_not_include) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • hpt_dyn::ops::tensor::normalization::kernels::uncontiguous_softmax_dim_not_include (cognitive 23) hpt-dyn/src/ops/tensor/normalization/kernels.rs:367 — hpt_dyn::ops::tensor::normalization::kernels::uncontiguous_softmax_dim_not_include has cognitive complexity 23 (threshold 15). Drivers by points: loops 10 (23 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (hpt_dyn::ops::tensor::normalization::kernels::softmax_dim_not_include) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • hpt_dyn::ops::tensor::normalization::kernels::logsoftmax_dim_not_include (cognitive 20) hpt-dyn/src/ops/tensor/normalization/kernels.rs:494 — hpt_dyn::ops::tensor::normalization::kernels::logsoftmax_dim_not_include has cognitive complexity 20 (threshold 15). Drivers by points: loops 9 (20 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (hpt_dyn::ops::tensor::normalization::kernels::uncontiguous_logsoftmax_dim_not_include) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • hpt_dyn::ops::tensor::normalization::kernels::uncontiguous_logsoftmax_dim_not_include (cognitive 20) hpt-dyn/src/ops/tensor/normalization/kernels.rs:780 — hpt_dyn::ops::tensor::normalization::kernels::uncontiguous_logsoftmax_dim_not_include has cognitive complexity 20 (threshold 15). Drivers by points: loops 9 (20 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (hpt_dyn::ops::tensor::normalization::kernels::logsoftmax_dim_not_include) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • hpt_dyn::utils::onnx::fwd::slice_fwd (cognitive 20) hpt-dyn/src/utils/onnx/fwd.rs:119 — hpt_dyn::utils::onnx::fwd::slice_fwd has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 6 (8 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::conv2d_direct::conv2d (cognitive 18) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:15 — hpt_dyn::ops::tensor::conv2d::conv2d_direct::conv2d has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 2, boolean chains 1 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d_mp (cognitive 17) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:27 — hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d_mp has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hpt_dyn::ops::tensor::matmul::matmul::addmm_with_out (cognitive 17) hpt-dyn/src/ops/tensor/matmul/matmul.rs:183 — hpt_dyn::ops::tensor::matmul::matmul::addmm_with_out has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×27
  • Duplicated block (12 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1143 — hpt-codegen/src/fuse/cfg_builder.rs:1143-1154 | hpt-codegen/src/fuse/cfg_builder.rs:1195-1206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:69 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:69-80 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:105-116 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:93 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:93-104 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:87-98 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:220 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:220-231 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:125-136 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 251 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:448 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:448-459 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:541-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:448` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:465 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:465-476 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:558-569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:465` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:557 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:557-568 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:605-616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:557` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:835 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:835-846 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:882-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:835` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:60 — hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:60-71 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:217-228 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_template.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:60` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-dyn/src/utils/onnx/fwd.rs:370 — hpt-dyn/src/utils/onnx/fwd.rs:370-381 | hpt-dyn/src/utils/onnx/fwd.rs:401-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/onnx/fwd.rs:370` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-iterator/src/shape_manipulate.rs:89 — hpt-iterator/src/shape_manipulate.rs:89-100 | hpt-iterator/src/shape_manipulate.rs:117-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) hpt-matmul/src/matmul.rs:475 — hpt-matmul/src/matmul.rs:475-486 | hpt-matmul/src/matmul.rs:498-509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/matmul.rs:475` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:112 — hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:112-123 | hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:138-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2492 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2492-2503 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2525-2536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2492` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:73 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:73-84 | hpt/src/backends/cpu/kernels/matmul/template.rs:180-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:178 — hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:178-189 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:177-188 — before extracting anything, compare `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs` and `hpt/src/backends/cpu/kernels/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 197 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:178` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt/src/backends/cuda/tensor_internal/matmul.rs:175 — hpt/src/backends/cuda/tensor_internal/matmul.rs:175-186 | hpt/src/backends/cuda/tensor_internal/matmul.rs:249-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/matmul.rs:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt/src/backends/cuda/utils/binary/binary_normal.rs:415 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:415-426 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:460-471 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) hpt-iterator/src/par_strided.rs:191 — hpt-iterator/src/par_strided.rs:191-202 | hpt-iterator/src/par_strided.rs:528-539 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-iterator/src/par_strided.rs:204` calls `next_simd` and `hpt-iterator/src/par_strided.rs:541` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) hpt-iterator/src/strided.rs:138 — hpt-iterator/src/strided.rs:138-149 | hpt-iterator/src/strided.rs:313-324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:85 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:85-96 | hpt/src/backends/common/reduce.rs:77-88 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/common/reduce.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) hpt-dyn/src/utils/onnx/init.rs:758 — hpt-dyn/src/utils/onnx/init.rs:758-769 | hpt-dyn/src/utils/onnx/init.rs:782-793 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/utils/onnx/init.rs:757` calls `parse` and `hpt-dyn/src/utils/onnx/init.rs:781` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) hpt-iterator/src/shape_manipulate.rs:77 — hpt-iterator/src/shape_manipulate.rs:77-88 | hpt-iterator/src/shape_manipulate.rs:199-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:290 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:290-301 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:270-281 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/conv2d/utils.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:215 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:215-226 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:451-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×22
  • Duplicated block (10 lines × 2) hpt-allocator/src/allocators/cuda.rs:54 — hpt-allocator/src/allocators/cuda.rs:54-63 | hpt-allocator/src/allocators/cuda.rs:79-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-allocator/src/allocators/cuda.rs:54` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:58 — hpt-dyn/src/ops/tensor/binary.rs:58-67 | hpt-dyn/src/ops/tensor/binary.rs:149-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) hpt-dyn/src/ops/tensor/creation.rs:133 — hpt-dyn/src/ops/tensor/creation.rs:133-142 | hpt-dyn/src/ops/tensor/creation.rs:163-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/creation.rs:133` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:421 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:421-430 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:455-464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:421` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:119 — hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:119-128 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:436-445 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_template.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:200 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:200-209 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:444-453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) hpt-dyn/src/tensor.rs:109 — hpt-dyn/src/tensor.rs:109-118 | hpt-dyn/src/tensor.rs:136-145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/tensor.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-dyn/src/utils/onnx/operators.rs:877 — hpt-dyn/src/utils/onnx/operators.rs:877-886 | hpt-dyn/src/utils/onnx/operators.rs:1067-1076 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/onnx/operators.rs:877` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-macros/src/float_unary.rs:73 — hpt-macros/src/float_unary.rs:73-82 | hpt-macros/src/float_unary.rs:367-376 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-macros/src/lib.rs:445 — hpt-macros/src/lib.rs:445-454 | hpt-macros/src/lib.rs:539-548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:445` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `rhs` to `#rhs_dtype` in one and `Scalar<#rhs_dtype>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:15 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:15-24 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:19-28 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `matconv_simd/src/simd/_128bit/sse/f16x8.rs:14` calls `copy_from_slice` and `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:12` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:118 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:118-127 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:116-125 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:118` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:141 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:141-150 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:139-148 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:141` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:141 — hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:141-150 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:172-181 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:141` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `false_val` to `boolx32` in one and `boolx64` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:890 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:890-899 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1134-1143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:890` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1096 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1096-1105 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1411-1420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) hpt/src/backends/cuda/tensor_internal/matmul.rs:149 — hpt/src/backends/cuda/tensor_internal/matmul.rs:149-158 | hpt/src/backends/cuda/tensor_internal/matmul.rs:223-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/matmul.rs:149` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt/src/backends/cuda/tensor_internal/softmax.rs:261 — hpt/src/backends/cuda/tensor_internal/softmax.rs:261-270 | hpt/src/backends/cuda/tensor_internal/softmax.rs:446-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/softmax.rs:261` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-conv/src/lib.rs:123 — hpt-conv/src/lib.rs:123-132 | hpt-matmul/src/lib.rs:130-139 — before extracting anything, compare `hpt-conv/src/lib.rs` and `hpt-matmul/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:32 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:32-41 | hpt/src/backends/common/reduce.rs:24-33 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/common/reduce.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) hpt/src/backends/cuda/cuda_utils.rs:274 — hpt/src/backends/cuda/cuda_utils.rs:274-283 | hpt/src/backends/cuda/cuda_utils.rs:284-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/cuda_utils.rs:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) hpt-tests/src/hpt/cpu/binary_out.rs:102 — hpt-tests/src/hpt/cpu/binary_out.rs:102-111 | hpt-tests/src/hpt/cpu/binary_out.rs:113-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×20
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-codegen/src/fuse/cfg_builder.rs:689 — hpt-codegen/src/fuse/cfg_builder.rs:689-752 | hpt-codegen/src/fuse/cfg_builder.rs:818-835 | hpt-codegen/src/fuse/cfg_builder.rs:837-854 | hpt-codegen/src/fuse/cfg_builder.rs:856-873 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-codegen/src/fuse/cfg_builder.rs:1242 — hpt-codegen/src/fuse/cfg_builder.rs:1242-1270 | hpt-codegen/src/fuse/cfg_builder.rs:1271-1343 | hpt-codegen/src/fuse/cfg_builder.rs:1397-1429 | hpt-codegen/src/fuse/cfg_builder.rs:1496-1536 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/conv2d/utils.rs:73 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:73-144 | hpt-dyn/src/ops/tensor/conv2d/utils.rs:159-207 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:76-147 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:162-209 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/creation.rs:180 — hpt-dyn/src/ops/tensor/creation.rs:180-194 | hpt-dyn/src/ops/tensor/creation.rs:203-221 | hpt-dyn/src/ops/tensor/creation.rs:231-249 | hpt-dyn/src/ops/tensor/creation.rs:258-272 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/normalization/kernels.rs:338 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:338-364 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:750-777 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:337-364 | hpt/src/backends/cpu/kernels/softmax.rs:336-362 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:280 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:280-323 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:341-379 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:287-331 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:350-389 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/reduce/kernels.rs:10 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:10-23 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:69-82 | hpt/src/backends/cpu/kernels/reduce.rs:11-24 | hpt/src/backends/cpu/kernels/reduce.rs:71-84 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/reduce/kernels.rs:674 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:674-691 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:716-733 | hpt/src/backends/cpu/kernels/reduce.rs:680-697 | hpt/src/backends/cpu/kernels/reduce.rs:723-740 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/reduce/reduce.rs:67 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:67-269 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:290-436 | hpt/src/backends/cpu/utils/reduce/reduce.rs:398-598 | hpt/src/backends/cpu/utils/reduce/reduce.rs:622-761 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-dyn/src/utils/onnx/init.rs:714 — hpt-dyn/src/utils/onnx/init.rs:714-733 | hpt-dyn/src/utils/onnx/init.rs:1246-1268 | hpt-dyn/src/utils/onnx/init.rs:1344-1384 | hpt-dyn/src/utils/onnx/init.rs:1389-1407 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-matmul/src/template.rs:67 — hpt-matmul/src/template.rs:67-247 | hpt-matmul/src/template.rs:381-537 | hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:72-215 | hpt/src/backends/cpu/kernels/matmul/template.rs:179-348 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:402 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:402-410 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:362-370 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:397-405 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:380-388 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:46 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:46-69 | hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:73-91 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:50-73 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:77-95 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:11 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:11-31 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:11-32 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:7-27 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:7-28 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:11 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:11-31 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:35-53 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:7-27 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:31-49 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:84 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:84-102 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:82-100 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:80-98 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:82-100 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:106 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:106-127 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:129-150 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:104-125 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:127-148 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:65 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:65-76 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:107-118 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:48-59 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:123-134 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:11 — hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:11-32 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:36-54 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:7-28 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:33-51 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) hpt-tests/src/hpt/cpu/bn_conv2d.rs:232 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:232-268 | hpt-tests/src/hpt/cpu/conv2d.rs:119-144 | hpt-tests/src/hpt/cpu/conv2d.rs:152-177 | hpt-tests/src/hpt/cpu/conv2d.rs:185-212 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×19
  • Duplicated block (5 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:432 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:432-436 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:466-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:432` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:84 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:84-88 | hpt/src/backends/cpu/utils/reduce/reduce.rs:410-414 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:236 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:236-240 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:501-505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) hpt-dyn/src/utils/index_cal.rs:224 — hpt-dyn/src/utils/index_cal.rs:224-228 | hpt-dyn/src/utils/index_cal.rs:237-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/index_cal.rs:224` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/utils/index_cal.rs:242` calls `get_unchecked` and `hpt-dyn/src/utils/index_cal.rs:229` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) hpt-macros/src/lib.rs:1248 — hpt-macros/src/lib.rs:1248-1252 | hpt-macros/src/lib.rs:1270-1274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1248` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) hpt-macros/src/normal_out.rs:167 — hpt-macros/src/normal_out.rs:167-171 | hpt-macros/src/normal_out.rs:205-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/normal_out.rs:167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/normal_out.rs:210` calls `cast` and `hpt-macros/src/normal_out.rs:172` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) hpt-types/src/dyn_dispatch/scalar.rs:302 — hpt-types/src/dyn_dispatch/scalar.rs:302-306 | hpt-types/src/dyn_dispatch/scalar.rs:317-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/dyn_dispatch/scalar.rs:302` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:52 — hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:52-56 | hpt-types/src/vectors/arch_simd/_512bit/common/f64x8.rs:32-36 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/f64x8.rs` as WHOLE FILES: 82% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:52` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:506 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:506-510 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:662-666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-types/src/vectors/arch_simd/sleef/common/df.rs:501` calls `vupper_vf_vf`, `vf2getx_vf_vf2`, `vsub_vf_vf_vf` and `hpt-types/src/vectors/arch_simd/sleef/common/df.rs:660` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:569 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:569-573 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:604-608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) hpt/src/backends/cpu/kernels/matmul/microkernels.rs:190 — hpt/src/backends/cpu/kernels/matmul/microkernels.rs:190-194 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:209-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/microkernels.rs:190` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) hpt/src/backends/cpu/kernels/matmul/microkernels.rs:194 — hpt/src/backends/cpu/kernels/matmul/microkernels.rs:194-198 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:216-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/microkernels.rs:194` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) hpt/src/backends/cuda/utils/binary/binary_normal.rs:301 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:301-305 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:504-509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:301` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) hpt/src/backends/cuda/utils/binary/binary_normal.rs:296 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:296-301 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:362-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 2) hpt-codegen/src/fuse/kernel_type.rs:10 — hpt-codegen/src/fuse/kernel_type.rs:10-14 | hpt-codegen/src/fuse/kernel_type.rs:21-25 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/kernel_type.rs:10` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) hpt-dataloader/src/save.rs:105 — hpt-dataloader/src/save.rs:105-109 | hpt-dataloader/src/struct_save/save.rs:154-158 — before extracting anything, compare `hpt-dataloader/src/save.rs` and `hpt-dataloader/src/struct_save/save.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) hpt-display/src/display.rs:59 — hpt-display/src/display.rs:59-63 | hpt-display/src/display.rs:137-141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-display/src/display.rs:59` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-display/src/display.rs:58` calls `push_str` and `hpt-display/src/display.rs:136` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) hpt-matmul/src/template.rs:279 — hpt-matmul/src/template.rs:279-283 | hpt-matmul/src/template.rs:307-311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/template.rs:279` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) hpt/src/backends/cuda/cuda_utils.rs:41 — hpt/src/backends/cuda/cuda_utils.rs:41-45 | hpt/src/backends/cuda/cuda_utils.rs:52-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×18
  • Duplicated block (9 lines × 2) hpt-codegen/src/fuse/codegen.rs:88 — hpt-codegen/src/fuse/codegen.rs:88-96 | hpt-codegen/src/fuse/codegen.rs:111-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/codegen.rs:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt-codegen/src/fuse/use_define_visitor.rs:70 — hpt-codegen/src/fuse/use_define_visitor.rs:70-78 | hpt-codegen/src/fuse/variable_collector.rs:51-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/use_define_visitor.rs:70` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) hpt-display/src/display.rs:33 — hpt-display/src/display.rs:33-41 | hpt-display/src/display.rs:109-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-display/src/display.rs:33` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:61 — hpt-dyn/src/ops/tensor/binary.rs:61-69 | hpt-dyn/src/ops/tensor/binary.rs:106-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/binary.rs:61` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:444 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:444-452 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:496-504 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hpt-iterator/src/par_strided.rs:280 — hpt-iterator/src/par_strided.rs:280-288 | hpt-iterator/src/par_strided.rs:604-612 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/par_strided.rs:280` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt-macros/src/matmul_microkernels_asm.rs:47 — hpt-macros/src/matmul_microkernels_asm.rs:47-55 | hpt-macros/src/matmul_microkernels_asm.rs:80-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:899 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:899-907 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1813-1821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:899` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:76 — hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:76-84 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:157-165 — before extracting anything, compare `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt/src/backends/cpu/tensor_internal/matmul.rs:52 — hpt/src/backends/cpu/tensor_internal/matmul.rs:52-60 | hpt/src/backends/cpu/tensor_internal/matmul.rs:97-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/tensor_internal/matmul.rs:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:42 — hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:42-50 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:93-101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:90` calls `ndim`, `sort_by`, `cmp` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:40` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:525 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:525-533 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:376-384 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/conv2d/utils.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/utils.rs:525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt-matmul/src/matmul.rs:168 — hpt-matmul/src/matmul.rs:168-176 | hpt-matmul/src/matmul.rs:247-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hpt/src/backends/cuda/tensor_internal/softmax.rs:100 — hpt/src/backends/cuda/tensor_internal/softmax.rs:100-108 | hpt/src/backends/cuda/tensor_internal/softmax.rs:349-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:21 — hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:21-29 | hpt-types/src/vectors/arch_simd/_512bit/common/f32x16.rs:21-29 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/f32x16.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:21` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) hpt-dataloader/src/data_loader.rs:65 — hpt-dataloader/src/data_loader.rs:65-73 | hpt-dataloader/src/data_loader.rs:94-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hpt-tests/src/hpt/cpu/softmax.rs:15 — hpt-tests/src/hpt/cpu/softmax.rs:15-23 | hpt-tests/src/hpt/cuda/normalization.rs:17-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) hpt-tests/src/hpt/cpu/unary.rs:29 — hpt-tests/src/hpt/cpu/unary.rs:29-37 | hpt-tests/src/hpt/cuda/unary.rs:34-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/unary.rs:34` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D15 · Churn × Complexity Hotspots · Hotspot · ×16
  • Hotspot: hpt-dyn/src/utils/onnx/operators.rs hpt-dyn/src/utils/onnx/operators.rs:1142 — hpt-dyn/src/utils/onnx/operators.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 131 in Operator::outputs at line 1142. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/utils/onnx/operators.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/ops/tensor/matmul/matmul.rs hpt-dyn/src/ops/tensor/matmul/matmul.rs:375 — hpt-dyn/src/ops/tensor/matmul/matmul.rs changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in Tensor::gemm at line 375. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/ops/tensor/matmul/matmul.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-matmul/src/matmul.rs hpt-matmul/src/matmul.rs:438 — hpt-matmul/src/matmul.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in hpt_matmul::matmul::addmm at line 438. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-matmul/src/matmul.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt/src/backends/cpu/tensor_internal/matmul.rs hpt/src/backends/cpu/tensor_internal/matmul.rs:31 — hpt/src/backends/cpu/tensor_internal/matmul.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in hpt::backends::cpu::tensor_internal::matmul::matmul_with_out at line 31. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt/src/backends/cpu/tensor_internal/matmul.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/utils/onnx/init.rs hpt-dyn/src/utils/onnx/init.rs:962 — hpt-dyn/src/utils/onnx/init.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in hpt_dyn::utils::onnx::init::lstm_init at line 962. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/utils/onnx/init.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/tensor.rs hpt-dyn/src/tensor.rs:92 — hpt-dyn/src/tensor.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in Tensor::from_onnx_tensor at line 92. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/tensor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/ops/tensor/copy.rs hpt-dyn/src/ops/tensor/copy.rs:35 — hpt-dyn/src/ops/tensor/copy.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in hpt_dyn::ops::tensor::copy::_copy_from at line 35. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/ops/tensor/copy.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-matmul/src/utils.rs hpt-matmul/src/utils.rs:570 — hpt-matmul/src/utils.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in hpt_matmul::utils::pack_b at line 570. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-matmul/src/utils.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/utils/onnx/fwd.rs hpt-dyn/src/utils/onnx/fwd.rs:396 — hpt-dyn/src/utils/onnx/fwd.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in hpt_dyn::utils::onnx::fwd::conv_fused_fwd at line 396. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/utils/onnx/fwd.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-macros/src/lib.rs hpt-macros/src/lib.rs:1152 — hpt-macros/src/lib.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in hpt_macros::impl_dispatch at line 1152. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-macros/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:120 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d at line 120. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt/src/backends/cpu/tensor_internal/advance.rs hpt/src/backends/cpu/tensor_internal/advance.rs:125 — hpt/src/backends/cpu/tensor_internal/advance.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in _Tensor::topk at line 125. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt/src/backends/cpu/tensor_internal/advance.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt/src/backends/cpu/utils/binary/binary_normal.rs hpt/src/backends/cpu/utils/binary/binary_normal.rs:51 — hpt/src/backends/cpu/utils/binary/binary_normal.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd at line 51. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt/src/backends/cpu/utils/binary/binary_normal.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt-dyn/src/ops/tensor/conv2d/utils.rs hpt-dyn/src/ops/tensor/conv2d/utils.rs:63 — hpt-dyn/src/ops/tensor/conv2d/utils.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in hpt_dyn::ops::tensor::conv2d::utils::pack_kernel at line 63. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt-dyn/src/ops/tensor/conv2d/utils.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:16 — hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d at line 16. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: hpt/src/backends/cpu/tensor_internal/normalization.rs hpt/src/backends/cpu/tensor_internal/normalization.rs:49 — hpt/src/backends/cpu/tensor_internal/normalization.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in _Tensor::layernorm at line 49. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-03-26..2025-06-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-03-26 17:23:07 -04:00' --until='2025-06-24 17:23:07 -04:00' --full-history --no-merges -- hpt/src/backends/cpu/tensor_internal/normalization.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D3 · God Classes · MethodTooLong · ×16
  • MethodTooLong: Tensor.cast hpt-dyn/src/ops/tensor/unary.rs:610 — MethodTooLong — cast runs 358 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 258 over it, 3.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Tensor.func_name hpt-dyn/src/ops/tensor/binary.rs:230 — MethodTooLong — func_name runs 357 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 257 over it, 3.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.inputs hpt-dyn/src/utils/onnx/operators.rs:754 — MethodTooLong — inputs runs 176 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: _Tensor.topk hpt/src/backends/cpu/tensor_internal/advance.rs:125 — MethodTooLong — topk runs 169 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CFGBuilder.visit_expr_binary hpt-codegen/src/fuse/cfg_builder.rs:1025 — MethodTooLong — visit_expr_binary runs 166 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.inputs_mut hpt-dyn/src/utils/onnx/operators.rs:956 — MethodTooLong — inputs_mut runs 164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Tensor.gemm hpt-dyn/src/ops/tensor/matmul/matmul.rs:375 — MethodTooLong — gemm runs 150 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.outputs hpt-dyn/src/utils/onnx/operators.rs:1142 — MethodTooLong — outputs runs 147 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 47 over it, 1.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.outputs_mut hpt-dyn/src/utils/onnx/operators.rs:1304 — MethodTooLong — outputs_mut runs 147 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 47 over it, 1.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.fmt hpt-dyn/src/utils/onnx/operators.rs:1619 — MethodTooLong — fmt runs 132 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.id hpt-dyn/src/utils/onnx/operators.rs:623 — MethodTooLong — id runs 128 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Operator.to_enum hpt-dyn/src/utils/onnx/operators.rs:1485 — MethodTooLong — to_enum runs 128 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: _Tensor.layernorm hpt/src/backends/cpu/tensor_internal/normalization.rs:49 — MethodTooLong — layernorm runs 127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Graph.to_cmp_pet_graph hpt-codegen/src/fuse/build_graph.rs:109 — MethodTooLong — to_cmp_pet_graph runs 125 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MatmulMicrokernelArgs.parse hpt-macros/src/matmul_microkernels_asm.rs:36 — MethodTooLong — parse runs 123 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 23 over it, 1.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: _Tensor.concat hpt/src/backends/cuda/tensor_internal/shape_manipulate.rs:166 — MethodTooLong — concat runs 103 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×16
  • Edited copy of a member (7 corresponding lines) hpt-dyn/src/ops/tensor/conv2d/utils.rs:557 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:557-563 | hpt/src/backends/common/conv.rs:9-15 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:694 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:694-700 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:677-683 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:263 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:263-269 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:279-285 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:285 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:285-291 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:301-307 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:398 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:398-404 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:414-420 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:451 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:451-457 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:467-473 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:459 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:459-465 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:475-481 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:467 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:467-473 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:483-489 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:484 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:484-490 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:500-506 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:503 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:503-509 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:519-525 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:581 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:581-587 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:597-603 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-dyn/src/utils/onnx/fwd.rs:55 — hpt-dyn/src/utils/onnx/fwd.rs:55-61 | hpt-dyn/src/utils/onnx/fwd.rs:614-620 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-allocator/src/allocators/cpu.rs:133 — hpt-allocator/src/allocators/cpu.rs:133-139 | hpt-allocator/src/allocators/cuda.rs:140-146 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:29 — hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:29-35 | matconv_simd/src/simd/_512bit/common/boolx64.rs:11-17 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:187 — hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:187-193 | matconv_simd/src/simd/_512bit/common/boolx64.rs:41-47 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:209 — hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:209-215 | matconv_simd/src/simd/_512bit/common/boolx64.rs:52-58 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×14
  • Duplicated block (11 lines × 2) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:283 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:283-293 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:290-300 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:513 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:513-523 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:606-616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:513` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) hpt-dyn/src/ops/tensor/unary.rs:46 — hpt-dyn/src/ops/tensor/unary.rs:46-56 | hpt/src/backends/cpu/utils/unary/unary.rs:39-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/unary.rs:46` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt-dyn/src/utils/onnx/fwd.rs:383 — hpt-dyn/src/utils/onnx/fwd.rs:383-393 | hpt-dyn/src/utils/onnx/fwd.rs:466-476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/onnx/fwd.rs:383` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt-macros/src/lib.rs:870 — hpt-macros/src/lib.rs:870-880 | hpt-macros/src/lib.rs:932-942 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:870` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt-matmul/src/matmul.rs:508 — hpt-matmul/src/matmul.rs:508-518 | hpt-matmul/src/matmul.rs:657-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/matmul.rs:508` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt-matmul/src/utils.rs:27 — hpt-matmul/src/utils.rs:27-37 | hpt/src/backends/cpu/kernels/matmul/common.rs:35-45 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/common.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1336 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1336-1346 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1456-1466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) hpt/src/backends/cpu/kernels/conv2d/utils.rs:323 — hpt/src/backends/cpu/kernels/conv2d/utils.rs:323-333 | hpt/src/backends/cpu/kernels/matmul/utils.rs:46-56 — `hpt/src/backends/cpu/kernels/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/utils.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 64 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/conv2d/utils.rs:323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt/src/backends/cpu/tensor_internal/gemm.rs:128 — hpt/src/backends/cpu/tensor_internal/gemm.rs:128-138 | hpt/src/backends/cpu/tensor_internal/matmul.rs:236-246 — before extracting anything, compare `hpt/src/backends/cpu/tensor_internal/gemm.rs` and `hpt/src/backends/cpu/tensor_internal/matmul.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/tensor_internal/gemm.rs:128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt/src/backends/cuda/tensor_internal/softmax.rs:109 — hpt/src/backends/cuda/tensor_internal/softmax.rs:109-119 | hpt/src/backends/cuda/tensor_internal/softmax.rs:359-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/softmax.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) hpt-display/src/formats.rs:11 — hpt-display/src/formats.rs:11-21 | hpt-display/src/formats.rs:27-37 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-display/src/formats.rs:11` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) hpt-tests/src/hpt/cpu/dwconv2d.rs:30 — hpt-tests/src/hpt/cpu/dwconv2d.rs:30-40 | hpt-tests/src/hpt/cuda/dwconv2d.rs:22-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/dwconv2d.rs:30` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) hpt-tests/src/hpt/cpu/maxpool.rs:54 — hpt-tests/src/hpt/cpu/maxpool.rs:54-64 | hpt-tests/src/hpt/cpu/maxpool.rs:73-83 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×14
  • Duplicated block (6 lines × 2) hpt-common/src/shape/shape_utils.rs:778 — hpt-common/src/shape/shape_utils.rs:778-786 | hpt-matmul/src/utils.rs:102-107 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-common/src/shape/shape_utils.rs:778` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) hpt-macros/src/normal_out.rs:78 — hpt-macros/src/normal_out.rs:78-83 | hpt-macros/src/normal_out.rs:210-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/normal_out.rs:78` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `max` to `#rhs_dtype` in one and `Scalar<#rhs_dtype>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) hpt-macros/src/normal_out.rs:85 — hpt-macros/src/normal_out.rs:85-90 | hpt-macros/src/normal_out.rs:217-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/normal_out.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `a` to `#rhs_dtype` in one and `Scalar<#rhs_dtype>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) hpt-macros/src/simd_float_out_binary.rs:62 — hpt-macros/src/simd_float_out_binary.rs:62-67 | hpt-macros/src/simd_float_out_binary.rs:296-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_float_out_binary.rs:62` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `rhs` to `#rhs_simd` in one and `#rhs_dtype` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:42 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:42-47 | matconv_simd/src/simd/_256bit/common/bf16x16.rs:25-30 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` and `matconv_simd/src/simd/_256bit/common/bf16x16.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:44 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:44-49 | matconv_simd/src/simd/_256bit/common/f16x16.rs:28-33 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs` and `matconv_simd/src/simd/_256bit/common/f16x16.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:44` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:63 — hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:63-68 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:61-67 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` and `matconv_simd/src/simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:63` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:107 — hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:107-112 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:73-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:107` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `ptr` to `*const bool` in one and `*const half::f16` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:111 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:111-116 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:175-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:558 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:558-563 | hpt/src/backends/common/conv.rs:10-15 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/common/conv.rs` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) hpt-tests/src/hpt/cpu/avg_pool.rs:27 — hpt-tests/src/hpt/cpu/avg_pool.rs:27-32 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:35-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/avg_pool.rs:27` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) hpt-tests/src/hpt/cpu/dwconv2d.rs:42 — hpt-tests/src/hpt/cpu/dwconv2d.rs:42-47 | hpt-tests/src/hpt/cuda/dwconv2d.rs:34-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/dwconv2d.rs:42` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) hpt-tests/src/hpt/cpu/binary_out.rs:80 — hpt-tests/src/hpt/cpu/binary_out.rs:80-85 | hpt-tests/src/hpt/cpu/binary_out.rs:87-92 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) hpt-tests/src/hpt/cpu/reduce.rs:24 — hpt-tests/src/hpt/cpu/reduce.rs:24-29 | hpt-tests/src/hpt/cuda/reduce.rs:20-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/reduce.rs:24` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `a` to `&hpt::Tensor<TestTypes>` in one and `&hpt::Tensor<i64, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×13
  • Duplicated block (13 lines × 2) hpt-conv/src/lib.rs:139 — hpt-conv/src/lib.rs:139-151 | hpt-matmul/src/lib.rs:146-158 — before extracting anything, compare `hpt-conv/src/lib.rs` and `hpt-matmul/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:43 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:43-55 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:81-93 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:172 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:172-184 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:169-181 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:817 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:817-829 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:864-876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-iterator/src/par_strided.rs:256 — hpt-iterator/src/par_strided.rs:256-268 | hpt-iterator/src/par_strided.rs:580-592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/par_strided.rs:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-macros/src/normal_out.rs:46 — hpt-macros/src/normal_out.rs:46-58 | hpt-macros/src/simd_normal_out.rs:46-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/normal_out.rs:59` calls `_rem`, `__rem` and `hpt-macros/src/simd_normal_out.rs:59` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) hpt-matmul/src/template.rs:70 — hpt-matmul/src/template.rs:70-82 | hpt/src/backends/cpu/kernels/matmul/template.rs:186-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/template.rs:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1525 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1525-1537 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1553-1565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1539` calls `vmulsign_vd_vd_vd` and `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1567` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1275 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1275-1287 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1299-1311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1288` calls `vmulsign_vf_vf_vf` and `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1312` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) hpt-dyn/src/ops/tensor/random.rs:540 — hpt-dyn/src/ops/tensor/random.rs:540-552 | hpt-dyn/src/ops/tensor/random.rs:839-851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/random.rs:540` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/random.rs:837` calls `from_f64` and `hpt-dyn/src/ops/tensor/random.rs:538` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1129 — hpt-codegen/src/fuse/cfg_builder.rs:1129-1141 | hpt-codegen/src/fuse/cfg_builder.rs:1181-1193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-tests/src/macro_tests/control_flows/mix.rs:28 — hpt-tests/src/macro_tests/control_flows/mix.rs:28-40 | hpt-tests/src/macro_tests/control_flows/mix.rs:46-58 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/macro_tests/control_flows/mix.rs:28` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) hpt-tests/src/hpt/cpu/binary.rs:65 — hpt-tests/src/hpt/cpu/binary.rs:65-77 | hpt-tests/src/hpt/cuda/binary.rs:67-79 — `hpt-tests/src/hpt/cpu/binary.rs` and `hpt-tests/src/hpt/cuda/binary.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 69 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `b` to `&Tensor<i64>` in one and `&Tensor<i64, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×13
  • Duplicated block (7 lines × 4) hpt-codegen/src/fuse/var_coalescer.rs:36 — hpt-codegen/src/fuse/var_coalescer.rs:36-44 | hpt-codegen/src/fuse/var_coalescer.rs:50-56 | hpt-codegen/src/fuse/var_coalescer.rs:62-70 | hpt-codegen/src/fuse/var_coalescer.rs:88-94 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/var_coalescer.rs:36` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:181 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:181-187 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:178-184 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:186-192 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:185-191 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:180` calls `to_dtype` and `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:185` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:256 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:256-262 | hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:316-322 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:181-187 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:241-247 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:887 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:887-893 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1131-1137 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1623-1631 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1708-1716 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:887` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) hpt/src/backends/cpu/utils/binary/binary_normal.rs:76 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:76-82 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:140-146 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:203-209 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:339-345 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt/src/backends/cpu/utils/binary/binary_normal.rs:83` calls `is_contiguous` and `hpt/src/backends/cpu/utils/binary/binary_normal.rs:210` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:224 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:224-230 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:184-190 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:219-225 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:202-208 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:246 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:246-252 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:206-212 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:241-247 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:224-230 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:359 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:359-365 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:319-325 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:354-360 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:337-343 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:412 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:412-418 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:372-378 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:407-413 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:390-396 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:420 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:420-426 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:380-386 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:415-421 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:398-404 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:428 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:428-434 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:388-394 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:423-429 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:406-412 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:444 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:444-450 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:404-410 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:439-445 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:422-428 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:463 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:463-469 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:423-429 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:458-464 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:441-447 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×12
  • Edited copy of a member (12 corresponding lines) hpt-common/src/shape/shape_utils.rs:256 — hpt-common/src/shape/shape_utils.rs:256-267 | hpt-common/src/shape/shape_utils.rs:277-295 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-dyn/src/utils/index_cal.rs:219 — hpt-dyn/src/utils/index_cal.rs:219-230 | hpt-dyn/src/utils/index_cal.rs:232-244 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-dyn/src/utils/index_cal.rs:319 — hpt-dyn/src/utils/index_cal.rs:319-330 | hpt-dyn/src/utils/index_cal.rs:336-351 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-common/src/shape/shape_utils.rs:789 — hpt-common/src/shape/shape_utils.rs:789-800 | hpt-matmul/src/utils.rs:96-107 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:585 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:585-599 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:622-633 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:139 — hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:139-150 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:170-181 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-allocator/src/allocators/cpu.rs:149 — hpt-allocator/src/allocators/cpu.rs:149-160 | hpt-allocator/src/allocators/cpu.rs:166-179 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-dyn/src/ops/tensor/conv2d/utils.rs:245 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:245-256 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:249-260 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-common/src/shape/shape_utils.rs:69 — hpt-common/src/shape/shape_utils.rs:69-83 | hpt-common/src/shape/shape_utils.rs:154-165 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-iterator/src/iterator_traits.rs:336 — hpt-iterator/src/iterator_traits.rs:336-347 | hpt-iterator/src/strided_mut.rs:200-215 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:239 — hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:239-250 | hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:254-269 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:389 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:389-400 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:418-433 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×11
  • Duplicated block (20 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:67 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:67-86 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:67-86 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:67` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:132 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:132-151 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:126-145 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:132` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:57 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:57-76 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:95-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:105 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:105-124 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:108-127 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/conv2d/utils.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:900 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:900-919 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:966-985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:900` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (20 lines × 2) hpt-macros/src/float_unary.rs:143 — hpt-macros/src/float_unary.rs:143-162 | hpt-macros/src/float_unary.rs:431-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:143` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `alpha` to `Self::Output` in one and `Self` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (20 lines × 2) hpt-macros/src/float_unary.rs:193 — hpt-macros/src/float_unary.rs:193-212 | hpt-macros/src/float_unary.rs:485-504 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1188 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1188-1207 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1216-1235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul.rs:46 — hpt/src/backends/cpu/kernels/matmul/matmul.rs:46-65 | hpt/src/backends/cpu/kernels/matmul/matmul_post.rs:52-71 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_post.rs` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt/src/backends/cpu/kernels/matmul/matmul_post.rs:49` calls `Fn` and `hpt/src/backends/cpu/kernels/matmul/matmul.rs:44` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (20 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:50 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:50-69 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:54-73 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:50` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) hpt/src/backends/cuda/utils/reduce/reduce.rs:253 — hpt/src/backends/cuda/utils/reduce/reduce.rs:253-272 | hpt/src/backends/cuda/utils/reduce/reduce.rs:304-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/reduce/reduce.rs:253` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×11
  • Duplicated block (8 lines × 3) hpt-codegen/src/fuse/build_graph.rs:200 — hpt-codegen/src/fuse/build_graph.rs:200-207 | hpt-codegen/src/fuse/build_graph.rs:218-225 | hpt-codegen/src/fuse/build_graph.rs:235-242 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/build_graph.rs:200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-codegen/src/fuse/build_graph.rs:215` calls `Binary` and `hpt-codegen/src/fuse/build_graph.rs:232` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:1030 — hpt-codegen/src/fuse/cfg_builder.rs:1030-1038 | hpt-codegen/src/fuse/cfg_builder.rs:1053-1060 | hpt-codegen/src/fuse/cfg_builder.rs:1090-1098 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1030` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 3) hpt-codegen/src/fuse/var_coalescer.rs:36 — hpt-codegen/src/fuse/var_coalescer.rs:36-45 | hpt-codegen/src/fuse/var_coalescer.rs:62-71 | hpt-codegen/src/fuse/var_coalescer.rs:88-95 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/var_coalescer.rs:36` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) hpt-dyn/src/ops/tensor/binary.rs:61 — hpt-dyn/src/ops/tensor/binary.rs:61-68 | hpt-dyn/src/ops/tensor/binary.rs:106-113 | hpt-dyn/src/ops/tensor/binary.rs:152-159 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) hpt-dyn/src/ops/tensor/binary.rs:116 — hpt-dyn/src/ops/tensor/binary.rs:116-124 | hpt-dyn/src/ops/tensor/unary.rs:48-55 | hpt/src/backends/cpu/utils/unary/unary.rs:41-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/binary.rs:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:100 — hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:100-107 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:112-119 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:94-101 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs` and `hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) hpt-dyn/src/utils/onnx/init.rs:190 — hpt-dyn/src/utils/onnx/init.rs:190-197 | hpt-dyn/src/utils/onnx/init.rs:200-207 | hpt-dyn/src/utils/onnx/init.rs:225-232 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:248 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:248-255 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:257-264 | hpt/src/backends/cuda/tensor_internal/softmax.rs:67-74 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:248` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:322 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:322-329 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:462-469 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:603-610 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) hpt-tests/src/hpt/cpu/dwconv2d.rs:142 — hpt-tests/src/hpt/cpu/dwconv2d.rs:142-149 | hpt-tests/src/hpt/cpu/dwconv2d.rs:175-182 | hpt-tests/src/hpt/cpu/dwconv2d.rs:205-212 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/dwconv2d.rs:142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) hpt-tests/src/hpt/cuda/creation.rs:17 — hpt-tests/src/hpt/cuda/creation.rs:17-24 | hpt-tests/src/hpt/cuda/reduce.rs:61-68 | hpt-tests/src/hpt/cuda/reduce.rs:96-103 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/creation.rs:17` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `a` to `&tch::Tensor` in one and `&Tensor` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×10
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1136 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1136-1166 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1627-1657 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1168 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1168-1198 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1664-1694 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1200 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1200-1230 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1701-1731 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1232 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1232-1262 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1738-1768 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1264 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1264-1294 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1775-1805 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1296 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1296-1326 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1812-1842 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1328 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1328-1358 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1849-1879 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1360 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1360-1390 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1886-1916 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1391 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1391-1421 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1922-1952 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1423 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1423-1453 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1959-1989 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×10
  • Duplicated block (15 lines × 2) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:41 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:41-55 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:38-52 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) hpt-dyn/src/ops/tensor/pooling/template.rs:233 — hpt-dyn/src/ops/tensor/pooling/template.rs:233-247 | hpt/src/backends/cpu/kernels/pooling/common.rs:235-249 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:278 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:278-292 | hpt/src/backends/cpu/kernels/reduce.rs:281-295 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) hpt-macros/src/binary_float_out.rs:45 — hpt-macros/src/binary_float_out.rs:45-59 | hpt-macros/src/simd_float_out_binary.rs:51-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/binary_float_out.rs:45` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `base` to `#rhs_dtype` in one and `#rhs_simd` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (15 lines × 2) hpt-macros/src/lib.rs:573 — hpt-macros/src/lib.rs:573-587 | hpt-macros/src/lib.rs:659-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) hpt-matmul/src/utils.rs:582 — hpt-matmul/src/utils.rs:582-596 | hpt/src/backends/cpu/kernels/matmul/template.rs:408-422 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/template.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:96 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:96-110 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:100-114 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:58 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:58-72 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:54-68 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `matconv_simd/src/simd/_256bit/avx2/f16x16.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:58` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:175 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:175-189 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:187-201 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) hpt/src/backends/cpu/utils/reduce/reduce_template.rs:210 — hpt/src/backends/cpu/utils/reduce/reduce_template.rs:210-224 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:444-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/reduce/reduce_template.rs:210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×10
  • Duplicated block (14 lines × 2) hpt-conv/src/lib.rs:70 — hpt-conv/src/lib.rs:70-83 | hpt-matmul/src/lib.rs:77-90 — before extracting anything, compare `hpt-conv/src/lib.rs` and `hpt-matmul/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) hpt-macros/src/lib.rs:385 — hpt-macros/src/lib.rs:385-398 | hpt-macros/src/lib.rs:479-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:385` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:46 — hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:46-59 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:45-58 — before extracting anything, compare `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs` and `hpt/src/backends/cpu/kernels/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 197 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:93 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:93-106 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:157-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:93` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) hpt-iterator/src/shape_manipulate.rs:57 — hpt-iterator/src/shape_manipulate.rs:57-70 | hpt-iterator/src/shape_manipulate.rs:169-182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/shape_manipulate.rs:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:222 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:222-235 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:361-374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:222` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:78 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:78-91 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:142-155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:78` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:441 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:441-454 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:574-587 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:441` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) hpt-tests/src/hpt/cpu/conv2d.rs:124 — hpt-tests/src/hpt/cpu/conv2d.rs:124-137 | hpt-tests/src/hpt/cpu/conv2d.rs:157-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/conv2d.rs:124` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) hpt-tests/src/hpt/cpu/dwconv2d.rs:72 — hpt-tests/src/hpt/cpu/dwconv2d.rs:72-85 | hpt-tests/src/hpt/cpu/dwconv2d.rs:107-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/dwconv2d.rs:72` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×10
  • Duplicated block (6 lines × 3) hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:44 — hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:44-49 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:197-202 | hpt/src/backends/cuda/utils/reduce/reduce_template.rs:55-60 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_template.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:53 — hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:53-58 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:206-211 | hpt/src/backends/cuda/utils/reduce/reduce_template.rs:63-68 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_template.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:53` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:59` calls `size`, `min`, `current_num_threads` and `hpt/src/backends/cuda/utils/reduce/reduce_template.rs:69` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) hpt/src/backends/cuda/utils/reduce/reduce.rs:446 — hpt/src/backends/cuda/utils/reduce/reduce.rs:446-451 | hpt/src/backends/cuda/utils/reduce/reduce.rs:471-476 | hpt/src/backends/cuda/utils/reduce/reduce.rs:613-618 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt/src/backends/cuda/utils/reduce/reduce.rs:619` calls `cuda_divmod`, `unwrap`, `cuda_strides_i32` and `hpt/src/backends/cuda/utils/reduce/reduce.rs:452` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) hpt-dyn/src/utils/onnx/operators.rs:992 — hpt-dyn/src/utils/onnx/operators.rs:992-997 | hpt-dyn/src/utils/onnx/operators.rs:999-1004 | hpt-dyn/src/utils/onnx/operators.rs:1133-1138 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 3) hpt-matmul/src/microkernels.rs:227 — hpt-matmul/src/microkernels.rs:227-232 | hpt-matmul/src/microkernels.rs:234-239 | hpt-matmul/src/microkernels.rs:244-249 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/microkernels.rs:227` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-matmul/src/microkernels.rs:241` calls `transmute`, `add`, `vld1q_f32` and `hpt-matmul/src/microkernels.rs:226` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:94 — hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:94-99 | hpt-types/src/vectors/arch_simd/_256bit/common/u16x16.rs:85-90 | hpt-types/src/vectors/arch_simd/_512bit/common/u16x32.rs:85-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:105 — hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:105-110 | hpt-types/src/vectors/arch_simd/_256bit/common/u16x16.rs:96-101 | hpt-types/src/vectors/arch_simd/_512bit/common/u16x32.rs:96-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) hpt-tests/src/hpt/cpu/binary.rs:32 — hpt-tests/src/hpt/cpu/binary.rs:32-37 | hpt-tests/src/hpt/cpu/binary_out.rs:54-59 | hpt-tests/src/hpt/cuda/binary.rs:33-38 — `hpt-tests/src/hpt/cpu/binary.rs` and `hpt-tests/src/hpt/cuda/binary.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 69 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `b` to `&Tensor<i64>` in one and `&Tensor<i64, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 3) hpt-tests/src/hpt/cpu/binary.rs:43 — hpt-tests/src/hpt/cpu/binary.rs:43-48 | hpt-tests/src/hpt/cpu/binary_out.rs:64-69 | hpt-tests/src/hpt/cuda/binary.rs:45-50 — `hpt-tests/src/hpt/cpu/binary.rs` and `hpt-tests/src/hpt/cuda/binary.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 69 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `b` to `&Tensor<bool>` in one and `&Tensor<bool, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 3) hpt-tests/src/hpt/cpu/fft.rs:47 — hpt-tests/src/hpt/cpu/fft.rs:47-52 | hpt-tests/src/hpt/cuda/reduce.rs:66-71 | hpt-tests/src/hpt/cuda/reduce.rs:101-106 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/fft.rs:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `b` to `&hpt::Tensor<Complex64>` in one and `&hpt::Tensor<f64, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D3 · God Classes · ClassTooLong · ×9
  • ClassTooLong: CFGBuilder hpt-codegen/src/fuse/cfg_builder.rs:12 — ClassTooLong — 1441 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 3 blocks, lines 12-1908. The bar is 400 significant lines; this is 1041 over it, 3.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Operator hpt-dyn/src/utils/onnx/operators.rs:363 — ClassTooLong — 1164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 3 blocks, lines 363-1757. The bar is 400 significant lines; this is 764 over it, 2.91× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: f16x32 hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:14 — ClassTooLong — 612 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods, 13 blocks, lines 20-812. The bar is 400 significant lines; this is 212 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: f16x16 hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:14 — ClassTooLong — 596 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods, 13 blocks, lines 20-796. The bar is 400 significant lines; this is 196 over it, 1.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Graph hpt-codegen/src/fuse/build_graph.rs:82 — ClassTooLong — 584 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 4 blocks, lines 82-994. The bar is 400 significant lines; this is 184 over it, 1.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: bf16x16 hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:14 — ClassTooLong — 552 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 12 blocks, lines 20-734. The bar is 400 significant lines; this is 152 over it, 1.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: bf16x32 hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:12 — ClassTooLong — 538 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 12 blocks, lines 18-717. The bar is 400 significant lines; this is 138 over it, 1.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: f16x8 hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:13 — ClassTooLong — 525 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 10 blocks, lines 18-696. The bar is 400 significant lines; this is 125 over it, 1.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: bf16x8 hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:12 — ClassTooLong — 516 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 13 blocks, lines 17-696. The bar is 400 significant lines; this is 116 over it, 1.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×9
  • Edited copy of a member (10 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:24 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:24-33 | matconv_simd/src/simd/_256bit/common/f16x16.rs:12-21 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:24 — hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:24-33 | matconv_simd/src/simd/_512bit/common/f16x32.rs:13-22 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-codegen/src/fuse/kernel_type.rs:9 — hpt-codegen/src/fuse/kernel_type.rs:9-19 | hpt-codegen/src/fuse/kernel_type.rs:20-29 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-dyn/src/tensor.rs:304 — hpt-dyn/src/tensor.rs:304-313 | hpt/src/tensor.rs:200-209 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-allocator/src/allocators/cpu.rs:203 — hpt-allocator/src/allocators/cpu.rs:203-212 | hpt-allocator/src/allocators/cuda.rs:277-288 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/arch/helper_avx2.rs:1060 — hpt-types/src/vectors/arch_simd/sleef/arch/helper_avx2.rs:1060-1069 | hpt-types/src/vectors/arch_simd/sleef/arch/helper_avx2.rs:1072-1081 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-allocator/src/allocators/cpu.rs:81 — hpt-allocator/src/allocators/cpu.rs:81-90 | hpt-allocator/src/allocators/cuda.rs:96-105 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-tests/src/hpt/cpu/reduce.rs:46 — hpt-tests/src/hpt/cpu/reduce.rs:46-55 | hpt-tests/src/hpt/cuda/reduce.rs:40-50 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) hpt-tests/src/hpt/cpu/unary.rs:28 — hpt-tests/src/hpt/cpu/unary.rs:28-37 | hpt-tests/src/hpt/cuda/unary.rs:32-42 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×9
  • Duplicated block (8 lines × 4) hpt-codegen/src/fuse/cfg_builder.rs:173 — hpt-codegen/src/fuse/cfg_builder.rs:173-180 | hpt-codegen/src/fuse/cfg_builder.rs:317-324 | hpt-codegen/src/fuse/cfg_builder.rs:371-378 | hpt-codegen/src/fuse/cfg_builder.rs:447-454 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) hpt-dyn/src/ops/tensor/matmul/matmul.rs:421 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:421-429 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:443-450 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:455-463 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:494-502 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:421` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:339 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:339-346 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:751-758 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:338-345 | hpt/src/backends/cpu/kernels/softmax.rs:337-344 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:339` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:107 — hpt-dyn/src/ops/tensor/pooling/template.rs:107-115 | hpt-dyn/src/ops/tensor/pooling/template.rs:292-299 | hpt/src/backends/cpu/kernels/pooling/common.rs:107-115 | hpt/src/backends/cpu/kernels/pooling/common.rs:290-297 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:127 — hpt-dyn/src/ops/tensor/pooling/template.rs:127-134 | hpt-dyn/src/ops/tensor/pooling/template.rs:171-178 | hpt/src/backends/cpu/kernels/pooling/common.rs:127-134 | hpt/src/backends/cpu/kernels/pooling/common.rs:171-178 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:127` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) hpt-iterator/src/iterator_traits.rs:371 — hpt-iterator/src/iterator_traits.rs:371-378 | hpt-iterator/src/iterator_traits.rs:396-403 | hpt-iterator/src/with_simd.rs:50-57 | hpt-iterator/src/with_simd.rs:76-83 — before extracting anything, compare `hpt-iterator/src/iterator_traits.rs` and `hpt-iterator/src/with_simd.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/iterator_traits.rs:371` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-iterator/src/iterator_traits.rs:380` calls `op`, `inner_loop_next` and `hpt-iterator/src/iterator_traits.rs:404` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:403 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:403-410 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:363-370 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:398-405 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:381-388 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:311 — hpt-dyn/src/ops/tensor/pooling/template.rs:311-318 | hpt-dyn/src/ops/tensor/pooling/template.rs:343-350 | hpt/src/backends/cpu/kernels/pooling/common.rs:309-316 | hpt/src/backends/cpu/kernels/pooling/common.rs:341-348 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:311` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) hpt-tests/src/hpt/cuda/dwconv2d.rs:80 — hpt-tests/src/hpt/cuda/dwconv2d.rs:80-87 | hpt-tests/src/hpt/cuda/dwconv2d.rs:113-120 | hpt-tests/src/hpt/cuda/dwconv2d.rs:151-158 | hpt-tests/src/hpt/cuda/dwconv2d.rs:186-193 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/dwconv2d.rs:80` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×9
  • Duplicated block (5 lines × 4) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:56 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:56-60 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:95-99 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:58-62 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:94-98 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:123 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:123-127 | hpt-dyn/src/ops/tensor/pooling/template.rs:103-107 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:123-127 | hpt/src/backends/cpu/kernels/pooling/common.rs:103-107 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt-dyn/src/ops/tensor/pooling/template.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:129` calls `from_ptr` and `hpt-dyn/src/ops/tensor/pooling/template.rs:108` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:118 — hpt-dyn/src/ops/tensor/pooling/template.rs:118-123 | hpt-dyn/src/ops/tensor/pooling/template.rs:164-168 | hpt/src/backends/cpu/kernels/pooling/common.rs:118-123 | hpt/src/backends/cpu/kernels/pooling/common.rs:164-168 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:169 — hpt-dyn/src/ops/tensor/pooling/template.rs:169-173 | hpt-dyn/src/ops/tensor/pooling/template.rs:341-345 | hpt/src/backends/cpu/kernels/pooling/common.rs:169-173 | hpt/src/backends/cpu/kernels/pooling/common.rs:339-343 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:303 — hpt-dyn/src/ops/tensor/pooling/template.rs:303-307 | hpt-dyn/src/ops/tensor/pooling/template.rs:336-340 | hpt/src/backends/cpu/kernels/pooling/common.rs:301-305 | hpt/src/backends/cpu/kernels/pooling/common.rs:334-338 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:303` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) hpt-dyn/src/ops/tensor/reduce/kernels.rs:587 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:587-591 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:767-773 | hpt/src/backends/cpu/kernels/reduce.rs:591-595 | hpt/src/backends/cpu/kernels/reduce.rs:775-781 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:587` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:118 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:118-122 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:141-145 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:116-120 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:139-143 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) hpt/src/backends/cuda/utils/binary/binary_normal.rs:100 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:100-104 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:155-160 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:199-203 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:252-257 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 4) hpt-tests/src/hpt/cuda/bn_conv2d.rs:50 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:50-54 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:98-102 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:146-150 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:196-200 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×9
  • Duplicated block (5 lines × 3) hpt-common/src/utils/pointer.rs:66 — hpt-common/src/utils/pointer.rs:66-70 | hpt-conv/src/lib.rs:63-67 | hpt-matmul/src/lib.rs:70-74 — before extracting anything, compare `hpt-conv/src/lib.rs` and `hpt-matmul/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-common/src/utils/pointer.rs:66` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) hpt-macros/src/lib.rs:1411 — hpt-macros/src/lib.rs:1411-1415 | hpt-macros/src/lib.rs:1450-1454 | hpt-macros/src/lib.rs:1473-1477 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1411` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/lib.rs:1416` calls `to_string`, `contains` and `hpt-macros/src/lib.rs:1455` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) hpt-macros/src/simd_normal_out.rs:251 — hpt-macros/src/simd_normal_out.rs:251-255 | hpt-macros/src/simd_normal_out.rs:400-404 | hpt-macros/src/simd_normal_out.rs:446-450 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_normal_out.rs:251` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:47 — hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:47-51 | hpt-types/src/vectors/arch_simd/_512bit/common/f32x16.rs:55-59 | hpt-types/src/vectors/arch_simd/_512bit/common/f64x8.rs:27-31 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/f32x16.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:47` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:87 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:87-91 | hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:118-123 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:128-133 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:136 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:136-140 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:211-215 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:242-246 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:145 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:145-149 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:220-224 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:251-255 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:1262 — hpt-codegen/src/fuse/cfg_builder.rs:1262-1266 | hpt-codegen/src/fuse/cfg_builder.rs:1553-1557 | hpt-codegen/src/fuse/cfg_builder.rs:1723-1727 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) hpt-types/src/vectors/arch_simd/_128bit/common/i16x8.rs:37 — hpt-types/src/vectors/arch_simd/_128bit/common/i16x8.rs:37-41 | hpt-types/src/vectors/arch_simd/_256bit/common/i16x16.rs:33-37 | hpt-types/src/vectors/arch_simd/_512bit/common/i16x32.rs:33-37 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D1 · Cyclomatic Complexity · hpt_dyn · ×8
  • hpt_dyn::ops::tensor::copy::_copy_from (cyclomatic 39) hpt-dyn/src/ops/tensor/copy.rs:35 — hpt_dyn::ops::tensor::copy::_copy_from has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hpt_dyn::ops::tensor::pooling::template::pooling_template (cyclomatic 33) hpt-dyn/src/ops/tensor/pooling/template.rs:15 — hpt_dyn::ops::tensor::pooling::template::pooling_template has cyclomatic complexity 33 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::dwconv2d::dwconv2d (cyclomatic 30) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:16 — hpt_dyn::ops::tensor::conv2d::dwconv2d::dwconv2d has cyclomatic complexity 30 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::utils::onnx::init::lstm_init (cyclomatic 23) hpt-dyn/src/utils/onnx/init.rs:962 — hpt_dyn::utils::onnx::init::lstm_init has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: hpt_dyn::utils::onnx::init::unary_init (cyclomatic 39) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • hpt_dyn::ops::tensor::pooling::template::adaptive_pooling_template (cyclomatic 21) hpt-dyn/src/ops/tensor/pooling/template.rs:216 — hpt_dyn::ops::tensor::pooling::template::adaptive_pooling_template has cyclomatic complexity 21 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::utils::onnx::fwd::conv_fused_fwd (cyclomatic 20) hpt-dyn/src/utils/onnx/fwd.rs:396 — hpt_dyn::utils::onnx::fwd::conv_fused_fwd has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d (cyclomatic 17) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:120 — hpt_dyn::ops::tensor::conv2d::conv2d_mp::conv2d has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dyn::ops::tensor::conv2d::utils::pack_kernel (cyclomatic 16) hpt-dyn/src/ops/tensor/conv2d/utils.rs:63 — hpt_dyn::ops::tensor::conv2d::utils::pack_kernel has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×8
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-codegen/src/fuse/cfg_builder.rs:80 — hpt-codegen/src/fuse/cfg_builder.rs:80-164 | hpt-codegen/src/fuse/cfg_builder.rs:229-310 | hpt-codegen/src/fuse/cfg_builder.rs:875-923 | hpt-codegen/src/fuse/cfg_builder.rs:925-973 | hpt-codegen/src/fuse/cfg_builder.rs:975-1023 | hpt-codegen/src/fuse/cfg_builder.rs:1591-1668 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/matmul/common.rs:23 — hpt-dyn/src/ops/tensor/matmul/common.rs:23-63 | hpt-dyn/src/ops/tensor/matmul/common.rs:69-97 | hpt/src/backends/cpu/kernels/matmul/common.rs:221-260 | hpt/src/backends/cpu/tensor_internal/gemm.rs:41-219 | hpt/src/backends/cpu/tensor_internal/matmul.rs:45-399 | hpt/src/backends/cuda/tensor_internal/matmul.rs:134-299 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/reduce/reduce.rs:446 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:446-481 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:494-529 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:539-574 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:587-622 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:724-759 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:769-804 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:453 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:453-460 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:413-420 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:448-455 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:493-500 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:431-438 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:509-516 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:593 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:593-600 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:553-560 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:600-607 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:653-660 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:583-590 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:669-676 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:73 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:73-91 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:35-53 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:36-54 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:77-95 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:31-49 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:33-51 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:95 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:95-117 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:57-80 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:58-78 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:99-121 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:53-76 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:55-78 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:41 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:41-60 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:39-74 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:43-62 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:53-64 | matconv_simd/src/simd/_256bit/common/bf16x16.rs:24-43 | matconv_simd/src/simd/_256bit/common/f16x16.rs:27-46 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Edited copies of one member (4 members, 6+ corresponding lines) · ×8
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:625 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:625-630 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:678-683 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:608-613 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:694-699 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:633 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:633-638 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:686-691 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:616-621 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:702-707 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:641 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:641-646 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:694-699 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:624-629 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:710-715 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:649 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:649-654 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:702-707 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:632-637 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:718-723 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:657 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:657-662 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:710-715 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:640-645 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:726-731 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:670 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:670-675 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:724-729 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:653-658 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:740-745 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:678 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:678-683 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:732-737 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:661-666 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:748-753 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:686 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:686-691 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:740-745 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:669-674 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:756-761 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×8
  • Duplicated block (23 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1030 — hpt-codegen/src/fuse/cfg_builder.rs:1030-1052 | hpt-codegen/src/fuse/cfg_builder.rs:1090-1112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1030` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) hpt-dataloader/src/load.rs:172 — hpt-dataloader/src/load.rs:172-194 | hpt-dataloader/src/struct_save/load.rs:86-108 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (23 lines × 2) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:136 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:136-158 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:140-162 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 258 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:136` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) hpt-dyn/src/ops/tensor/normalization/softmax.rs:133 — hpt-dyn/src/ops/tensor/normalization/softmax.rs:133-155 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:139-161 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/softmax.rs` and `hpt/src/backends/cpu/kernels/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 258 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/softmax.rs:133` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:761 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:761-783 | hpt/src/backends/cpu/kernels/reduce.rs:769-791 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (23 lines × 2) hpt-macros/src/kernel_gen_helper.rs:9 — hpt-macros/src/kernel_gen_helper.rs:9-31 | hpt-macros/src/kernel_gen_helper.rs:48-70 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/kernel_gen_helper.rs:9` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (23 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:192 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:192-214 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:332-354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) hpt/src/backends/cuda/tensor_internal/softmax.rs:382 — hpt/src/backends/cuda/tensor_internal/softmax.rs:382-404 | hpt/src/backends/cuda/tensor_internal/softmax.rs:418-440 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/softmax.rs:382` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×8
  • Duplicated block (18 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:206 — hpt-codegen/src/fuse/cfg_builder.rs:206-223 | hpt-codegen/src/fuse/cfg_builder.rs:412-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-codegen/src/fuse/cfg_builder.rs:431` calls `push` and `hpt-codegen/src/fuse/cfg_builder.rs:225` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) hpt-dataloader/src/save.rs:275 — hpt-dataloader/src/save.rs:275-292 | hpt-dataloader/src/struct_save/save.rs:299-316 — before extracting anything, compare `hpt-dataloader/src/save.rs` and `hpt-dataloader/src/struct_save/save.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:202 — hpt-dyn/src/ops/tensor/binary.rs:202-219 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:264-281 — before extracting anything, compare `hpt-dyn/src/ops/tensor/binary.rs` and `hpt/src/backends/cpu/utils/binary/binary_normal.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/binary.rs:202` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:217 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:217-234 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:219-236 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/conv2d/utils.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:306 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:306-323 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:314-331 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:306` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:162 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:162-179 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:166-183 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) hpt-tests/src/hpt/cpu/conv2d_group.rs:80 — hpt-tests/src/hpt/cpu/conv2d_group.rs:80-97 | hpt-tests/src/hpt/cpu/conv2d_group.rs:116-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/conv2d_group.rs:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) hpt-tests/src/hpt/cuda/bn_conv2d.rs:160 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:160-177 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:210-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×8
  • Duplicated block (17 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:675 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:675-691 | hpt/src/backends/cpu/kernels/reduce.rs:681-697 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:717 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:717-733 | hpt/src/backends/cpu/kernels/reduce.rs:724-740 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) hpt-matmul/src/utils.rs:363 — hpt-matmul/src/utils.rs:363-379 | hpt/src/backends/cpu/kernels/matmul/common.rs:127-143 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/common.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/utils.rs:363` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:298 — hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:298-314 | hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:316-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:298` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) hpt-matmul/src/matmul.rs:27 — hpt-matmul/src/matmul.rs:27-43 | hpt-matmul/src/matmul.rs:97-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) hpt-macros/src/lib.rs:1250 — hpt-macros/src/lib.rs:1250-1266 | hpt-macros/src/lib.rs:1453-1469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) hpt/src/backends/cpu/tensor_internal/gemm.rs:140 — hpt/src/backends/cpu/tensor_internal/gemm.rs:140-156 | hpt/src/backends/cpu/tensor_internal/matmul.rs:248-264 — before extracting anything, compare `hpt/src/backends/cpu/tensor_internal/gemm.rs` and `hpt/src/backends/cpu/tensor_internal/matmul.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/tensor_internal/gemm.rs:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt/src/backends/cpu/tensor_internal/gemm.rs:159` calls `strides` and `hpt/src/backends/cpu/tensor_internal/matmul.rs:267` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) hpt-tests/src/hpt/cuda/bn_conv2d.rs:63 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:63-79 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:111-127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×8
  • Duplicated block (10 lines × 4) hpt-codegen/src/fuse/cfg_builder.rs:155 — hpt-codegen/src/fuse/cfg_builder.rs:155-164 | hpt-codegen/src/fuse/cfg_builder.rs:914-923 | hpt-codegen/src/fuse/cfg_builder.rs:964-973 | hpt-codegen/src/fuse/cfg_builder.rs:1014-1023 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) hpt-dyn/src/ops/tensor/creation.rs:185 — hpt-dyn/src/ops/tensor/creation.rs:185-194 | hpt-dyn/src/ops/tensor/creation.rs:212-221 | hpt-dyn/src/ops/tensor/creation.rs:240-249 | hpt-dyn/src/ops/tensor/creation.rs:263-272 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/creation.rs:185` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) hpt-dyn/src/ops/tensor/reduce/kernels.rs:208 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:208-217 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:467-476 | hpt/src/backends/cpu/kernels/reduce.rs:210-219 | hpt/src/backends/cpu/kernels/reduce.rs:470-479 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:208` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 4) hpt-dyn/src/ops/tensor/reduce/kernels.rs:546 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:546-555 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:592-601 | hpt/src/backends/cpu/kernels/reduce.rs:549-558 | hpt/src/backends/cpu/kernels/reduce.rs:596-605 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:546` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) hpt-macros/src/lib.rs:1183 — hpt-macros/src/lib.rs:1183-1192 | hpt-macros/src/lib.rs:1221-1230 | hpt-macros/src/lib.rs:1384-1393 | hpt-macros/src/lib.rs:1423-1432 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1183` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:67 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:67-76 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:109-118 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:50-59 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:125-134 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` and `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:67` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `false_val` to `bf16x16` in one and `f16x16` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 4) hpt/src/backends/cuda/cuda_utils.rs:145 — hpt/src/backends/cuda/cuda_utils.rs:145-154 | hpt/src/backends/cuda/cuda_utils.rs:157-166 | hpt/src/backends/cuda/cuda_utils.rs:169-178 | hpt/src/backends/cuda/cuda_utils.rs:181-190 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/cuda_utils.rs:145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) hpt-dyn/src/ops/tensor/random.rs:931 — hpt-dyn/src/ops/tensor/random.rs:931-940 | hpt-dyn/src/ops/tensor/random.rs:947-956 | hpt-dyn/src/ops/tensor/random.rs:963-972 | hpt-dyn/src/ops/tensor/random.rs:979-988 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/random.rs:931` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×8
  • Duplicated block (7 lines × 3) hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:31 — hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:31-37 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:42-48 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:31-37 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs` and `hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) hpt-dyn/src/utils/index_cal.rs:321 — hpt-dyn/src/utils/index_cal.rs:321-327 | hpt-dyn/src/utils/index_cal.rs:338-344 | hpt-dyn/src/utils/index_cal.rs:359-365 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) hpt-macros/src/lib.rs:102 — hpt-macros/src/lib.rs:102-108 | hpt-macros/src/lib.rs:124-130 | hpt-macros/src/lib.rs:134-140 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) hpt-macros/src/simd_float_out_binary.rs:42 — hpt-macros/src/simd_float_out_binary.rs:42-48 | hpt-macros/src/simd_float_out_binary.rs:157-163 | hpt-macros/src/simd_float_out_binary.rs:276-282 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_float_out_binary.rs:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) hpt-types/src/dyn_dispatch/scalar.rs:192 — hpt-types/src/dyn_dispatch/scalar.rs:192-198 | hpt-types/src/dyn_dispatch/scalar.rs:241-247 | hpt-types/src/dyn_dispatch/scalar.rs:392-398 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:67 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:67-73 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:63-69 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:65-71 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `matconv_simd/src/simd/_256bit/avx2/f16x16.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:67` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 3) hpt-tests/src/hpt/cpu/binary_out.rs:17 — hpt-tests/src/hpt/cpu/binary_out.rs:17-23 | hpt-tests/src/hpt/cpu/binary_out.rs:36-42 | hpt-tests/src/hpt/cuda/matmul.rs:29-35 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/binary_out.rs:17` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `b` to `&Tensor<f64>` in one and `&Tensor<f32, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 3) hpt-tests/src/hpt/cuda/bn_conv2d.rs:170 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:170-176 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:220-226 | hpt-tests/src/hpt/cuda/dwconv2d.rs:175-181 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/bn_conv2d.rs:170` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D1 · Cyclomatic Complexity · hpt · ×7
  • hpt::backends::cpu::kernels::pooling::common::pooling_template (cyclomatic 33) hpt/src/backends/cpu/kernels/pooling/common.rs:18 — hpt::backends::cpu::kernels::pooling::common::pooling_template has cyclomatic complexity 33 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d (cyclomatic 30) hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:16 — hpt::backends::cpu::kernels::conv2d::dwconv2d::dwconv2d has cyclomatic complexity 30 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cuda::tensor_internal::conv2d::conv2d (cyclomatic 25) hpt/src/backends/cuda/tensor_internal/conv2d.rs:30 — hpt::backends::cuda::tensor_internal::conv2d::conv2d has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • hpt::backends::cpu::tensor_internal::matmul::matmul_with_out (cyclomatic 22) hpt/src/backends/cpu/tensor_internal/matmul.rs:31 — hpt::backends::cpu::tensor_internal::matmul::matmul_with_out has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd (cyclomatic 22) hpt/src/backends/cpu/utils/binary/binary_normal.rs:51 — hpt::backends::cpu::utils::binary::binary_normal::binary_fn_with_out_simd has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt::backends::cpu::kernels::pooling::common::adaptive_pooling_template (cyclomatic 21) hpt/src/backends/cpu/kernels/pooling/common.rs:216 — hpt::backends::cpu::kernels::pooling::common::adaptive_pooling_template has cyclomatic complexity 21 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt::backends::cpu::tensor_internal::fft::fftn_template (cyclomatic 19) hpt/src/backends/cpu/tensor_internal/fft.rs:33 — hpt::backends::cpu::tensor_internal::fft::fftn_template has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · hpt_matmul · ×7
  • hpt_matmul::utils::pack_a (cognitive 54) hpt-matmul/src/utils.rs:482 — hpt_matmul::utils::pack_a has cognitive complexity 54 (threshold 15). Drivers by points: loops 13 (47 pts), if/else 5 (7 pts) (nesting depth added 36). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_matmul::template::func_name (cognitive 50) hpt-matmul/src/template.rs:32 — hpt_matmul::template::func_name has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (35 pts), loops 5 (15 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_matmul::utils::pack_b (cognitive 45) hpt-matmul/src/utils.rs:570 — hpt_matmul::utils::pack_b has cognitive complexity 45 (threshold 15). Drivers by points: loops 11 (35 pts), if/else 6 (9 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_matmul::utils::pack_b_mixed_precision (cognitive 41) hpt-matmul/src/utils.rs:381 — hpt_matmul::utils::pack_b_mixed_precision has cognitive complexity 41 (threshold 15). Drivers by points: loops 11 (37 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_matmul::template::func_name (cognitive 37) hpt-matmul/src/template.rs:334 — hpt_matmul::template::func_name has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 5 (15 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_matmul::matmul::addmm (cognitive 31) hpt-matmul/src/matmul.rs:438 — hpt_matmul::matmul::addmm has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 15 (16 pts), if/else 15 (nesting depth added 1). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hpt_matmul::matmul::matmul (cognitive 29) hpt-matmul/src/matmul.rs:285 — hpt_matmul::matmul::matmul has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15, match/switch 13 (14 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×7
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/matmul/matmul.rs:381 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:381-540 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:542-597 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:616-677 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:692-745 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:757-804 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/unary.rs:248 — hpt-dyn/src/ops/tensor/unary.rs:248-292 | hpt-dyn/src/ops/tensor/unary.rs:319-358 | hpt-dyn/src/ops/tensor/unary.rs:387-424 | hpt-dyn/src/ops/tensor/unary.rs:444-491 | hpt-dyn/src/ops/tensor/unary.rs:506-561 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-matmul/src/utils.rs:353 — hpt-matmul/src/utils.rs:353-379 | hpt-matmul/src/utils.rs:453-479 | hpt-matmul/src/utils.rs:494-568 | hpt/src/backends/cpu/kernels/matmul/common.rs:117-143 | hpt/src/backends/cpu/kernels/matmul/template.rs:365-391 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs:24 — hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs:24-30 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:24-30 | matconv_simd/src/simd/_256bit/common/cplx32x4.rs:11-17 | matconv_simd/src/simd/_512bit/common/cplx32x8.rs:13-23 | matconv_simd/src/simd/_512bit/common/cplx64x4.rs:13-19 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:561 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:561-608 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:611-658 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1061-1092 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1518-1557 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1560-1596 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:886 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:886-961 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1130-1189 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1622-1704 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1707-1791 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1794-1867 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) hpt-tests/src/hpt/cpu/fft.rs:36 — hpt-tests/src/hpt/cpu/fft.rs:36-63 | hpt-tests/src/hpt/cpu/slice.rs:9-28 | hpt-tests/src/hpt/cuda/creation.rs:11-37 | hpt-tests/src/hpt/cuda/reduce.rs:54-85 | hpt-tests/src/hpt/cuda/reduce.rs:89-117 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×7
  • Duplicated block (19 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1057 — hpt-codegen/src/fuse/cfg_builder.rs:1057-1075 | hpt-codegen/src/fuse/cfg_builder.rs:1159-1177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1057` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:702 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:702-720 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:761-779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:702` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (19 lines × 2) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:361 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:361-379 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:371-389 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:361` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:310 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:310-328 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:410-428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:310` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) hpt-tests/src/hpt/cpu/bn_conv2d.rs:68 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:68-86 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:110-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) hpt-tests/src/hpt/cpu/bn_conv2d.rs:153 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:153-171 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:197-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) hpt-tests/src/hpt/cuda/conv2d.rs:108 — hpt-tests/src/hpt/cuda/conv2d.rs:108-126 | hpt-tests/src/hpt/cuda/conv2d.rs:144-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×7
  • Duplicated block (16 lines × 2) hpt-codegen/src/fuse/cfg_builder.rs:1110 — hpt-codegen/src/fuse/cfg_builder.rs:1110-1125 | hpt-codegen/src/fuse/cfg_builder.rs:1204-1219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:883 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:883-898 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:949-964 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:883` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) hpt-dyn/src/utils/prefetch.rs:6 — hpt-dyn/src/utils/prefetch.rs:6-21 | hpt-dyn/src/utils/prefetch.rs:25-40 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) hpt-iterator/src/iterator_traits.rs:364 — hpt-iterator/src/iterator_traits.rs:364-379 | hpt-iterator/src/with_simd.rs:43-58 — before extracting anything, compare `hpt-iterator/src/iterator_traits.rs` and `hpt-iterator/src/with_simd.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/iterator_traits.rs:364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) hpt-macros/src/float_unary.rs:217 — hpt-macros/src/float_unary.rs:217-232 | hpt-macros/src/float_unary.rs:505-520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:11 — hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:11-26 | hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:32-47 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:11` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) hpt-tests/src/hpt/cpu/binary_out.rs:16 — hpt-tests/src/hpt/cpu/binary_out.rs:16-31 | hpt-tests/src/hpt/cpu/binary_out.rs:35-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D2 · Cognitive Complexity · hpt_codegen · ×6
  • hpt_codegen::fuse::start::fuse_impl (cognitive 85) hpt-codegen/src/fuse/start.rs:40 — hpt_codegen::fuse::start::fuse_impl has cognitive complexity 85 (threshold 15). Drivers by points: if/else 16 (53 pts), loops 9 (27 pts), boolean chains 5 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_codegen::fuse::cfg::rename (cognitive 43) hpt-codegen/src/fuse/cfg.rs:900 — hpt_codegen::fuse::cfg::rename has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (28 pts), loops 9 (13 pts), match/switch 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_codegen::fuse::gen_fuse::_cmp_gen_fuse (cognitive 31) hpt-codegen/src/fuse/gen_fuse.rs:63 — hpt_codegen::fuse::gen_fuse::_cmp_gen_fuse has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 5 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_codegen::fuse::codegen::stmt (cognitive 27) hpt-codegen/src/fuse/codegen.rs:4 — hpt_codegen::fuse::codegen::stmt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (26 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hpt_codegen::fuse::gen_fuse::cmp_gen_body (cognitive 20) hpt-codegen/src/fuse/gen_fuse.rs:19 — hpt_codegen::fuse::gen_fuse::cmp_gen_body has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_codegen::fuse::cfg::replace_vars_item (cognitive 16) hpt-codegen/src/fuse/cfg.rs:1072 — hpt_codegen::fuse::cfg::replace_vars_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×6
  • Edited copy of a member (18 corresponding lines) hpt-dyn/src/ops/tensor/unary.rs:91 — hpt-dyn/src/ops/tensor/unary.rs:91-114 | hpt/src/backends/cpu/utils/unary/unary.rs:77-94 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) hpt-codegen/src/fuse/use_define_visitor.rs:125 — hpt-codegen/src/fuse/use_define_visitor.rs:125-142 | hpt-codegen/src/fuse/use_define_visitor.rs:270-289 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) hpt-allocator/src/allocators/cpu.rs:105 — hpt-allocator/src/allocators/cpu.rs:105-122 | hpt-allocator/src/allocators/cuda.rs:115-132 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) hpt-common/src/prg_update.rs:11 — hpt-common/src/prg_update.rs:11-28 | hpt-common/src/prg_update.rs:38-55 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:474 — hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:474-491 | hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:595-617 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) hpt-allocator/src/backend.rs:104 — hpt-allocator/src/backend.rs:104-123 | hpt-dyn/src/utils/backend.rs:34-51 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×6
  • Edited copy of a member (16 corresponding lines) hpt-types/src/vectors/utils.rs:59 — hpt-types/src/vectors/utils.rs:59-79 | hpt-types/src/vectors/utils.rs:90-105 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) hpt-dyn/src/utils/onnx/init.rs:477 — hpt-dyn/src/utils/onnx/init.rs:477-503 | hpt-dyn/src/utils/onnx/init.rs:505-520 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:566 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:566-581 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:603-618 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2039 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2039-2054 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2057-2072 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) hpt-dyn/src/utils/index_cal.rs:293 — hpt-dyn/src/utils/index_cal.rs:293-308 | hpt-dyn/src/utils/index_cal.rs:378-396 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) hpt-tests/src/hpt/cpu/binary.rs:64 — hpt-tests/src/hpt/cpu/binary.rs:64-80 | hpt-tests/src/hpt/cuda/binary.rs:66-82 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×6
  • Edited copy of a member (9 corresponding lines) hpt-matmul/src/utils.rs:83 — hpt-matmul/src/utils.rs:83-94 | hpt/src/backends/cpu/kernels/matmul/common.rs:91-99 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/f32x4.rs:36 — hpt-types/src/vectors/arch_simd/_128bit/common/f32x4.rs:36-44 | hpt-types/src/vectors/arch_simd/_256bit/common/f64x4.rs:26-34 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:139 — hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:139-147 | hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:189-200 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:299 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:299-307 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:333-344 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/estrin.rs:1030 — hpt-types/src/vectors/arch_simd/sleef/common/estrin.rs:1030-1038 | hpt-types/src/vectors/arch_simd/sleef/common/estrin.rs:1516-1524 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:441 — hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:441-449 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:457-465 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×6
  • Duplicated block (12 lines × 4) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:150 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:150-161 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:222-233 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:156-167 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:228-239 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:150` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) hpt-dyn/src/ops/tensor/reduce/kernels.rs:12 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:12-23 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:71-82 | hpt/src/backends/cpu/kernels/reduce.rs:13-24 | hpt/src/backends/cpu/kernels/reduce.rs:73-84 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:12` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) hpt-dyn/src/ops/tensor/reduce/reduce.rs:464 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:464-475 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:512-523 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:742-753 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:787-798 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:464` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 4) hpt-macros/src/binary_float_out.rs:22 — hpt-macros/src/binary_float_out.rs:22-33 | hpt-macros/src/binary_float_out.rs:109-120 | hpt-macros/src/normal_out.rs:22-33 | hpt-macros/src/normal_out.rs:154-165 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/binary_float_out.rs:22` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) hpt-macros/src/lib.rs:1197 — hpt-macros/src/lib.rs:1197-1208 | hpt-macros/src/lib.rs:1235-1246 | hpt-macros/src/lib.rs:1398-1409 | hpt-macros/src/lib.rs:1437-1448 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) hpt-matmul/src/utils.rs:356 — hpt-matmul/src/utils.rs:356-367 | hpt-matmul/src/utils.rs:456-467 | hpt/src/backends/cpu/kernels/matmul/common.rs:120-131 | hpt/src/backends/cpu/kernels/matmul/template.rs:368-379 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/common.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/utils.rs:356` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×6
  • Duplicated block (9 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:205 — hpt-codegen/src/fuse/cfg_builder.rs:205-213 | hpt-codegen/src/fuse/cfg_builder.rs:345-353 | hpt-codegen/src/fuse/cfg_builder.rs:411-419 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-codegen/src/fuse/cfg_builder.rs:216` calls `connect_to`, `set_current_block` and `hpt-codegen/src/fuse/cfg_builder.rs:354` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:91 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:91-99 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:54-62 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:90-98 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:324 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:324-332 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:97-105 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:215-223 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:324` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) hpt-common/src/utils/pointer.rs:365 — hpt-common/src/utils/pointer.rs:365-373 | hpt-conv/src/lib.rs:99-107 | hpt-matmul/src/lib.rs:106-114 — before extracting anything, compare `hpt-conv/src/lib.rs` and `hpt-matmul/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) hpt-common/src/utils/pointer.rs:415 — hpt-common/src/utils/pointer.rs:415-423 | hpt-conv/src/lib.rs:111-119 | hpt-matmul/src/lib.rs:118-126 — before extracting anything, compare `hpt-conv/src/lib.rs` and `hpt-matmul/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) hpt-tests/src/hpt/cpu/binary.rs:93 — hpt-tests/src/hpt/cpu/binary.rs:93-101 | hpt-tests/src/hpt/cpu/binary_out.rs:108-116 | hpt-tests/src/hpt/cuda/binary.rs:98-106 — `hpt-tests/src/hpt/cpu/binary.rs` and `hpt-tests/src/hpt/cuda/binary.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 69 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D1 · Cyclomatic Complexity · hpt_macros · ×5
  • hpt_macros::scalar_convert::__impl_scalar_convert (cyclomatic 42) hpt-macros/src/scalar_convert.rs:7 — hpt_macros::scalar_convert::__impl_scalar_convert has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt_macros::matmul_microkernels_asm::matmul_gen_asm (cyclomatic 23) hpt-macros/src/matmul_microkernels_asm.rs:198 — hpt_macros::matmul_microkernels_asm::matmul_gen_asm has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt_macros::impl_from_safetensors (cyclomatic 21) hpt-macros/src/lib.rs:969 — hpt_macros::impl_from_safetensors has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt_macros::impl_dispatch_simd (cyclomatic 18) hpt-macros/src/lib.rs:1329 — hpt_macros::impl_dispatch_simd has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt_macros::impl_dispatch (cyclomatic 17) hpt-macros/src/lib.rs:1152 — hpt_macros::impl_dispatch has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hpt_codegen · ×5
  • hpt_codegen::fuse::codegen::stmt (cyclomatic 31) hpt-codegen/src/fuse/codegen.rs:4 — hpt_codegen::fuse::codegen::stmt has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt_codegen::fuse::start::fuse_impl (cyclomatic 28) hpt-codegen/src/fuse/start.rs:40 — hpt_codegen::fuse::start::fuse_impl has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hpt_codegen::fuse::cfg::new_name_pat (cyclomatic 23) hpt-codegen/src/fuse/cfg.rs:787 — hpt_codegen::fuse::cfg::new_name_pat has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: CFG::_gen_code (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • hpt_codegen::fuse::ty_infer::handle_pat (cyclomatic 23) hpt-codegen/src/fuse/ty_infer.rs:233 — hpt_codegen::fuse::ty_infer::handle_pat has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hpt_codegen::fuse::cfg::rename (cyclomatic 20) hpt-codegen/src/fuse/cfg.rs:900 — hpt_codegen::fuse::cfg::rename has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: CFG::_gen_code (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D2 · Cognitive Complexity · CFG · ×5
  • CFG::insert_phi_functions (cognitive 93) hpt-codegen/src/fuse/cfg.rs:450 — CFG::insert_phi_functions has cognitive complexity 93 (threshold 15). Drivers by points: if/else 10 (64 pts), loops 6 (21 pts), match/switch 1 (8 pts) (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • CFG::live_analysis (cognitive 32) hpt-codegen/src/fuse/cfg.rs:300 — CFG::live_analysis has cognitive complexity 32 (threshold 15). Drivers by points: loops 11 (22 pts), if/else 3 (9 pts), boolean chains 1 (nesting depth added 17). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • CFG::build_graphs (cognitive 20) hpt-codegen/src/fuse/cfg.rs:532 — CFG::build_graphs has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 2 (7 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • CFG::compute_dominance_frontiers (cognitive 19) hpt-codegen/src/fuse/cfg.rs:253 — CFG::compute_dominance_frontiers has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 2 (7 pts), if/else 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CFG::get_variable_definitions (cognitive 18) hpt-codegen/src/fuse/cfg.rs:421 — CFG::get_variable_definitions has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 1 (4 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · hpt_macros · ×5
  • hpt_macros::scalar_convert::__impl_scalar_convert (cognitive 92) hpt-macros/src/scalar_convert.rs:7 — hpt_macros::scalar_convert::__impl_scalar_convert has cognitive complexity 92 (threshold 15). Drivers by points: if/else 26 (71 pts), match/switch 3 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_macros::impl_dispatch_simd (cognitive 45) hpt-macros/src/lib.rs:1329 — hpt_macros::impl_dispatch_simd has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 5 (14 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_macros::impl_dispatch (cognitive 40) hpt-macros/src/lib.rs:1152 — hpt_macros::impl_dispatch has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 5 (14 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_macros::matmul_microkernels_asm::matmul_gen_asm (cognitive 40) hpt-macros/src/matmul_microkernels_asm.rs:198 — hpt_macros::matmul_microkernels_asm::matmul_gen_asm has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 14 (19 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_macros::impl_from_safetensors (cognitive 39) hpt-macros/src/lib.rs:969 — hpt_macros::impl_from_safetensors has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 3 (5 pts), match/switch 2 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _Tensor · ×5
  • _Tensor::topk (cognitive 59) hpt/src/backends/cpu/tensor_internal/advance.rs:125 — _Tensor::topk has cognitive complexity 59 (threshold 15). Drivers by points: if/else 21 (40 pts), loops 9 (19 pts) (nesting depth added 29). Of this number, 53 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _Tensor::layernorm (cognitive 29) hpt/src/backends/cpu/tensor_internal/normalization.rs:49 — _Tensor::layernorm has cognitive complexity 29 (threshold 15). Drivers by points: loops 12 (24 pts), if/else 3 (4 pts), match/switch 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • _Tensor::concat (cognitive 26) hpt/src/backends/cpu/tensor_internal/shape_manipulate.rs:199 — _Tensor::concat has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 7 (12 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _Tensor::pad (cognitive 22) hpt/src/backends/cpu/tensor_internal/advance.rs:37 — _Tensor::pad has cognitive complexity 22 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 5 (8 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • _Tensor::concat (cognitive 19) hpt/src/backends/cuda/tensor_internal/shape_manipulate.rs:166 — _Tensor::concat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×5
  • Edited copy of a member (13 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:20 — hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:20-36 | hpt-types/src/vectors/arch_simd/_512bit/common/f32x16.rs:20-44 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:46 — hpt-types/src/vectors/arch_simd/_256bit/common/f32x8.rs:46-58 | hpt-types/src/vectors/arch_simd/_512bit/common/f64x8.rs:26-38 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) hpt-dyn/src/ops/tensor/rnn/lstm.rs:53 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:53-65 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:68-85 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) hpt-dyn/src/ops/tensor/copy.rs:7 — hpt-dyn/src/ops/tensor/copy.rs:7-19 | hpt-dyn/src/ops/tensor/copy.rs:20-32 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) hpt-dyn/src/utils/onnx/init.rs:92 — hpt-dyn/src/utils/onnx/init.rs:92-104 | hpt-dyn/src/utils/onnx/parse_args/parse.rs:17-29 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×5
  • Edited copy of a member (11 corresponding lines) hpt-dataloader/src/data_loader.rs:63 — hpt-dataloader/src/data_loader.rs:63-76 | hpt-dataloader/src/data_loader.rs:92-106 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) hpt-iterator/src/iterator_traits.rs:117 — hpt-iterator/src/iterator_traits.rs:117-127 | hpt-iterator/src/iterator_traits.rs:133-144 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) hpt-dyn/src/ops/tensor/creation.rs:73 — hpt-dyn/src/ops/tensor/creation.rs:73-87 | hpt-dyn/src/ops/tensor/creation.rs:89-99 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) hpt-common/src/utils/pointer.rs:162 — hpt-common/src/utils/pointer.rs:162-172 | hpt-common/src/utils/pointer.rs:182-192 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) hpt/src/backends/common/shape_manipulate.rs:158 — hpt/src/backends/common/shape_manipulate.rs:158-168 | hpt/src/backends/common/shape_manipulate.rs:183-194 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×5
  • Edited copy of a member (20 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1318 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1318-1337 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2239-2267 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) hpt-allocator/src/allocators/cuda.rs:50 — hpt-allocator/src/allocators/cuda.rs:50-69 | hpt-allocator/src/allocators/cuda.rs:75-94 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:260 — hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:260-279 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:220-242 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) hpt-iterator/src/par_strided.rs:85 — hpt-iterator/src/par_strided.rs:85-105 | hpt-iterator/src/par_strided.rs:393-412 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) hpt-tests/src/hpt/cpu/avg_pool.rs:24 — hpt-tests/src/hpt/cpu/avg_pool.rs:24-43 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:32-52 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×5
  • Duplicated block (33 lines × 2) hpt-dyn/src/ops/tensor/creation.rs:285 — hpt-dyn/src/ops/tensor/creation.rs:285-317 | hpt/src/backends/common/creation.rs:18-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (33 lines × 2) hpt/src/backends/cuda/tensor_internal/layernorm.rs:85 — hpt/src/backends/cuda/tensor_internal/layernorm.rs:85-117 | hpt/src/backends/cuda/tensor_internal/layernorm.rs:122-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/layernorm.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:310 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:310-342 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:235-267 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:310` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:565 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:565-597 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:645-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:565` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33 lines × 2) hpt/src/backends/cuda/utils/binary/binary_normal.rs:211 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:211-243 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:314-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×5
  • Duplicated block (26 lines × 2) hpt-macros/src/float_unary.rs:291 — hpt-macros/src/float_unary.rs:291-316 | hpt-macros/src/float_unary.rs:571-596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:291` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-macros/src/float_unary.rs:288` calls `cast` and `hpt-macros/src/float_unary.rs:569` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (26 lines × 2) hpt-matmul/src/utils.rs:49 — hpt-matmul/src/utils.rs:49-74 | hpt/src/backends/cpu/kernels/matmul/common.rs:57-82 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/common.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (26 lines × 2) hpt/src/backends/cuda/utils/reduce/reduce.rs:139 — hpt/src/backends/cuda/utils/reduce/reduce.rs:139-164 | hpt/src/backends/cuda/utils/reduce/reduce.rs:192-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (26 lines × 2) hpt/src/backends/cuda/utils/reduce/reduce.rs:767 — hpt/src/backends/cuda/utils/reduce/reduce.rs:767-792 | hpt/src/backends/cuda/utils/reduce/reduce_utils.rs:47-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (26 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:189 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:189-214 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:96-121 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 251 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:189` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×5
  • Duplicated block (24 lines × 2) hpt-dyn/src/ops/tensor/normalization/kernels.rs:341 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:341-364 | hpt/src/backends/cpu/kernels/softmax.rs:339-362 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/softmax.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 365 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:341` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:413 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:413-436 | hpt/src/backends/cpu/utils/reduce/reduce.rs:738-761 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:413` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:279 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:279-302 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:541-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:279` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) hpt-iterator/src/iterator_traits.rs:222 — hpt-iterator/src/iterator_traits.rs:222-245 | hpt-iterator/src/iterator_traits.rs:282-305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) hpt-iterator/src/iterator_traits.rs:392 — hpt-iterator/src/iterator_traits.rs:392-415 | hpt-iterator/src/with_simd.rs:72-95 — before extracting anything, compare `hpt-iterator/src/iterator_traits.rs` and `hpt-iterator/src/with_simd.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/iterator_traits.rs:392` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×5
  • Duplicated block (9–10 lines × 2) hpt-macros/src/lib.rs:102 — hpt-macros/src/lib.rs:102-110 | hpt-macros/src/lib.rs:124-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) hpt-macros/src/simd_normal_out.rs:246 — hpt-macros/src/simd_normal_out.rs:246-255 | hpt-macros/src/simd_normal_out.rs:396-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_normal_out.rs:246` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) hpt-matmul/src/matmul.rs:485 — hpt-matmul/src/matmul.rs:485-494 | hpt-matmul/src/matmul.rs:603-611 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/matmul.rs:485` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:519 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:519-528 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:669-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:69 — hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:69-77 | hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:84-93 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:69` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · Operator · ×4
  • Operator::outputs (cyclomatic 131) hpt-dyn/src/utils/onnx/operators.rs:1142 — Operator::outputs has cyclomatic complexity 131 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (Operator::outputs_mut) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This file is where this pass's cyclomatic complexity CONCENTRATES: hpt-dyn/src/utils/onnx/operators.rs holds 4 of the 54 functions over the threshold — including the worst — and 452 of the 876 points over it (52%), 10.3× the next-largest file (hpt-codegen/src/fuse/ty_infer.rs at 44). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Operator::outputs_mut (cyclomatic 131) hpt-dyn/src/utils/onnx/operators.rs:1304 — Operator::outputs_mut has cyclomatic complexity 131 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (Operator::outputs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This file is where this pass's cyclomatic complexity CONCENTRATES: hpt-dyn/src/utils/onnx/operators.rs holds 4 of the 54 functions over the threshold — including the worst — and 452 of the 876 points over it (52%), 10.3× the next-largest file (hpt-codegen/src/fuse/ty_infer.rs at 44). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Operator::inputs (cyclomatic 125) hpt-dyn/src/utils/onnx/operators.rs:754 — Operator::inputs has cyclomatic complexity 125 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (Operator::inputs_mut) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Operator::id (cyclomatic 126) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score. This file is where this pass's cyclomatic complexity CONCENTRATES: hpt-dyn/src/utils/onnx/operators.rs holds 4 of the 54 functions over the threshold — including the worst — and 452 of the 876 points over it (52%), 10.3× the next-largest file (hpt-codegen/src/fuse/ty_infer.rs at 44). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Operator::inputs_mut (cyclomatic 125) hpt-dyn/src/utils/onnx/operators.rs:956 — Operator::inputs_mut has cyclomatic complexity 125 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (Operator::inputs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Operator::id (cyclomatic 126) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score. This file is where this pass's cyclomatic complexity CONCENTRATES: hpt-dyn/src/utils/onnx/operators.rs holds 4 of the 54 functions over the threshold — including the worst — and 452 of the 876 points over it (52%), 10.3× the next-largest file (hpt-codegen/src/fuse/ty_infer.rs at 44). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D1 · Cyclomatic Complexity · hpt_matmul · ×4
  • hpt_matmul::matmul::addmm (cyclomatic 31) hpt-matmul/src/matmul.rs:438 — hpt_matmul::matmul::addmm has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hpt_matmul::matmul::matmul (cyclomatic 29) hpt-matmul/src/matmul.rs:285 — hpt_matmul::matmul::matmul has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hpt_matmul::utils::pack_a (cyclomatic 17) hpt-matmul/src/utils.rs:482 — hpt_matmul::utils::pack_a has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_matmul::utils::pack_b (cyclomatic 16) hpt-matmul/src/utils.rs:570 — hpt_matmul::utils::pack_b has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D3 · God Classes · TooManyFunctions · ×4
  • TooManyFunctions: hpt_types::vectors::arch_simd::sleef::arch::helper_avx512 hpt-types/src/vectors/arch_simd/sleef/arch/helper_avx512.rs:6 — TooManyFunctions — 132 free functions. The bar is 30 free functions; this is 102 over it, 4.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: hpt_types::vectors::arch_simd::sleef::arch::helper_sse hpt-types/src/vectors/arch_simd/sleef/arch/helper_sse.rs:6 — TooManyFunctions — 127 free functions. The bar is 30 free functions; this is 97 over it, 4.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: hpt_types::vectors::arch_simd::sleef::arch::helper_aarch64 hpt-types/src/vectors/arch_simd/sleef/arch/helper_aarch64.rs:4 — TooManyFunctions — 116 free functions. The bar is 30 free functions; this is 86 over it, 3.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: hpt_types::vectors::arch_simd::sleef::common::dd hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:27 — TooManyFunctions — 42 free functions. The bar is 30 free functions; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×4
  • Edited copy of a member (24 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:113 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:113-139 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:33-56 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) hpt-dyn/src/ops/tensor/conv2d/utils.rs:524 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:524-547 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:375-398 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) hpt-tests/src/hpt/cpu/binary.rs:86 — hpt-tests/src/hpt/cpu/binary.rs:86-110 | hpt-tests/src/hpt/cuda/binary.rs:91-115 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) hpt-tests/src/hpt/cpu/dwconv2d.rs:141 — hpt-tests/src/hpt/cpu/dwconv2d.rs:141-165 | hpt-tests/src/hpt/cpu/dwconv2d.rs:204-227 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×4
  • Edited copy of a member (14 corresponding lines) hpt-dyn/src/utils/onnx/fwd.rs:483 — hpt-dyn/src/utils/onnx/fwd.rs:483-497 | hpt-dyn/src/utils/onnx/fwd.rs:503-516 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/arch/helper_aarch64.rs:226 — hpt-types/src/vectors/arch_simd/sleef/arch/helper_aarch64.rs:226-242 | hpt-types/src/vectors/arch_simd/sleef/arch/helper_aarch64.rs:266-279 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) hpt/src/backends/cuda/tensor_internal/arg_reduce.rs:34 — hpt/src/backends/cuda/tensor_internal/arg_reduce.rs:34-47 | hpt/src/backends/cuda/tensor_internal/arg_reduce.rs:49-62 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) hpt-tests/src/hpt/cpu/fft.rs:18 — hpt-tests/src/hpt/cpu/fft.rs:18-32 | hpt-tests/src/hpt/cuda/reduce.rs:140-153 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 7+ corresponding lines) hpt-dyn/src/utils/onnx/fwd.rs:43 — hpt-dyn/src/utils/onnx/fwd.rs:43-49 | hpt-dyn/src/utils/onnx/fwd.rs:193-199 | hpt-dyn/src/utils/onnx/fwd.rs:637-643 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:175 — hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:175-181 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:565-571 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:581-587 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) matconv_simd/src/simd/_128bit/common/boolx16.rs:27 — matconv_simd/src/simd/_128bit/common/boolx16.rs:27-33 | matconv_simd/src/simd/_128bit/common/cplx32x2.rs:29-35 | matconv_simd/src/simd/_128bit/common/cplx64x1.rs:29-35 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) hpt-tests/src/hpt/cpu/binary.rs:22 — hpt-tests/src/hpt/cpu/binary.rs:22-28 | hpt-tests/src/hpt/cpu/creation.rs:20-29 | hpt-tests/src/hpt/cpu/unary.rs:16-22 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×4
  • Edited copies of one member (4 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:546 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:546-552 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:599-605 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:529-535 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:615-621 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:582 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:582-588 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:635-641 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:565-571 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:651-657 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:591 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:591-597 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:644-650 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:574-580 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:660-666 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:74 — hpt-types/src/vectors/arch_simd/_128bit/common/cplx32x2.rs:74-80 | hpt-types/src/vectors/arch_simd/_128bit/common/cplx64x1.rs:68-74 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:81-87 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:71-77 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×4
  • Duplicated block (22 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:579 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:579-600 | hpt/src/backends/cpu/kernels/reduce.rs:583-604 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:182 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:182-203 | hpt/src/backends/cpu/utils/reduce/reduce.rs:509-530 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:182` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:193 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:193-214 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:210-231 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:193` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:208` calls `clone` and `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:192` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:746 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:746-767 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:844-865 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:746` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×4
  • Duplicated block (21 lines × 2) hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:54 — hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:54-74 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:40-60 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs` and `hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:124 — hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:124-144 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:104-124 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs` and `hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:10 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:10-30 | hpt/src/backends/common/reduce.rs:2-22 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/common/reduce.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (21 lines × 2) hpt-tests/src/hpt/cpu/binary.rs:87 — hpt-tests/src/hpt/cpu/binary.rs:87-107 | hpt-tests/src/hpt/cuda/binary.rs:92-112 — `hpt-tests/src/hpt/cpu/binary.rs` and `hpt-tests/src/hpt/cuda/binary.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 69 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×4
  • Duplicated block (16–17 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:205 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:205-220 | hpt/src/backends/cpu/utils/reduce/reduce.rs:531-547 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:680 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:680-695 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:679-695 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16–17 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:718 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:718-733 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:779-795 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` and `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16–17 lines × 2) hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:701 — hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:701-716 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:795-811 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×4
  • Duplicated block (13 lines × 4) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:19 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:19-31 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:20-32 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:15-27 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:16-28 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:19` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:90 — hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:90-102 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:88-100 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:86-98 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:88-100 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs` and `hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:90` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) hpt-iterator/src/par_strided_map_mut.rs:127 — hpt-iterator/src/par_strided_map_mut.rs:127-139 | hpt-iterator/src/par_strided_map_mut.rs:320-332 | hpt-iterator/src/par_strided_mut.rs:88-100 | hpt-iterator/src/par_strided_mut.rs:305-317 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (13 lines × 4) hpt-tests/src/hpt/cpu/conv2d_group.rs:92 — hpt-tests/src/hpt/cpu/conv2d_group.rs:92-104 | hpt-tests/src/hpt/cpu/conv2d_group.rs:128-140 | hpt-tests/src/hpt/cpu/dwconv2d.rs:83-95 | hpt-tests/src/hpt/cpu/dwconv2d.rs:118-130 — before extracting anything, compare `hpt-tests/src/hpt/cpu/conv2d_group.rs` and `hpt-tests/src/hpt/cpu/dwconv2d.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/conv2d_group.rs:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×4
  • Duplicated block (12 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:198 — hpt-codegen/src/fuse/cfg_builder.rs:198-209 | hpt-codegen/src/fuse/cfg_builder.rs:404-415 | hpt-codegen/src/fuse/cfg_builder.rs:500-511 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:198` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) hpt/src/backends/cuda/utils/binary/binary_normal.rs:139 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:139-150 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:236-247 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:345-356 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) hpt-tests/src/hpt/cuda/conv2d_group.rs:138 — hpt-tests/src/hpt/cuda/conv2d_group.rs:138-149 | hpt-tests/src/hpt/cuda/conv2d_group.rs:176-187 | hpt-tests/src/hpt/cuda/conv2d_group.rs:214-225 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) hpt-tests/src/hpt/cpu/conv2d.rs:121 — hpt-tests/src/hpt/cpu/conv2d.rs:121-132 | hpt-tests/src/hpt/cpu/conv2d.rs:154-165 | hpt-tests/src/hpt/cpu/conv2d.rs:187-198 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/conv2d.rs:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×4
  • Duplicated block (10 lines × 3) hpt-dyn/src/utils/onnx/operators.rs:790 — hpt-dyn/src/utils/onnx/operators.rs:790-799 | hpt-dyn/src/utils/onnx/operators.rs:801-810 | hpt-dyn/src/utils/onnx/operators.rs:943-952 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1627 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1627-1636 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1712-1721 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1801-1810 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) hpt-matmul/src/template.rs:89 — hpt-matmul/src/template.rs:89-98 | hpt-matmul/src/template.rs:400-409 | hpt/src/backends/cpu/kernels/matmul/template.rs:205-214 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/template.rs:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt/src/backends/cpu/kernels/matmul/template.rs:203` calls `clone` and `hpt-matmul/src/template.rs:399` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) hpt-iterator/src/par_strided_mut.rs:178 — hpt-iterator/src/par_strided_mut.rs:178-187 | hpt-iterator/src/par_strided_mut.rs:385-394 | hpt-iterator/src/strided_mut.rs:279-288 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D1 · Cyclomatic Complexity · TyInfer · ×3
  • TyInfer::type_of (cyclomatic 36) hpt-codegen/src/fuse/ty_infer.rs:49 — TyInfer::type_of has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TyInfer::visit_local (cyclomatic 23) hpt-codegen/src/fuse/ty_infer.rs:331 — TyInfer::visit_local has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TyInfer::visit_signature (cyclomatic 22) hpt-codegen/src/fuse/ty_infer.rs:283 — TyInfer::visit_signature has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · hpt_dataloader · ×3
  • hpt_dataloader::save::save (cognitive 34) hpt-dataloader/src/save.rs:70 — hpt_dataloader::save::save has cognitive complexity 34 (threshold 15). Drivers by points: loops 8 (22 pts), if/else 5 (12 pts) (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dataloader::struct_save::save::save (cognitive 25) hpt-dataloader/src/struct_save/save.rs:106 — hpt_dataloader::struct_save::save::save has cognitive complexity 25 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 6 (11 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • hpt_dataloader::load::load_compressed_slice (cognitive 19) hpt-dataloader/src/load.rs:7 — hpt_dataloader::load::load_compressed_slice has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hpt_common · ×3
  • hpt_common::slice::slice_process (cognitive 28) hpt-common/src/slice.rs:41 — hpt_common::slice::slice_process has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (24 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_common::shape::shape_utils::mt_intervals_simd (cognitive 24) hpt-common/src/shape/shape_utils.rs:892 — hpt_common::shape::shape_utils::mt_intervals_simd has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_common::shape::shape_utils::is_reshape_possible (cognitive 21) hpt-common/src/shape/shape_utils.rs:551 — hpt_common::shape::shape_utils::is_reshape_possible has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 6 (9 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Tensor · ×3
  • Tensor::from_onnx_tensor (cognitive 25) hpt-dyn/src/tensor.rs:92 — Tensor::from_onnx_tensor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Tensor::concat (cognitive 21) hpt-dyn/src/ops/tensor/shape_manipulate.rs:470 — Tensor::concat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 5 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Tensor::reshape (cognitive 19) hpt-dyn/src/ops/tensor/shape_manipulate.rs:23 — Tensor::reshape has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×3
  • Edited copy of a member (33 corresponding lines) hpt-macros/src/into_cuda_scalar.rs:5 — hpt-macros/src/into_cuda_scalar.rs:5-47 | hpt-macros/src/into_scalar.rs:5-47 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:148 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:148-187 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:81-113 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1095 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1095-1127 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1410-1452 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (7 members, 50+ identical tokens) hpt-codegen/src/fuse/cfg_builder.rs:1271 — hpt-codegen/src/fuse/cfg_builder.rs:1271-1343 | hpt-codegen/src/fuse/cfg_builder.rs:1364-1395 | hpt-codegen/src/fuse/cfg_builder.rs:1397-1429 | hpt-codegen/src/fuse/cfg_builder.rs:1431-1464 | hpt-codegen/src/fuse/cfg_builder.rs:1465-1494 | hpt-codegen/src/fuse/cfg_builder.rs:1496-1536 | hpt-codegen/src/fuse/cfg_builder.rs:1674-1689 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) hpt-conv/src/microkernel_trait.rs:205 — hpt-conv/src/microkernel_trait.rs:205-230 | hpt-conv/src/microkernel_trait.rs:231-256 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:216-241 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:242-267 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:204-225 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:226-247 | hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:275-296 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) hpt-macros/src/lib.rs:1329 — hpt-macros/src/lib.rs:1329-1529 | hpt-macros/src/simd_float_out_binary.rs:6-94 | hpt-macros/src/simd_float_out_binary.rs:116-209 | hpt-macros/src/simd_float_out_binary.rs:235-328 | hpt-macros/src/simd_normal_out.rs:6-142 | hpt-macros/src/simd_normal_out.rs:211-360 | hpt-macros/src/simd_normal_out.rs:362-497 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×3
  • Edited copy of a member (48 corresponding lines) hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:28 — hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:28-75 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:97-145 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) hpt-iterator/src/shape_manipulate.rs:14 — hpt-iterator/src/shape_manipulate.rs:14-70 | hpt-iterator/src/shape_manipulate.rs:135-182 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) hpt-codegen/src/fuse/ty_infer.rs:233 — hpt-codegen/src/fuse/ty_infer.rs:233-280 | hpt-codegen/src/fuse/use_define_visitor.rs:47-96 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×3
  • Edited copy of a member (32 corresponding lines) hpt/src/backends/cuda/utils/reduce/reduce.rs:249 — hpt/src/backends/cuda/utils/reduce/reduce.rs:249-280 | hpt/src/backends/cuda/utils/reduce/reduce.rs:300-344 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:57 — hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:57-90 | hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:179-210 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) hpt/src/backends/cpu/utils/reduce/reduce.rs:251 — hpt/src/backends/cpu/utils/reduce/reduce.rs:251-282 | hpt/src/backends/cpu/utils/reduce/reduce.rs:315-346 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×3
  • Edited copy of a member (36 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:816 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:816-851 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:863-898 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:633 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:633-668 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:679-714 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) hpt-tests/src/macro_tests/control_flows/for_loop.rs:4 — hpt-tests/src/macro_tests/control_flows/for_loop.rs:4-39 | hpt-tests/src/macro_tests/control_flows/while_loop.rs:4-39 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 7+ corresponding lines) · ×3
  • Edited copies of one member (6 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:29 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:29-35 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:37-43 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:45-51 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:53-59 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:61-67 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:69-75 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:88 — hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:88-94 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:96-102 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:104-110 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:112-118 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:120-126 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:128-134 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:119 — hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:119-125 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:127-133 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:135-141 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:143-149 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:151-157 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:159-165 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×3
  • Duplicated block (36 lines × 2) hpt-matmul/src/matmul.rs:349 — hpt-matmul/src/matmul.rs:349-384 | hpt-matmul/src/matmul.rs:519-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/matmul.rs:349` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (36 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1626 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1626-1661 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1711-1746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (36 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/cplx64x2.rs:24 — hpt-types/src/vectors/arch_simd/_256bit/common/cplx64x2.rs:24-273 | matconv_simd/src/simd/_256bit/common/cplx64x2.rs:11-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/cplx64x2.rs:24` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `mut` in one and `crate) fn mul_add(mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:32 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:32-61 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:35-64 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/conv2d/utils.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (30 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:53 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:53-82 | hpt/src/backends/common/reduce.rs:45-74 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/common/reduce.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (30 lines × 2) hpt-tests/src/hpt/cpu/conv2d_transpose.rs:68 — hpt-tests/src/hpt/cpu/conv2d_transpose.rs:68-97 | hpt-tests/src/hpt/cpu/conv2d_transpose.rs:106-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:29 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:29-55 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:33-59 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (27 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:627 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:627-653 | hpt/src/backends/cpu/kernels/reduce.rs:632-658 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (27 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:465 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:465-491 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:606-632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:465` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×3
  • Duplicated block (13 lines × 3) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:66 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:66-78 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:149-161 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:66-78 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:79` calls `ptr` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:163` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 3) hpt/src/backends/cuda/tensor_internal/softmax.rs:161 — hpt/src/backends/cuda/tensor_internal/softmax.rs:161-173 | hpt/src/backends/cuda/tensor_internal/softmax.rs:226-238 | hpt/src/backends/cuda/tensor_internal/softmax.rs:303-315 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/softmax.rs:161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:1315 — hpt-codegen/src/fuse/cfg_builder.rs:1315-1328 | hpt-codegen/src/fuse/cfg_builder.rs:1402-1414 | hpt-codegen/src/fuse/cfg_builder.rs:1501-1513 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1315` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×3
  • Duplicated block (11 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:241 — hpt-dyn/src/ops/tensor/pooling/template.rs:241-251 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:67-77 | hpt/src/backends/cpu/kernels/pooling/common.rs:243-253 | hpt/src/backends/cuda/tensor_internal/conv2d.rs:105-116 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/conv2d.rs:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) hpt-dyn/src/ops/tensor/reduce/kernels.rs:192 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:192-202 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:450-460 | hpt/src/backends/cpu/kernels/reduce.rs:194-204 | hpt/src/backends/cpu/kernels/reduce.rs:453-463 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:192` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) hpt-matmul/src/matmul.rs:318 — hpt-matmul/src/matmul.rs:318-328 | hpt-matmul/src/matmul.rs:335-345 | hpt-matmul/src/matmul.rs:474-484 | hpt-matmul/src/matmul.rs:497-507 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) hpt-dyn/src/ops/tensor/random.rs:876 — hpt-dyn/src/ops/tensor/random.rs:876-886 | hpt-dyn/src/ops/tensor/random.rs:888-898 | hpt-dyn/src/ops/tensor/random.rs:900-910 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) hpt/src/backends/cuda/tensor_internal/layernorm.rs:91 — hpt/src/backends/cuda/tensor_internal/layernorm.rs:91-101 | hpt/src/backends/cuda/tensor_internal/layernorm.rs:128-138 | hpt/src/backends/cuda/tensor_internal/softmax.rs:131-141 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) hpt-dyn/src/ops/tensor/random.rs:253 — hpt-dyn/src/ops/tensor/random.rs:253-263 | hpt-dyn/src/ops/tensor/random.rs:307-317 | hpt-dyn/src/ops/tensor/random.rs:659-669 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/random.rs:253` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×3
  • Duplicated block (9 lines × 4) hpt-dyn/src/ops/tensor/reduce/kernels.rs:680 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:680-688 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:722-730 | hpt/src/backends/cpu/kernels/reduce.rs:686-694 | hpt/src/backends/cpu/kernels/reduce.rs:729-737 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:680` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) hpt-tests/src/hpt/cuda/conv2d.rs:115 — hpt-tests/src/hpt/cuda/conv2d.rs:115-123 | hpt-tests/src/hpt/cuda/conv2d.rs:151-159 | hpt-tests/src/hpt/cuda/dwconv2d.rs:135-143 | hpt-tests/src/hpt/cuda/dwconv2d.rs:173-181 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/conv2d.rs:115` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 4) hpt-tests/src/hpt/cuda/bn_conv2d.rs:81 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:81-89 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:129-137 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:179-187 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:229-237 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/bn_conv2d.rs:81` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:103 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:103-110 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:122-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:103` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) hpt/src/backends/cpu/utils/binary/binary_normal.rs:167 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:167-174 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:186-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/utils/binary/binary_normal.rs:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:60 — hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:60-67 | hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:72-80 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/macro_tests/expands/expr_method_call.expanded.rs:60` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×3
  • Duplicated block (7 lines × 6) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:54 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:54-60 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:68-74 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:56-62 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:58-64 | matconv_simd/src/simd/_256bit/common/bf16x16.rs:37-43 | matconv_simd/src/simd/_256bit/common/f16x16.rs:40-46 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` and `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:54` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `ptr` to `*const half::bf16` in one and `*const bool` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 6) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:92 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:92-98 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:114-120 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:167-173 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:189-195 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:198-204 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:220-226 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 6) hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:125 — hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:125-131 | hpt-types/src/vectors/arch_simd/_128bit/common/boolx16.rs:287-293 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:200-206 | hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:363-369 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:231-237 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:394-400 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · Graph · ×2
  • Graph::visit_expr_binary (cyclomatic 36) hpt-codegen/src/fuse/build_graph.rs:918 — Graph::visit_expr_binary has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Graph::to_cmp_pet_graph (cyclomatic 28) hpt-codegen/src/fuse/build_graph.rs:109 — Graph::to_cmp_pet_graph has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CFGBuilder · ×2
  • CFGBuilder::visit_stmt (cyclomatic 27) hpt-codegen/src/fuse/cfg_builder.rs:1789 — CFGBuilder::visit_stmt has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: CFGBuilder::visit_expr (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • CFGBuilder::visit_expr_binary (cyclomatic 20) hpt-codegen/src/fuse/cfg_builder.rs:1025 — CFGBuilder::visit_expr_binary has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: CFGBuilder::visit_expr (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Tensor · ×2
  • Tensor::from_onnx_tensor (cyclomatic 23) hpt-dyn/src/tensor.rs:92 — Tensor::from_onnx_tensor has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Tensor::gemm (cyclomatic 20) hpt-dyn/src/ops/tensor/matmul/matmul.rs:375 — Tensor::gemm has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · _Tensor · ×2
  • _Tensor::topk (cyclomatic 22) hpt/src/backends/cpu/tensor_internal/advance.rs:125 — _Tensor::topk has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • _Tensor::layernorm (cyclomatic 18) hpt/src/backends/cpu/tensor_internal/normalization.rs:49 — _Tensor::layernorm has cyclomatic complexity 18 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · hpt_types · ×2
  • hpt_types::dyn_dispatch::scalar::dispatch_linspace (cyclomatic 21) hpt-types/src/dyn_dispatch/scalar.rs:165 — hpt_types::dyn_dispatch::scalar::dispatch_linspace has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hpt_types::dyn_dispatch::scalar::dispatch_geomspace (cyclomatic 17) hpt-types/src/dyn_dispatch/scalar.rs:261 — hpt_types::dyn_dispatch::scalar::dispatch_geomspace has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CFG · ×2
  • CFG::insert_phi_functions (cyclomatic 18) hpt-codegen/src/fuse/cfg.rs:450 — CFG::insert_phi_functions has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: CFG::_gen_code (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • CFG::live_analysis (cyclomatic 16) hpt-codegen/src/fuse/cfg.rs:300 — CFG::live_analysis has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This is NOT this file's highest cyclomatic complexity: CFG::_gen_code (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D2 · Cognitive Complexity · CFGBuilder · ×2
  • CFGBuilder::visit_expr_binary (cognitive 53) hpt-codegen/src/fuse/cfg_builder.rs:1025 — CFGBuilder::visit_expr_binary has cognitive complexity 53 (threshold 15). Drivers by points: if/else 32 (52 pts), match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • CFGBuilder::visit_stmt (cognitive 29) hpt-codegen/src/fuse/cfg_builder.rs:1789 — CFGBuilder::visit_stmt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 3 (5 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Graph · ×2
  • Graph::to_cmp_pet_graph (cognitive 50) hpt-codegen/src/fuse/build_graph.rs:109 — Graph::to_cmp_pet_graph has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (32 pts), match/switch 4 (8 pts), loops 6 (7 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Graph::visit_expr_method_call (cognitive 24) hpt-codegen/src/fuse/build_graph.rs:839 — Graph::visit_expr_method_call has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OnnxModel · ×2
  • OnnxModel::execute::execute (cognitive 46) hpt-dyn/src/utils/onnx/execute.rs:140 — OnnxModel::execute::execute has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (35 pts), loops 4 (10 pts), match/switch 1 (nesting depth added 32). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • OnnxModel::initialize (cognitive 23) hpt-dyn/src/utils/onnx/execute.rs:204 — OnnxModel::initialize has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (16 pts), if/else 3 (6 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · hpt_display · ×2
  • hpt_display::display::main_loop_push_str (cognitive 39) hpt-display/src/display.rs:10 — hpt_display::display::main_loop_push_str has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 6 (14 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hpt_display::display::main_loop_get_width (cognitive 33) hpt-display/src/display.rs:95 — hpt_display::display::main_loop_get_width has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 6 (14 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Operator · ×2
  • Operator::inputs (cognitive 19) hpt-dyn/src/utils/onnx/operators.rs:754 — Operator::inputs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Operator::inputs_mut) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • Operator::inputs_mut (cognitive 19) hpt-dyn/src/utils/onnx/operators.rs:956 — Operator::inputs_mut has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Operator::inputs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D36 · Supply-chain Provenance & Signing · REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (4 members, 32 shared lines) · ×2
  • Near-duplicate member family (4 members, 32 shared lines) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:33 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:33-151 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:28-185 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:36-145 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:32-190 — These 4 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Near-duplicate member family (4 members, 32 shared lines) hpt-dyn/src/ops/tensor/conv2d/utils.rs:408 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:408-503 | hpt-matmul/src/utils.rs:221-316 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:292-364 | hpt/src/backends/cpu/kernels/matmul/utils.rs:12-90 — These 4 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×2
  • Edited copy of a member (8 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:24 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:24-31 | matconv_simd/src/simd/_256bit/common/bf16x16.rs:11-18 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) hpt/src/backends/cpu/tensor_internal/normalization.rs:205 — hpt/src/backends/cpu/tensor_internal/normalization.rs:205-212 | hpt/src/backends/cpu/tensor_internal/normalization.rs:214-221 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (55 corresponding lines) · ×2
  • Edited copy of a member (55 corresponding lines) hpt/src/backends/cuda/utils/unary/unary.rs:141 — hpt/src/backends/cuda/utils/unary/unary.rs:141-196 | hpt/src/backends/cuda/utils/unary/unary.rs:219-273 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (55 corresponding lines) hpt-dyn/src/ops/tensor/rnn/lstm.rs:878 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:878-932 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:944-998 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×2
  • Edited copy of a member (44 corresponding lines) hpt-matmul/src/utils.rs:581 — hpt-matmul/src/utils.rs:581-636 | hpt/src/backends/cpu/kernels/matmul/template.rs:407-450 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) hpt/src/backends/cpu/kernels/matmul/matmul.rs:45 — hpt/src/backends/cpu/kernels/matmul/matmul.rs:45-88 | hpt/src/backends/cpu/kernels/matmul/matmul_post.rs:51-94 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×2
  • Edited copy of a member (46 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1026 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1026-1073 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1088-1133 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) hpt-matmul/src/utils.rs:393 — hpt-matmul/src/utils.rs:393-438 | hpt/src/backends/cpu/kernels/matmul/common.rs:160-210 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) hpt-macros/src/kernel_gen_helper.rs:8 — hpt-macros/src/kernel_gen_helper.rs:8-45 | hpt-macros/src/kernel_gen_helper.rs:47-84 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) hpt-allocator/src/allocators/cuda.rs:162 — hpt-allocator/src/allocators/cuda.rs:162-199 | hpt-allocator/src/allocators/cuda.rs:207-249 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×2
  • Edited copy of a member (28 corresponding lines) hpt-iterator/src/iterator_traits.rs:221 — hpt-iterator/src/iterator_traits.rs:221-248 | hpt-iterator/src/iterator_traits.rs:281-308 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) hpt-tests/src/macro_tests/control_flows/for_loop.expanded.rs:4 — hpt-tests/src/macro_tests/control_flows/for_loop.expanded.rs:4-31 | hpt-tests/src/macro_tests/control_flows/while_loop.expanded.rs:4-31 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×2
  • Edited copy of a member (30 corresponding lines) hpt-dyn/src/ops/tensor/unary.rs:38 — hpt-dyn/src/ops/tensor/unary.rs:38-76 | hpt/src/backends/cpu/utils/unary/unary.rs:31-60 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) hpt-tests/src/hpt/cuda/conv2d_group.rs:167 — hpt-tests/src/hpt/cuda/conv2d_group.rs:167-196 | hpt-tests/src/hpt/cuda/conv2d_group.rs:205-234 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×2
  • Edited copy of a member (21 corresponding lines) hpt-dyn/src/utils/onnx/init.rs:1214 — hpt-dyn/src/utils/onnx/init.rs:1214-1241 | hpt-dyn/src/utils/onnx/init.rs:1412-1432 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1271 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1271-1292 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1295-1315 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×2
  • Edited copy of a member (17 corresponding lines) hpt-dyn/src/utils/onnx/init.rs:70 — hpt-dyn/src/utils/onnx/init.rs:70-90 | hpt-dyn/src/utils/onnx/init.rs:137-153 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) hpt/src/backends/cpu/kernels/conv2d/batchnorm_conv2d.rs:41 — hpt/src/backends/cpu/kernels/conv2d/batchnorm_conv2d.rs:41-57 | hpt-dyn/src/ops/tensor/conv2d/batchnorm_conv2d.rs:37-53 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 15+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:656 — hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:656-670 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:756-770 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:772-786 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) hpt-common/src/utils/pointer.rs:466 — hpt-common/src/utils/pointer.rs:466-480 | hpt-common/src/utils/pointer.rs:537-551 | hpt-common/src/utils/pointer.rs:570-584 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 9+ corresponding lines) hpt-iterator/src/par_strided_map.rs:97 — hpt-iterator/src/par_strided_map.rs:97-109 | hpt-iterator/src/par_strided_map.rs:159-167 | hpt-iterator/src/strided_map.rs:60-73 | hpt-iterator/src/strided_map.rs:115-123 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 9+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:183 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:183-191 | hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:193-201 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:187-195 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:197-205 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:502 — hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:502-508 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:537-543 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:590-596 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:520-526 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:606-612 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 7+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:95 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:95-101 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:94-100 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:136-142 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:77-83 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:152-158 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 4+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:668 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:668-671 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:706-709 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:689-692 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:626 — hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:626-629 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:718-721 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:734-737 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×2
  • Edited copy of a member (3 corresponding lines) hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:31 — hpt-types/src/vectors/arch_simd/_256bit/common/boolx32.rs:31-33 | hpt-types/src/vectors/arch_simd/_512bit/common/boolx64.rs:37-39 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) hpt-iterator/src/par_strided.rs:211 — hpt-iterator/src/par_strided.rs:211-213 | hpt-iterator/src/strided.rs:162-164 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (50 lines × 2) · ×2
  • Duplicated block (50 lines × 2) hpt-macros/src/lib.rs:1276 — hpt-macros/src/lib.rs:1276-1325 | hpt-macros/src/lib.rs:1480-1529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (50 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:440 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:440-489 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:365-414 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (44–46 lines × 2) · ×2
  • Duplicated block (44–46 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:338 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:338-383 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:439-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:338` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (44–46 lines × 2) hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:42 — hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:42-85 | hpt/src/backends/cpu/kernels/normalization/batch_norm.rs:56-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×2
  • Duplicated block (44 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:318 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:318-361 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:361-404 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (44 lines × 2) hpt-codegen/src/fuse/expr_ty.rs:159 — hpt-codegen/src/fuse/expr_ty.rs:159-202 | hpt-codegen/src/fuse/expr_ty.rs:207-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `expr` to `&syn::Expr` in one and `&mut syn::Expr` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×2
  • Duplicated block (31 lines × 2) hpt-macros/src/binary_float_out.rs:8 — hpt-macros/src/binary_float_out.rs:8-38 | hpt-macros/src/binary_float_out.rs:95-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/binary_float_out.rs:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31 lines × 2) hpt-codegen/src/fuse/expr_call_use_visitor.rs:22 — hpt-codegen/src/fuse/expr_call_use_visitor.rs:22-52 | hpt-codegen/src/fuse/ty_infer.rs:50-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/expr_call_use_visitor.rs:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29 lines × 3) · ×2
  • Duplicated block (29 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1042 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1042-1070 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1937-1965 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2029-2057 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1042` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (29 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:933 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:933-961 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1676-1704 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1763-1791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:933` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28 lines × 3) · ×2
  • Duplicated block (28 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1000 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1000-1027 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1889-1916 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1982-2009 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1000` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (28 lines × 3) hpt-dataloader/src/save.rs:31 — hpt-dataloader/src/save.rs:31-58 | hpt-dataloader/src/struct_save/gen_header.rs:17-44 | hpt-dataloader/src/struct_save/save.rs:68-95 — before extracting anything, compare `hpt-dataloader/src/save.rs` and `hpt-dataloader/src/struct_save/save.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:119 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:119-146 | hpt/src/backends/cpu/utils/reduce/reduce.rs:445-472 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:119` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (28 lines × 2) hpt-macros/src/normal_out.rs:8 — hpt-macros/src/normal_out.rs:8-35 | hpt-macros/src/normal_out.rs:140-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/normal_out.rs:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27 lines × 6) · ×2
  • Duplicated block (27 lines × 6) hpt-macros/src/simd_float_out_binary.rs:7 — hpt-macros/src/simd_float_out_binary.rs:7-33 | hpt-macros/src/simd_float_out_binary.rs:117-143 | hpt-macros/src/simd_float_out_binary.rs:236-262 | hpt-macros/src/simd_normal_out.rs:7-33 | hpt-macros/src/simd_normal_out.rs:212-238 | hpt-macros/src/simd_normal_out.rs:363-389 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_float_out_binary.rs:7` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 6) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:109 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:109-135 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:142-168 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:330-356 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:103-129 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:147-173 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:221-247 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×2
  • Duplicated block (25 lines × 2) hpt-dyn/src/ops/tensor/normalization/kernels.rs:753 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:753-777 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:340-364 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:753` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) hpt-macros/src/float_unary.rs:8 — hpt-macros/src/float_unary.rs:8-32 | hpt-macros/src/float_unary.rs:330-354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22 lines × 8) · ×2
  • Duplicated block (22 lines × 8) hpt-dyn/src/ops/tensor/normalization/kernels.rs:182 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:182-203 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:470-491 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:592-613 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:880-901 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:179-200 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:467-488 | hpt/src/backends/cpu/kernels/softmax.rs:180-201 | hpt/src/backends/cpu/kernels/softmax.rs:468-489 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:182` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 8) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:71 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:71-92 | hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:204-225 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:68-89 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:200-221 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:75-96 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:210-231 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:74-95 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:207-228 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:71` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:226` calls `strides`, `ndim` and `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:93` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (64 lines × 2) · ×2
  • Duplicated block (64 lines × 2) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:227 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:227-290 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:233-296 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt/src/backends/cpu/kernels/normalization/log_softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 258 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:227` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (64 lines × 2) hpt-dyn/src/ops/tensor/normalization/softmax.rs:223 — hpt-dyn/src/ops/tensor/normalization/softmax.rs:223-286 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:230-293 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/softmax.rs` and `hpt/src/backends/cpu/kernels/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 258 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/softmax.rs:223` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (21 lines × 4) · ×2
  • Duplicated block (21 lines × 4) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:98 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:98-118 | hpt-dyn/src/ops/tensor/pooling/template.rs:81-101 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:98-118 | hpt/src/backends/cpu/kernels/pooling/common.rs:81-101 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt-dyn/src/ops/tensor/pooling/template.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:144 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:144-164 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:431-451 | hpt/src/backends/cpu/kernels/softmax.rs:142-162 | hpt/src/backends/cpu/kernels/softmax.rs:429-449 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/softmax.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 365 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:95 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:95-112 | hpt/src/backends/cpu/utils/reduce/reduce.rs:420-438 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) hpt-codegen/src/fuse/cfg.rs:1018 — hpt-codegen/src/fuse/cfg.rs:1018-1035 | hpt-codegen/src/fuse/cfg.rs:1081-1099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg.rs:1018` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×2
  • Duplicated block (17 lines × 4) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1009 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1009-1025 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1898-1914 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1991-2007 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2095-2111 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1009` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 4) hpt-dyn/src/ops/tensor/reduce/reduce.rs:150 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:150-166 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:362-378 | hpt/src/backends/cpu/utils/reduce/reduce.rs:475-491 | hpt/src/backends/cpu/utils/reduce/reduce.rs:686-702 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×2
  • Duplicated block (17 lines × 3) hpt-dyn/src/ops/tensor/matmul/matmul.rs:512 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:512-528 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:716-732 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:775-791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 3) hpt-matmul/src/utils.rs:463 — hpt-matmul/src/utils.rs:463-479 | hpt-matmul/src/utils.rs:551-567 | hpt/src/backends/cpu/kernels/matmul/template.rs:375-391 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/template.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/utils.rs:463` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) hpt-dyn/src/ops/tensor/rnn/lstm.rs:300 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:300-315 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:400-415 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:646-661 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:300` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 3) hpt-macros/src/normal_out_unary.rs:66 — hpt-macros/src/normal_out_unary.rs:66-81 | hpt-macros/src/normal_out_unary.rs:148-163 | hpt-macros/src/simd_normal_unary.rs:65-80 — before extracting anything, compare `hpt-macros/src/normal_out_unary.rs` and `hpt-macros/src/simd_normal_unary.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) hpt-dyn/src/ops/tensor/binary.rs:720 — hpt-dyn/src/ops/tensor/binary.rs:720-733 | hpt-dyn/src/ops/tensor/binary.rs:748-762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `rhs` to `Self` in one and `&Tensor` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (14–15 lines × 2) hpt-tests/src/hpt/cuda/dwconv2d.rs:130 — hpt-tests/src/hpt/cuda/dwconv2d.rs:130-144 | hpt-tests/src/hpt/cuda/dwconv2d.rs:168-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/dwconv2d.rs:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) hpt-dyn/src/ops/tensor/rnn/lstm.rs:883 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:883-896 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:900-913 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:949-962 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:966-979 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:883` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 4) hpt-codegen/src/fuse/cfg_builder.rs:1247 — hpt-codegen/src/fuse/cfg_builder.rs:1247-1260 | hpt-codegen/src/fuse/cfg_builder.rs:1313-1326 | hpt-codegen/src/fuse/cfg_builder.rs:1400-1413 | hpt-codegen/src/fuse/cfg_builder.rs:1499-1512 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×2
  • Duplicated block (12–13 lines × 3) hpt-dyn/src/ops/tensor/reduce/reduce.rs:968 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:968-979 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1027-1039 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1089-1101 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:968` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:916 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:916-928 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1648-1659 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1733-1744 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:916` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • Duplicated block (12–13 lines × 2) hpt/src/backends/cuda/tensor_internal/softmax.rs:29 — hpt/src/backends/cuda/tensor_internal/softmax.rs:29-41 | hpt/src/backends/cuda/utils/unary/unary.rs:22-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–13 lines × 2) hpt-tests/src/hpt/cpu/dwconv2d.rs:143 — hpt-tests/src/hpt/cpu/dwconv2d.rs:143-155 | hpt-tests/src/hpt/cpu/dwconv2d.rs:176-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/dwconv2d.rs:143` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×2
  • Duplicated block (11–12 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:213 — hpt-codegen/src/fuse/cfg_builder.rs:213-224 | hpt-codegen/src/fuse/cfg_builder.rs:419-430 | hpt-codegen/src/fuse/cfg_builder.rs:516-526 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-codegen/src/fuse/cfg_builder.rs:431` calls `push` and `hpt-codegen/src/fuse/cfg_builder.rs:225` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11–12 lines × 3) hpt-tests/src/hpt/cpu/conv2d.rs:47 — hpt-tests/src/hpt/cpu/conv2d.rs:47-57 | hpt-tests/src/hpt/cpu/conv2d_group.rs:59-70 | hpt-tests/src/hpt/cpu/conv2d_transpose.rs:49-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/conv2d.rs:47` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:329 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:329-338 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:582-593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–12 lines × 2) hpt/src/backends/cuda/tensor_internal/conv2d.rs:231 — hpt/src/backends/cuda/tensor_internal/conv2d.rs:231-242 | hpt/src/backends/cuda/tensor_internal/matmul.rs:164-173 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/conv2d.rs:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) hpt-macros/src/simd_float_out_binary.rs:37 — hpt-macros/src/simd_float_out_binary.rs:37-47 | hpt-macros/src/simd_float_out_binary.rs:151-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_float_out_binary.rs:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) hpt-tests/src/hpt/cuda/conv2d.rs:40 — hpt-tests/src/hpt/cuda/conv2d.rs:40-50 | hpt-tests/src/hpt/cuda/conv2d_group.rs:47-58 — before extracting anything, compare `hpt-tests/src/hpt/cuda/conv2d.rs` and `hpt-tests/src/hpt/cuda/conv2d_group.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/conv2d.rs:40` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 14) · ×2
  • Duplicated block (10–11 lines × 14) hpt-dyn/src/ops/tensor/random.rs:66 — hpt-dyn/src/ops/tensor/random.rs:66-75 | hpt-dyn/src/ops/tensor/random.rs:121-130 | hpt-dyn/src/ops/tensor/random.rs:176-185 | hpt-dyn/src/ops/tensor/random.rs:230-239 | hpt-dyn/src/ops/tensor/random.rs:284-293 | hpt-dyn/src/ops/tensor/random.rs:339-349 | hpt-dyn/src/ops/tensor/random.rs:402-411 | hpt-dyn/src/ops/tensor/random.rs:458-467 | hpt-dyn/src/ops/tensor/random.rs:513-522 | hpt-dyn/src/ops/tensor/random.rs:574-584 | hpt-dyn/src/ops/tensor/random.rs:636-645 | hpt-dyn/src/ops/tensor/random.rs:691-701 | hpt-dyn/src/ops/tensor/random.rs:754-763 | hpt-dyn/src/ops/tensor/random.rs:810-819 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/random.rs:66` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 14) hpt-dyn/src/ops/tensor/random.rs:78 — hpt-dyn/src/ops/tensor/random.rs:78-87 | hpt-dyn/src/ops/tensor/random.rs:133-142 | hpt-dyn/src/ops/tensor/random.rs:188-197 | hpt-dyn/src/ops/tensor/random.rs:242-251 | hpt-dyn/src/ops/tensor/random.rs:296-305 | hpt-dyn/src/ops/tensor/random.rs:352-362 | hpt-dyn/src/ops/tensor/random.rs:414-424 | hpt-dyn/src/ops/tensor/random.rs:470-479 | hpt-dyn/src/ops/tensor/random.rs:528-537 | hpt-dyn/src/ops/tensor/random.rs:587-597 | hpt-dyn/src/ops/tensor/random.rs:648-657 | hpt-dyn/src/ops/tensor/random.rs:704-714 | hpt-dyn/src/ops/tensor/random.rs:766-775 | hpt-dyn/src/ops/tensor/random.rs:826-835 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/random.rs:78` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11 lines × 8) · ×2
  • Duplicated block (11 lines × 8) hpt-dyn/src/ops/tensor/normalization/kernels.rs:20 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:20-30 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:35-45 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:57-67 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:18-28 | hpt/src/backends/cpu/kernels/reduce.rs:36-46 | hpt/src/backends/cpu/kernels/reduce.rs:58-68 | hpt/src/backends/cpu/kernels/softmax.rs:18-28 | hpt/src/backends/cpu/tensor_internal/normalization.rs:233-244 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:20` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 8) hpt-dyn/src/ops/tensor/normalization/kernels.rs:131 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:131-141 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:417-427 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:542-552 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:830-840 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:129-139 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:417-427 | hpt/src/backends/cpu/kernels/softmax.rs:129-139 | hpt/src/backends/cpu/kernels/softmax.rs:415-425 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×2
  • Duplicated block (10–11 lines × 2) hpt-dataloader/src/save.rs:15 — hpt-dataloader/src/save.rs:15-25 | hpt-dataloader/src/struct_save/gen_header.rs:5-14 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 2) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:302 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:302-311 | hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:318-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:302` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 9) · ×2
  • Duplicated block (10 lines × 9) hpt-codegen/src/fuse/cfg_builder.rs:182 — hpt-codegen/src/fuse/cfg_builder.rs:182-191 | hpt-codegen/src/fuse/cfg_builder.rs:238-247 | hpt-codegen/src/fuse/cfg_builder.rs:326-335 | hpt-codegen/src/fuse/cfg_builder.rs:380-389 | hpt-codegen/src/fuse/cfg_builder.rs:456-465 | hpt-codegen/src/fuse/cfg_builder.rs:883-892 | hpt-codegen/src/fuse/cfg_builder.rs:933-942 | hpt-codegen/src/fuse/cfg_builder.rs:983-992 | hpt-codegen/src/fuse/cfg_builder.rs:1600-1609 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:182` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 9) hpt-dyn/src/ops/tensor/normalization/kernels.rs:20 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:20-29 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:35-44 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:57-66 | hpt-dyn/src/utils/index_cal.rs:195-204 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:18-27 | hpt/src/backends/cpu/kernels/reduce.rs:36-45 | hpt/src/backends/cpu/kernels/reduce.rs:58-67 | hpt/src/backends/cpu/kernels/softmax.rs:18-27 | hpt/src/backends/cpu/tensor_internal/normalization.rs:233-243 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:20` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×2
  • Duplicated block (10 lines × 6) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:45 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:45-54 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:30-39 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:154-163 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:45-54 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:34-43 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:61-70 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 6) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:30 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:30-39 | hpt-dyn/src/ops/tensor/pooling/template.rs:29-38 | hpt-dyn/src/ops/tensor/pooling/template.rs:227-236 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:30-39 | hpt/src/backends/cpu/kernels/pooling/common.rs:33-42 | hpt/src/backends/cpu/kernels/pooling/common.rs:229-238 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt-dyn/src/ops/tensor/pooling/template.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–10 lines × 3) · ×2
  • Duplicated block (8–10 lines × 3) hpt-codegen/src/fuse/var_coalescer.rs:33 — hpt-codegen/src/fuse/var_coalescer.rs:33-42 | hpt-codegen/src/fuse/var_coalescer.rs:47-54 | hpt-codegen/src/fuse/var_coalescer.rs:59-68 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/var_coalescer.rs:33` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–10 lines × 3) hpt/src/backends/cuda/utils/binary/binary_normal.rs:400 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:400-407 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:445-452 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:489-498 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:400` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) hpt-codegen/src/fuse/build_graph.rs:151 — hpt-codegen/src/fuse/build_graph.rs:151-157 | hpt-codegen/src/fuse/build_graph.rs:171-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/build_graph.rs:171` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) hpt-matmul/src/template.rs:384 — hpt-matmul/src/template.rs:384-390 | hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:79-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/template.rs:384` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–7 lines × 6) · ×2
  • Duplicated block (6–7 lines × 6) hpt-codegen/src/fuse/cfg_builder.rs:81 — hpt-codegen/src/fuse/cfg_builder.rs:81-86 | hpt-codegen/src/fuse/cfg_builder.rs:230-236 | hpt-codegen/src/fuse/cfg_builder.rs:876-881 | hpt-codegen/src/fuse/cfg_builder.rs:926-931 | hpt-codegen/src/fuse/cfg_builder.rs:976-981 | hpt-codegen/src/fuse/cfg_builder.rs:1592-1598 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6–7 lines × 6) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:135 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:135-141 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:132-138 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:223-228 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:139-145 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:138-144 | hpt/src/backends/cpu/utils/reduce/reduce.rs:550-555 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 11) · ×2
  • Duplicated block (6 lines × 11) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:82 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:82-87 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:263-268 | hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:81-86 | hpt-dyn/src/ops/tensor/pooling/template.rs:68-73 | hpt-dyn/src/ops/tensor/pooling/template.rs:260-265 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:46-51 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:82-87 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:163-168 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:81-86 | hpt/src/backends/cpu/kernels/pooling/common.rs:68-73 | hpt/src/backends/cpu/kernels/pooling/common.rs:258-263 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:79` calls `ptr` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:80` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 11) hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:570 — hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:570-575 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:578-583 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:586-591 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:594-599 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:602-607 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:610-615 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:618-623 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:632-637 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:640-645 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:617-622 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:600-605 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` and `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:90 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:90-95 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:271-276 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:52-58 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:88-94 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:169-175 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 5) hpt-dyn/src/ops/tensor/matmul/matmul.rs:516 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:516-521 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:586-591 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:666-671 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:720-725 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:779-784 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 8) · ×2
  • Duplicated block (5 lines × 8) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:93 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:93-97 | hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:227-231 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:90-94 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:223-227 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:97-101 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:233-237 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:96-100 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:230-234 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:93` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:226` calls `strides`, `ndim` and `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:92` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 8) hpt-tests/src/hpt/cpu/bn_conv2d.rs:82 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:82-86 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:124-128 | hpt-tests/src/hpt/cpu/conv2d.rs:73-77 | hpt-tests/src/hpt/cpu/conv2d.rs:100-104 | hpt-tests/src/hpt/cpu/conv2d_group.rs:88-97 | hpt-tests/src/hpt/cpu/conv2d_group.rs:124-133 | hpt-tests/src/hpt/cpu/dwconv2d.rs:79-88 | hpt-tests/src/hpt/cpu/dwconv2d.rs:114-123 — before extracting anything, compare `hpt-tests/src/hpt/cpu/bn_conv2d.rs` and `hpt-tests/src/hpt/cpu/conv2d.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/bn_conv2d.rs:82` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-tests/src/hpt/cpu/bn_conv2d.rs:88` calls `sqrt` and `hpt-tests/src/hpt/cpu/conv2d.rs:79` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:533 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:533-539 | hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:542-548 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:493-499 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:528-534 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:511-517 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 5) hpt-tests/src/hpt/cpu/fft.rs:37 — hpt-tests/src/hpt/cpu/fft.rs:37-43 | hpt-tests/src/hpt/cpu/slice.rs:10-16 | hpt-tests/src/hpt/cuda/creation.rs:12-18 | hpt-tests/src/hpt/cuda/reduce.rs:56-62 | hpt-tests/src/hpt/cuda/reduce.rs:91-97 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/fft.rs:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `b` to `&hpt::Tensor<Complex64>` in one and `&Tensor<i32>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 12+ corresponding lines) hpt-tests/src/hpt/cpu/adaptive_avg_pool.rs:32 — hpt-tests/src/hpt/cpu/adaptive_avg_pool.rs:32-43 | hpt-tests/src/hpt/cpu/adaptive_max_pool.rs:31-42 | hpt-tests/src/hpt/cpu/avg_pool.rs:51-62 | hpt-tests/src/hpt/cpu/avg_pool.rs:70-81 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) hpt-tests/src/hpt/cpu/assert_utils.rs:1 — hpt-tests/src/hpt/cpu/assert_utils.rs:1-12 | hpt-tests/src/hpt/cpu/assert_utils.rs:16-27 | hpt-tests/src/hpt/cuda/assert_utils.rs:9-22 | hpt-tests/src/hpt/cuda/assert_utils.rs:32-45 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
IC1 · Incompleteness & stubs · Unfinished branch · ×2
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function hpt-codegen/src/fuse/build_graph.rs:363 — `visit_expr_assign` does real work, but one of its branches is `unimplemented!` — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function hpt-codegen/src/fuse/build_graph.rs:430 — `visit_expr_unary` does real work, but one of its branches is `todo!` — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
D1 · Cyclomatic Complexity · VarCoalescer · ×1
  • VarCoalescer::run (cyclomatic 25) hpt-codegen/src/fuse/var_coalescer.rs:19 — VarCoalescer::run has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UseDefineVisitor · ×1
  • UseDefineVisitor::visit_pat (cyclomatic 22) hpt-codegen/src/fuse/use_define_visitor.rs:47 — UseDefineVisitor::visit_pat has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: UseDefineVisitor::visit_expr_call (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ExprCallUseVisitor · ×1
  • ExprCallUseVisitor::type_of (cyclomatic 20) hpt-codegen/src/fuse/expr_call_use_visitor.rs:21 — ExprCallUseVisitor::type_of has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · StridedIteratorSimd · ×1
  • StridedIteratorSimd::for_each (cyclomatic 17) hpt-iterator/src/iterator_traits.rs:356 — StridedIteratorSimd::for_each has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · WithSimd · ×1
  • WithSimd::fold_with (cyclomatic 17) hpt-iterator/src/with_simd.rs:36 — WithSimd::fold_with has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · hpt_display · ×1
  • hpt_display::display::main_loop_push_str (cyclomatic 16) hpt-display/src/display.rs:10 — hpt_display::display::main_loop_push_str has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D17 · Explicit Debt · TodoComment · ×1
  • TodoComment hpt-tests/src/hpt/cpu/reduce.rs:358 — // TODO: make logsumexp stable — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · VarCoalescer · ×1
  • VarCoalescer::run (cognitive 98) hpt-codegen/src/fuse/var_coalescer.rs:19 — VarCoalescer::run has cognitive complexity 98 (threshold 15). Drivers by points: if/else 15 (85 pts), match/switch 2 (8 pts), loops 3 (5 pts) (nesting depth added 78). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · StridedIteratorSimd · ×1
  • StridedIteratorSimd::for_each (cognitive 63) hpt-iterator/src/iterator_traits.rs:356 — StridedIteratorSimd::for_each has cognitive complexity 63 (threshold 15). Drivers by points: loops 12 (51 pts), if/else 6 (11 pts), match/switch 1 (nesting depth added 44). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WithSimd · ×1
  • WithSimd::fold_with (cognitive 63) hpt-iterator/src/with_simd.rs:36 — WithSimd::fold_with has cognitive complexity 63 (threshold 15). Drivers by points: loops 12 (51 pts), if/else 6 (11 pts), match/switch 1 (nesting depth added 44). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ComputeThreadPool · ×1
  • ComputeThreadPool::new (cognitive 24) hpt/src/backends/common/thread_pool.rs:28 — ComputeThreadPool::new has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hpt_allocator · ×1
  • hpt_allocator::utils::allocate::allocate_mem (cognitive 20) hpt-allocator/src/utils/allocate.rs:15 — hpt_allocator::utils::allocate::allocate_mem has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiffTensor · ×1
  • DiffTensor::split (cognitive 18) hpt/src/backends/cpu/tensor_external/shape_manipulate.rs:387 — DiffTensor::split has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hpt_types · ×1
  • hpt_types::dyn_dispatch::scalar::dispatch_linspace (cognitive 16) hpt-types/src/dyn_dispatch/scalar.rs:165 — hpt_types::dyn_dispatch::scalar::dispatch_linspace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · TooManyMethods · ×1
  • TooManyMethods: Tensor hpt-dyn/src/tensor.rs:29 — TooManyMethods — 133 methods, declared across 16 files: tensor/random.rs (30), reduce/reduce.rs (28), tensor/shape_manipulate.rs (23), tensor/creation.rs (15), +12 more file(s). The bar is 30 methods; this is 103 over it, 4.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: main.rs → build_graph.rs, cfg.rs, cfg_builder.rs, codegen.rs, gen_fuse.rs, start.rs, save.rs, matmul.rs, reduce.rs src/main.rs — `src/main.rs` changes together with 9 other files — `hpt-codegen/src/fuse/build_graph.rs`, `hpt-codegen/src/fuse/cfg.rs`, `hpt-codegen/src/fuse/cfg_builder.rs`, `hpt-codegen/src/fuse/codegen.rs`, `hpt-codegen/src/fuse/gen_fuse.rs`, `hpt-codegen/src/fuse/start.rs`, `hpt-dataloader/src/struct_save/save.rs`, `hpt/src/backends/cpu/kernels/matmul/matmul.rs`, `hpt/src/backends/cuda/utils/reduce/reduce.rs` — none of which declares a dependency on it: one file is the hub of 9 separate couplings, not 9 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 9.
D35 · Change Coupling · Change coupling · ×1
  • Change coupling: build_graph.rs ↔ start.rs hpt-codegen/src/fuse/build_graph.rs:1 — `hpt-codegen/src/fuse/build_graph.rs` and `hpt-codegen/src/fuse/start.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `03f6ab05` a (at that commit the files were still `tensor-codegen/src/fuse/build_graph.rs` and `tensor-codegen/src/fuse/start.rs`); `b990beb4` a (at that commit the files were still `tensor-codegen/src/fuse/build_graph.rs` and `tensor-codegen/src/fuse/start.rs`); `24440713` q (at that commit the files were still `tensor-codegen/src/fuse/build_graph.rs` and `tensor-codegen/src/fuse/start.rs`) — run `git show` on any of them.
D4 · Code Duplication · Near-duplicate member family (14 members, 20 shared lines) · ×1
  • Near-duplicate member family (14 members, 20 shared lines) hpt-dyn/src/ops/tensor/random.rs:56 — hpt-dyn/src/ops/tensor/random.rs:56-99 | hpt-dyn/src/ops/tensor/random.rs:111-154 | hpt-dyn/src/ops/tensor/random.rs:166-209 | hpt-dyn/src/ops/tensor/random.rs:220-263 | hpt-dyn/src/ops/tensor/random.rs:274-317 | hpt-dyn/src/ops/tensor/random.rs:329-374 | hpt-dyn/src/ops/tensor/random.rs:392-436 | hpt-dyn/src/ops/tensor/random.rs:448-491 | hpt-dyn/src/ops/tensor/random.rs:503-552 | hpt-dyn/src/ops/tensor/random.rs:564-609 | hpt-dyn/src/ops/tensor/random.rs:626-669 | hpt-dyn/src/ops/tensor/random.rs:681-726 | hpt-dyn/src/ops/tensor/random.rs:744-787 | hpt-dyn/src/ops/tensor/random.rs:800-851 — These 14 members are variants of one another: a block of 20 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
D4 · Code Duplication · Near-duplicate member family (8 members, 62 shared lines) · ×1
  • Near-duplicate member family (8 members, 62 shared lines) hpt-dyn/src/ops/tensor/normalization/kernels.rs:98 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:98-203 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:384-491 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:509-613 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:797-901 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:96-200 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:384-488 | hpt/src/backends/cpu/kernels/softmax.rs:96-201 | hpt/src/backends/cpu/kernels/softmax.rs:382-489 — These 8 members are variants of one another: a block of 62 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (8 members, 41 shared lines) · ×1
  • Near-duplicate member family (8 members, 41 shared lines) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:40 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:40-158 | hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:171-292 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:37-155 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:168-288 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:45-162 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:177-298 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:44-161 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:176-295 — These 8 members are variants of one another: a block of 41 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 22 shared lines) · ×1
  • Near-duplicate member family (5 members, 22 shared lines) hpt-codegen/src/fuse/cfg_builder.rs:167 — hpt-codegen/src/fuse/cfg_builder.rs:167-226 | hpt-codegen/src/fuse/cfg_builder.rs:229-310 | hpt-codegen/src/fuse/cfg_builder.rs:312-360 | hpt-codegen/src/fuse/cfg_builder.rs:362-433 | hpt-codegen/src/fuse/cfg_builder.rs:435-530 — These 5 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 87 shared lines) · ×1
  • Near-duplicate member family (4 members, 87 shared lines) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:29 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:29-218 | hpt-dyn/src/ops/tensor/pooling/template.rs:28-213 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:29-218 | hpt/src/backends/cpu/kernels/pooling/common.rs:32-213 — These 4 members are variants of one another: a block of 87 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 52 shared lines) · ×1
  • Near-duplicate member family (4 members, 52 shared lines) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:28 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:28-185 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:137-376 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:32-190 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:45-267 — These 4 members are variants of one another: a block of 52 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 49 shared lines) · ×1
  • Near-duplicate member family (4 members, 49 shared lines) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:32 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:32-139 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:137-376 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:29-131 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:45-267 — These 4 members are variants of one another: a block of 49 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 46 shared lines) · ×1
  • Near-duplicate member family (4 members, 46 shared lines) hpt-dyn/src/ops/tensor/normalization/kernels.rs:221 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:221-321 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:631-733 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:218-320 | hpt/src/backends/cpu/kernels/softmax.rs:219-319 — These 4 members are variants of one another: a block of 46 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 44 shared lines) · ×1
  • Near-duplicate member family (4 members, 44 shared lines) hpt-dyn/src/ops/tensor/pooling/template.rs:28 — hpt-dyn/src/ops/tensor/pooling/template.rs:28-213 | hpt-dyn/src/ops/tensor/pooling/template.rs:226-372 | hpt/src/backends/cpu/kernels/pooling/common.rs:32-213 | hpt/src/backends/cpu/kernels/pooling/common.rs:228-370 — These 4 members are variants of one another: a block of 44 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 36 shared lines) · ×1
  • Near-duplicate member family (4 members, 36 shared lines) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:111 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:111-161 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:191-233 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:118-167 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:197-239 — These 4 members are variants of one another: a block of 36 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 8 shared lines) · ×1
  • Near-duplicate member family (3 members, 8 shared lines) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:241 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:241-263 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:250-268 | hpt/src/backends/cuda/tensor_internal/softmax.rs:61-82 — These 3 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (169 shared lines) · ×1
  • Near-duplicate member pair (169 shared lines) hpt-macros/src/float_unary.rs:5 — hpt-macros/src/float_unary.rs:5-324 | hpt-macros/src/float_unary.rs:327-624 — These two members are variants of one another: 169 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (129 shared lines) · ×1
  • Near-duplicate member pair (129 shared lines) hpt-dyn/src/ops/tensor/rnn/lstm.rs:199 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:199-421 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:443-667 — These two members are variants of one another: 129 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (128 shared lines) · ×1
  • Near-duplicate member pair (128 shared lines) hpt-macros/src/lib.rs:1152 — hpt-macros/src/lib.rs:1152-1325 | hpt-macros/src/lib.rs:1329-1529 — These two members are variants of one another: 128 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (104 shared lines) · ×1
  • Near-duplicate member pair (104 shared lines) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:72 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:72-215 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:77-236 — These two members are variants of one another: 104 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (100 shared lines) · ×1
  • Near-duplicate member pair (100 shared lines) hpt-matmul/src/matmul.rs:309 — hpt-matmul/src/matmul.rs:309-436 | hpt-matmul/src/matmul.rs:464-675 — These two members are variants of one another: 100 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (58 shared lines) · ×1
  • Near-duplicate member pair (58 shared lines) hpt-dyn/src/ops/tensor/rnn/lstm.rs:692 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:692-767 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:792-865 — These two members are variants of one another: 58 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) hpt-dataloader/src/save.rs:70 — hpt-dataloader/src/save.rs:70-221 | hpt-dataloader/src/struct_save/save.rs:121-245 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (42 shared lines) · ×1
  • Near-duplicate member pair (42 shared lines) hpt-macros/src/normal_out.rs:5 — hpt-macros/src/normal_out.rs:5-134 | hpt-macros/src/normal_out.rs:137-266 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (32 shared lines) · ×1
  • Near-duplicate member pair (32 shared lines) hpt/src/backends/cpu/utils/binary/binary_normal.rs:70 — hpt/src/backends/cpu/utils/binary/binary_normal.rs:70-281 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:335-405 — These two members are variants of one another: 32 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (30 shared lines) · ×1
  • Near-duplicate member pair (30 shared lines) hpt-iterator/src/par_strided.rs:246 — hpt-iterator/src/par_strided.rs:246-288 | hpt-iterator/src/par_strided.rs:568-612 — These two members are variants of one another: 30 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:33 — hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:33-88 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:186-253 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (70 corresponding lines) · ×1
  • Edited copy of a member (70 corresponding lines) hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:29 — hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:29-109 | hpt/src/backends/cpu/kernels/normalization/batch_norm.rs:36-131 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:815 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:815-887 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:890-964 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (10 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/normalization/kernels.rs:41 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:41-55 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:66-80 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:39-53 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:64-78 | hpt/src/backends/cpu/kernels/softmax.rs:39-53 | hpt/src/backends/cpu/kernels/softmax.rs:64-78 | hpt/src/backends/cpu/tensor_internal/gemm.rs:41-219 | hpt/src/backends/cpu/tensor_internal/matmul.rs:45-399 | hpt/src/backends/cpu/tensor_internal/normalization.rs:256-271 | hpt/src/backends/cpu/utils/unary/unary.rs:143-262 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) hpt-dyn/src/ops/tensor/normalization/kernels.rs:18 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:18-30 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:33-45 | hpt-dyn/src/ops/tensor/reduce/kernels.rs:55-67 | hpt-dyn/src/utils/index_cal.rs:190-206 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:16-28 | hpt/src/backends/cpu/kernels/reduce.rs:34-46 | hpt/src/backends/cpu/kernels/reduce.rs:56-68 | hpt/src/backends/cpu/kernels/softmax.rs:16-28 | hpt/src/backends/cpu/tensor_internal/normalization.rs:231-244 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication · Edited copy of a member (362 corresponding lines) · ×1
  • Edited copy of a member (362 corresponding lines) hpt-dyn/src/ops/tensor/binary.rs:230 — hpt-dyn/src/ops/tensor/binary.rs:230-591 | hpt-dyn/src/ops/tensor/unary.rs:610-976 — These two members are one piece of code written twice and then edited apart: 362 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (185 corresponding lines) · ×1
  • Edited copy of a member (185 corresponding lines) hpt-dyn/src/utils/onnx/operators.rs:754 — hpt-dyn/src/utils/onnx/operators.rs:754-954 | hpt-dyn/src/utils/onnx/operators.rs:956-1140 — These two members are one piece of code written twice and then edited apart: 185 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (161 corresponding lines) · ×1
  • Edited copy of a member (161 corresponding lines) hpt-dyn/src/utils/onnx/operators.rs:1142 — hpt-dyn/src/utils/onnx/operators.rs:1142-1302 | hpt-dyn/src/utils/onnx/operators.rs:1304-1464 — These two members are one piece of code written twice and then edited apart: 161 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (133 corresponding lines) · ×1
  • Edited copy of a member (133 corresponding lines) hpt-dyn/src/ops/tensor/matmul/matmul.rs:48 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:48-180 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:201-360 — These two members are one piece of code written twice and then edited apart: 133 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (125 corresponding lines) · ×1
  • Edited copy of a member (125 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:165 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:165-289 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:292-429 — These two members are one piece of code written twice and then edited apart: 125 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (74 corresponding lines) · ×1
  • Edited copy of a member (74 corresponding lines) hpt-matmul/src/microkernels.rs:186 — hpt-matmul/src/microkernels.rs:186-259 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:182-255 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (111 corresponding lines) · ×1
  • Edited copy of a member (111 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2139 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2139-2264 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1870-1980 — These two members are one piece of code written twice and then edited apart: 111 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (91 corresponding lines) · ×1
  • Edited copy of a member (91 corresponding lines) hpt-macros/src/lib.rs:384 — hpt-macros/src/lib.rs:384-474 | hpt-macros/src/lib.rs:478-568 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 90+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 90+ corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:981 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:981-1070 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1875-1965 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1968-2057 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 90 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (83 corresponding lines) · ×1
  • Edited copy of a member (83 corresponding lines) hpt-macros/src/lib.rs:572 — hpt-macros/src/lib.rs:572-654 | hpt-macros/src/lib.rs:658-740 — These two members are one piece of code written twice and then edited apart: 83 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (94 corresponding lines) · ×1
  • Edited copy of a member (94 corresponding lines) hpt-macros/src/simd_bitwise.rs:8 — hpt-macros/src/simd_bitwise.rs:8-101 | hpt-macros/src/simd_cmp.rs:8-107 — These two members are one piece of code written twice and then edited apart: 94 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 52+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 52+ corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1995 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1995-2070 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:2076-2151 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:2157-2232 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:2238-2289 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 52 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (89 corresponding lines) · ×1
  • Edited copy of a member (89 corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:298 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:298-386 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:389-485 — These two members are one piece of code written twice and then edited apart: 89 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (85 corresponding lines) · ×1
  • Edited copy of a member (85 corresponding lines) hpt-macros/src/binary_float_out.rs:5 — hpt-macros/src/binary_float_out.rs:5-89 | hpt-macros/src/binary_float_out.rs:92-176 — These two members are one piece of code written twice and then edited apart: 85 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (87 corresponding lines) · ×1
  • Edited copy of a member (87 corresponding lines) hpt-dyn/src/ops/tensor/conv2d/utils.rs:312 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:312-398 | hpt-matmul/src/utils.rs:118-211 — These two members are one piece of code written twice and then edited apart: 87 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 33+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 33+ corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce.rs:1454 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:1454-1498 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1499-1543 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1544-1588 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:1589-1621 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 33 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:108 — hpt-dyn/src/ops/tensor/reduce/reduce_template.rs:108-168 | hpt/src/backends/cpu/utils/reduce/reduce_template.rs:425-497 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (66 corresponding lines) · ×1
  • Edited copy of a member (66 corresponding lines) hpt-iterator/src/iterator_traits.rs:360 — hpt-iterator/src/iterator_traits.rs:360-425 | hpt-iterator/src/with_simd.rs:39-106 — These two members are one piece of code written twice and then edited apart: 66 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:312 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:312-363 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:355-408 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (50 corresponding lines) · ×1
  • Edited copy of a member (50 corresponding lines) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:293 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:293-342 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:218-267 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (64 corresponding lines) · ×1
  • Edited copy of a member (64 corresponding lines) hpt-dyn/src/ops/tensor/conv2d/conv2d_img2col.rs:35 — hpt-dyn/src/ops/tensor/conv2d/conv2d_img2col.rs:35-101 | hpt/src/backends/cpu/kernels/conv2d/conv2d_img2col.rs:40-103 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 83+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 83+ corresponding lines) hpt-macros/src/normal_out_unary.rs:5 — hpt-macros/src/normal_out_unary.rs:5-88 | hpt-macros/src/normal_out_unary.rs:91-174 | hpt-macros/src/simd_normal_unary.rs:5-87 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 83 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 34+ corresponding lines) hpt-types/src/dyn_dispatch/scalar.rs:54 — hpt-types/src/dyn_dispatch/scalar.rs:54-87 | hpt-types/src/dyn_dispatch/scalar.rs:93-127 | hpt-types/src/dyn_dispatch/scalar.rs:225-259 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 45+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 45+ corresponding lines) hpt-dataloader/src/save.rs:11 — hpt-dataloader/src/save.rs:11-63 | hpt-dataloader/src/struct_save/gen_header.rs:3-48 | hpt-dataloader/src/struct_save/save.rs:55-99 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 45 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 39+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 39+ corresponding lines) hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:28 — hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:28-69 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:91-133 | hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:13-51 | hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:120-158 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 39 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 31+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 31+ corresponding lines) hpt-dyn/src/utils/index_cal.rs:9 — hpt-dyn/src/utils/index_cal.rs:9-39 | hpt-dyn/src/utils/index_cal.rs:41-71 | hpt-dyn/src/utils/index_cal.rs:73-103 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 38+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 38+ corresponding lines) hpt-matmul/src/matmul.rs:26 — hpt-matmul/src/matmul.rs:26-67 | hpt-matmul/src/matmul.rs:96-137 | hpt-matmul/src/matmul.rs:167-204 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 22+ corresponding lines) hpt/src/backends/cpu/kernels/matmul/matmul.rs:101 — hpt/src/backends/cpu/kernels/matmul/matmul.rs:101-122 | hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:380-401 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:434-457 | hpt/src/backends/cpu/kernels/matmul/matmul_post.rs:111-133 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) hpt-macros/src/simd_bitwise.rs:103 — hpt-macros/src/simd_bitwise.rs:103-127 | hpt-macros/src/simd_cmp.rs:109-134 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×1
  • Edited copy of a member (41 corresponding lines) hpt/src/backends/cuda/tensor_internal/windows.rs:55 — hpt/src/backends/cuda/tensor_internal/windows.rs:55-101 | hpt/src/backends/cuda/tensor_internal/windows.rs:116-156 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) hpt-dyn/src/ops/tensor/creation.rs:121 — hpt-dyn/src/ops/tensor/creation.rs:121-142 | hpt-dyn/src/ops/tensor/creation.rs:150-172 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 17+ corresponding lines) hpt-dyn/src/utils/onnx/init.rs:756 — hpt-dyn/src/utils/onnx/init.rs:756-775 | hpt-dyn/src/utils/onnx/init.rs:781-799 | hpt-dyn/src/utils/onnx/init.rs:904-920 | hpt-dyn/src/utils/onnx/init.rs:1180-1196 | hpt-dyn/src/utils/onnx/init.rs:1278-1294 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 13+ corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:152 — hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:152-164 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:172-184 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:214-226 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:229-241 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:244-256 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) hpt-iterator/src/par_strided_zip.rs:233 — hpt-iterator/src/par_strided_zip.rs:233-259 | hpt-iterator/src/par_strided_zip.rs:443-469 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×1
  • Edited copy of a member (15 corresponding lines) hpt-dyn/src/utils/onnx/fwd.rs:573 — hpt-dyn/src/utils/onnx/fwd.rs:573-587 | hpt-dyn/src/utils/onnx/fwd.rs:594-608 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:111 — hpt-types/src/vectors/arch_simd/sleef/common/commonfuncs.rs:111-133 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2491-2516 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:2524-2549 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 24+ corresponding lines) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1519 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1519-1544 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1547-1570 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1573-1600 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/df.rs:531 — hpt-types/src/vectors/arch_simd/sleef/common/df.rs:531-544 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:548-562 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:637-651 | hpt-types/src/vectors/arch_simd/sleef/common/df.rs:655-670 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 9+ corresponding lines) hpt-common/src/utils/pointer.rs:62 — hpt-common/src/utils/pointer.rs:62-70 | hpt-conv/src/lib.rs:58-67 | hpt-matmul/src/lib.rs:65-74 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 14+ corresponding lines) hpt-allocator/src/allocators/cpu.rs:46 — hpt-allocator/src/allocators/cpu.rs:46-60 | hpt-allocator/src/allocators/cpu.rs:65-79 | hpt-allocator/src/allocators/cpu.rs:91-104 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 15+ corresponding lines) hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:495 — hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:495-513 | hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:517-536 | hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:540-554 | hpt-types/src/vectors/arch_simd/sleef/common/dd.rs:621-644 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 13+ corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:266 — hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:266-278 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:281-293 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:296-308 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:316-328 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:331-343 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:351-363 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:366-378 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:381-393 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 8+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/i16x8.rs:36 — hpt-types/src/vectors/arch_simd/_128bit/common/i16x8.rs:36-43 | hpt-types/src/vectors/arch_simd/_256bit/common/i16x16.rs:32-39 | hpt-types/src/vectors/arch_simd/_512bit/common/i16x32.rs:32-39 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 16+ corresponding lines) hpt/src/backends/cuda/tensor_internal/layernorm.rs:29 — hpt/src/backends/cuda/tensor_internal/layernorm.rs:29-44 | hpt/src/backends/cuda/tensor_internal/softmax.rs:27-42 | hpt/src/backends/cuda/utils/unary/unary.rs:20-35 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 4+ corresponding lines) hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:142 — hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:142-145 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:153-156 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:186-189 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx64x4.rs:192-195 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 10+ corresponding lines) hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:93 — hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:93-102 | hpt-types/src/vectors/arch_simd/_128bit/common/u16x8.rs:104-113 | hpt-types/src/vectors/arch_simd/_256bit/common/u16x16.rs:84-93 | hpt-types/src/vectors/arch_simd/_256bit/common/u16x16.rs:95-104 | hpt-types/src/vectors/arch_simd/_512bit/common/u16x32.rs:84-93 | hpt-types/src/vectors/arch_simd/_512bit/common/u16x32.rs:95-104 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 5+ corresponding lines) hpt-iterator/src/par_strided.rs:176 — hpt-iterator/src/par_strided.rs:176-180 | hpt-iterator/src/par_strided.rs:513-517 | hpt-iterator/src/strided.rs:124-128 | hpt-iterator/src/strided.rs:298-302 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) hpt-types/src/cuda_types/convertion.rs:1036 — hpt-types/src/cuda_types/convertion.rs:1036-1041 | hpt-types/src/cuda_types/convertion.rs:1083-1088 | hpt-types/src/cuda_types/convertion.rs:1112-1117 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) hpt-common/src/utils/pointer.rs:265 — hpt-common/src/utils/pointer.rs:265-277 | hpt-common/src/utils/pointer.rs:294-306 | hpt-common/src/utils/pointer.rs:333-345 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (63–71 lines × 2) · ×1
  • Duplicated block (63–71 lines × 2) hpt-dyn/src/ops/tensor/conv2d/utils.rs:313 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:313-375 | hpt-matmul/src/utils.rs:119-189 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt-matmul/src/utils.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/utils.rs:313` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (62–63 lines × 2) · ×1
  • Duplicated block (62–63 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:224 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:224-286 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:365-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (60 lines × 2) · ×1
  • Duplicated block (60 lines × 2) hpt-dyn/src/ops/tensor/normalization/kernels.rs:421 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:421-480 | hpt/src/backends/cpu/kernels/softmax.rs:419-478 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/softmax.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 365 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:421` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (61 lines × 2) · ×1
  • Duplicated block (61 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:221 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:221-281 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:146-206 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (58 lines × 2) · ×1
  • Duplicated block (58 lines × 2) hpt-dyn/src/ops/tensor/normalization/kernels.rs:135 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:135-192 | hpt/src/backends/cpu/kernels/softmax.rs:133-190 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/softmax.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 365 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (55 lines × 2) · ×1
  • Duplicated block (55 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:374 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:374-428 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:299-353 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (54 lines × 2) · ×1
  • Duplicated block (54 lines × 2) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:47 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:47-100 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:54-107 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (48–49 lines × 2) · ×1
  • Duplicated block (48–49 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:816 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:816-864 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:891-938 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (47 lines × 2) · ×1
  • Duplicated block (47 lines × 2) hpt/src/backends/cuda/tensor_internal/softmax.rs:140 — hpt/src/backends/cuda/tensor_internal/softmax.rs:140-186 | hpt/src/backends/cuda/tensor_internal/softmax.rs:205-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/softmax.rs:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (128 lines × 2) · ×1
  • Duplicated block (128 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:429 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:429-556 | hpt/src/backends/cpu/kernels/reduce.rs:432-559 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (45 lines × 2) · ×1
  • Duplicated block (45 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:377 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:377-421 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:623-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:377` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (42 lines × 3) · ×1
  • Duplicated block (42 lines × 3) hpt-matmul/src/matmul.rs:386 — hpt-matmul/src/matmul.rs:386-427 | hpt-matmul/src/matmul.rs:561-602 | hpt-matmul/src/matmul.rs:615-656 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (83 lines × 2) · ×1
  • Duplicated block (83 lines × 2) hpt-dyn/src/ops/tensor/reduce/kernels.rs:177 — hpt-dyn/src/ops/tensor/reduce/kernels.rs:177-259 | hpt/src/backends/cpu/kernels/reduce.rs:179-261 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/kernels.rs` and `hpt/src/backends/cpu/kernels/reduce.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 414 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/kernels.rs:177` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) hpt-dataloader/src/save.rs:232 — hpt-dataloader/src/save.rs:232-272 | hpt-dataloader/src/struct_save/save.rs:256-296 — before extracting anything, compare `hpt-dataloader/src/save.rs` and `hpt-dataloader/src/struct_save/save.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (4–40 lines × 3) · ×1
  • Duplicated block (4–40 lines × 3) hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:76 — hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:76-109 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:157-160 | hpt/src/backends/cpu/kernels/normalization/batch_norm.rs:92-131 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/batch_norm.rs:76` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:230 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:230-267 | hpt/src/backends/cpu/utils/reduce/reduce.rs:559-596 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:230` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (88 lines × 2) · ×1
  • Duplicated block (88 lines × 2) hpt-dyn/src/ops/tensor/reduce/reduce.rs:325 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:325-412 | hpt/src/backends/cpu/utils/reduce/reduce.rs:649-736 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce.rs` and `hpt/src/backends/cpu/utils/reduce/reduce.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 272 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:325` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) hpt-macros/src/normal_out_unary.rs:52 — hpt-macros/src/normal_out_unary.rs:52-88 | hpt-macros/src/simd_normal_unary.rs:51-87 — before extracting anything, compare `hpt-macros/src/normal_out_unary.rs` and `hpt-macros/src/simd_normal_unary.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/normal_out_unary.rs:52` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×1
  • Duplicated block (40 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:95 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:95-134 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:105-144 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (33–34 lines × 4) · ×1
  • Duplicated block (33–34 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:555 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:555-588 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:843-875 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:142-175 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:430-462 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:555` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) hpt-macros/src/float_unary.rs:237 — hpt-macros/src/float_unary.rs:237-270 | hpt-macros/src/float_unary.rs:521-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/float_unary.rs:237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/float_unary.rs:271` calls `cast` and `hpt-macros/src/float_unary.rs:555` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (48 lines × 2) · ×1
  • Duplicated block (48 lines × 2) hpt-dyn/src/ops/tensor/matmul/matmul.rs:89 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:89-136 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:263-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/matmul.rs:89` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (32 lines × 5) · ×1
  • Duplicated block (32 lines × 5) hpt-dyn/src/ops/tensor/unary.rs:261 — hpt-dyn/src/ops/tensor/unary.rs:261-292 | hpt-dyn/src/ops/tensor/unary.rs:327-358 | hpt-dyn/src/ops/tensor/unary.rs:393-424 | hpt-dyn/src/ops/tensor/unary.rs:460-491 | hpt-dyn/src/ops/tensor/unary.rs:530-561 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/unary.rs:261` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/unary.rs:324` calls `empty`, `shape`, `to_dtype` and `hpt-dyn/src/ops/tensor/unary.rs:391` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (32 lines × 3) · ×1
  • Duplicated block (32 lines × 3) hpt-macros/src/type_utils.rs:10 — hpt-macros/src/type_utils.rs:10-41 | hpt-macros/src/type_utils.rs:43-74 | hpt-macros/src/type_utils.rs:76-107 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (31–32 lines × 2) · ×1
  • Duplicated block (31–32 lines × 2) hpt-dyn/src/ops/tensor/normalization/softmax.rs:298 — hpt-dyn/src/ops/tensor/normalization/softmax.rs:298-328 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:335-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/softmax.rs:298` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30 lines × 3) · ×1
  • Duplicated block (30 lines × 3) hpt-macros/src/simd_normal_out.rs:144 — hpt-macros/src/simd_normal_out.rs:144-173 | hpt-macros/src/simd_normal_out.rs:180-209 | hpt-macros/src/simd_normal_out.rs:504-533 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_normal_out.rs:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `lhs_dtype` to `SimdType` in one and `Type` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (21–30 lines × 2) · ×1
  • Duplicated block (21–30 lines × 2) hpt-dyn/src/utils/index_cal.rs:128 — hpt-dyn/src/utils/index_cal.rs:128-148 | hpt-dyn/src/utils/index_cal.rs:155-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (29 lines × 8) · ×1
  • Duplicated block (29 lines × 8) hpt-dyn/src/ops/tensor/normalization/kernels.rs:99 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:99-127 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:385-413 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:510-538 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:798-826 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:97-125 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:385-413 | hpt/src/backends/cpu/kernels/softmax.rs:97-125 | hpt/src/backends/cpu/kernels/softmax.rs:383-411 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29 lines × 4) · ×1
  • Duplicated block (29 lines × 4) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:38 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:38-66 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:147-175 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:38-66 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:54-82 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (105 lines × 2) · ×1
  • Duplicated block (105 lines × 2) hpt-dyn/src/ops/tensor/pooling/template.rs:268 — hpt-dyn/src/ops/tensor/pooling/template.rs:268-372 | hpt/src/backends/cpu/kernels/pooling/common.rs:266-370 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:268` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (1–29 lines × 3) · ×1
  • Duplicated block (1–29 lines × 3) hpt-dyn/src/ops/tensor/rnn/lstm.rs:699 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:699-727 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:736-736 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:802-830 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:699` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) hpt-macros/src/into_cuda_scalar.rs:8 — hpt-macros/src/into_cuda_scalar.rs:8-36 | hpt-macros/src/into_scalar.rs:8-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/into_cuda_scalar.rs:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (184 lines × 2) · ×1
  • Duplicated block (184 lines × 2) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:35 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:35-218 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:35-218 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:35` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–27 lines × 4) · ×1
  • Duplicated block (22–27 lines × 4) hpt-dyn/src/ops/tensor/conv2d/utils.rs:477 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:477-503 | hpt-matmul/src/utils.rs:290-316 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:343-364 | hpt/src/backends/cpu/kernels/matmul/utils.rs:69-90 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt-matmul/src/utils.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/utils.rs:477` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27 lines × 4) · ×1
  • Duplicated block (27 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:268 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:268-294 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:679-705 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:266-292 | hpt/src/backends/cpu/kernels/softmax.rs:266-292 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–27 lines × 2) · ×1
  • Duplicated block (23–27 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_img2col.rs:52 — hpt-dyn/src/ops/tensor/conv2d/conv2d_img2col.rs:52-78 | hpt/src/backends/cpu/kernels/conv2d/conv2d_img2col.rs:54-76 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_img2col.rs:52` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:148 — hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:148-173 | hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs:159-185 — before extracting anything, compare `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs` and `hpt/src/backends/cpu/kernels/matmul/matmul_mp_post.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/matmul_mixed_precision.rs:148` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–26 lines × 4) · ×1
  • Duplicated block (10–26 lines × 4) hpt-dyn/src/ops/tensor/conv2d/utils.rs:427 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:427-452 | hpt-matmul/src/utils.rs:240-265 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:310-319 | hpt/src/backends/cpu/kernels/matmul/utils.rs:30-39 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt-matmul/src/utils.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) hpt-macros/src/normal_out_unary.rs:38 — hpt-macros/src/normal_out_unary.rs:38-62 | hpt-macros/src/normal_out_unary.rs:124-148 | hpt-macros/src/simd_normal_unary.rs:37-61 — before extracting anything, compare `hpt-macros/src/normal_out_unary.rs` and `hpt-macros/src/simd_normal_unary.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/normal_out_unary.rs:63` calls `_trunc`, `__trunc` and `hpt-macros/src/normal_out_unary.rs:149` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (121 lines × 2) · ×1
  • Duplicated block (121 lines × 2) hpt-dyn/src/ops/tensor/pooling/template.rs:93 — hpt-dyn/src/ops/tensor/pooling/template.rs:93-213 | hpt/src/backends/cpu/kernels/pooling/common.rs:93-213 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:93` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–25 lines × 5) · ×1
  • Duplicated block (4–25 lines × 5) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:562 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:562-586 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:612-636 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1067-1070 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1524-1527 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1567-1570 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1527` calls `vmla_vf_vf_vf_vf`, `vcast_vf_f` and `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1070` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (24 lines × 4) · ×1
  • Duplicated block (24 lines × 4) hpt-dataloader/src/save.rs:117 — hpt-dataloader/src/save.rs:117-140 | hpt-dataloader/src/save.rs:154-177 | hpt-dataloader/src/struct_save/save.rs:166-189 | hpt-dataloader/src/struct_save/save.rs:202-225 — before extracting anything, compare `hpt-dataloader/src/save.rs` and `hpt-dataloader/src/struct_save/save.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (63 lines × 2) · ×1
  • Duplicated block (63 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:314 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:314-376 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:205-267 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 251 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:314` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) hpt-iterator/src/shape_manipulate.rs:33 — hpt-iterator/src/shape_manipulate.rs:33-55 | hpt-iterator/src/shape_manipulate.rs:142-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-iterator/src/shape_manipulate.rs:33` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23 lines × 6) · ×1
  • Duplicated block (23 lines × 6) hpt-macros/src/from_scalar.rs:7 — hpt-macros/src/from_scalar.rs:7-29 | hpt-macros/src/normal_out.rs:6-28 | hpt-macros/src/normal_out.rs:138-160 | hpt-macros/src/normal_out_unary.rs:6-28 | hpt-macros/src/normal_out_unary.rs:92-114 | hpt-macros/src/scalar_convert.rs:8-30 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/from_scalar.rs:7` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/normal_out.rs:29` calls `iter` and `hpt-macros/src/normal_out_unary.rs:29` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22–23 lines × 4) · ×1
  • Duplicated block (22–23 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:667 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:667-688 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:710-732 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:254-275 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:297-319 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:667` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/kernels.rs:666` calls `_add` and `hpt-dyn/src/ops/tensor/normalization/kernels.rs:709` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (23 lines × 4) · ×1
  • Duplicated block (23 lines × 4) hpt-macros/src/binary_float_out.rs:6 — hpt-macros/src/binary_float_out.rs:6-28 | hpt-macros/src/binary_float_out.rs:93-115 | hpt-macros/src/float_unary.rs:6-28 | hpt-macros/src/float_unary.rs:328-350 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/binary_float_out.rs:6` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-macros/src/binary_float_out.rs:29` calls `iter` and `hpt-macros/src/float_unary.rs:29` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (23 lines × 3) · ×1
  • Duplicated block (23 lines × 3) hpt-macros/src/into_cuda_scalar.rs:6 — hpt-macros/src/into_cuda_scalar.rs:6-28 | hpt-macros/src/into_scalar.rs:6-28 | hpt-macros/src/simd_normal_unary.rs:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/into_cuda_scalar.rs:6` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×1
  • Duplicated block (22–23 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:272 — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:272-293 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:171-193 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 251 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (29–34 lines × 2) · ×1
  • Duplicated block (29–34 lines × 2) hpt-macros/src/simd_bitwise.rs:9 — hpt-macros/src/simd_bitwise.rs:9-37 | hpt-macros/src/simd_cmp.rs:9-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_bitwise.rs:9` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22 lines × 4) · ×1
  • Duplicated block (22 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:256 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:256-277 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:299-320 | hpt/src/backends/cpu/kernels/softmax.rs:254-275 | hpt/src/backends/cpu/kernels/softmax.rs:297-318 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/softmax.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 365 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/kernels.rs:255` calls `_add` and `hpt-dyn/src/ops/tensor/normalization/kernels.rs:298` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–21 lines × 4) · ×1
  • Duplicated block (19–21 lines × 4) hpt-dyn/src/ops/tensor/normalization/kernels.rs:222 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:222-242 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:632-650 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:219-237 | hpt/src/backends/cpu/kernels/softmax.rs:220-240 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (41 lines × 4) · ×1
  • Duplicated block (41 lines × 4) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:233 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:233-273 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:229-269 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:239-279 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:236-276 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:233` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (14–21 lines × 4) · ×1
  • Duplicated block (14–21 lines × 4) hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:299 — hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:299-312 | hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:445-465 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:224-237 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:370-390 — before extracting anything, compare `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs` and `hpt/src/backends/cpu/utils/reduce/reduce_utils.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:299` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) hpt-codegen/src/fuse/cfg_builder.rs:899 — hpt-codegen/src/fuse/cfg_builder.rs:899-919 | hpt-codegen/src/fuse/cfg_builder.rs:949-969 | hpt-codegen/src/fuse/cfg_builder.rs:999-1019 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:899` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1771 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1771-1791 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1822-1839 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1771` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) hpt/src/backends/cuda/utils/binary/binary_normal.rs:85 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:85-104 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:280-300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 3) · ×1
  • Duplicated block (19–20 lines × 3) hpt/src/backends/cuda/tensor_internal/layernorm.rs:99 — hpt/src/backends/cuda/tensor_internal/layernorm.rs:99-117 | hpt/src/backends/cuda/tensor_internal/layernorm.rs:136-154 | hpt/src/backends/cuda/tensor_internal/layernorm.rs:167-186 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/layernorm.rs:99` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (19 lines × 7) · ×1
  • Duplicated block (19 lines × 7) hpt-conv/src/microkernel_trait.rs:212 — hpt-conv/src/microkernel_trait.rs:212-230 | hpt-conv/src/microkernel_trait.rs:238-256 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:223-241 | hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs:249-267 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:207-225 | hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs:229-247 | hpt/src/backends/cpu/kernels/matmul/microkernel_trait.rs:278-296 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/microkernel_trait.rs` and `hpt/src/backends/cpu/kernels/conv2d/microkernel_trait.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-conv/src/microkernel_trait.rs:212` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 4) · ×1
  • Duplicated block (18–19 lines × 4) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:128 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:128-146 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:201-218 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:135-152 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:207-224 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:200` calls `clone` and `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:127` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–19 lines × 2) · ×1
  • Duplicated block (15–19 lines × 2) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:117 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:117-131 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:118-136 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) hpt/src/backends/cuda/utils/unary/unary.rs:170 — hpt/src/backends/cuda/utils/unary/unary.rs:170-186 | hpt/src/backends/cuda/utils/unary/unary.rs:244-262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/unary/unary.rs:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (37 lines × 4) · ×1
  • Duplicated block (37 lines × 4) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:99 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:99-135 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:96-132 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:103-139 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:102-138 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:99` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:275 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:275-292 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:271-288 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:281-298 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:278-295 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:275` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) hpt-macros/src/simd_float_out_binary.rs:97 — hpt-macros/src/simd_float_out_binary.rs:97-114 | hpt-macros/src/simd_float_out_binary.rs:216-233 | hpt-macros/src/simd_float_out_binary.rs:335-352 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/simd_float_out_binary.rs:97` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `lhs_dtype` to `SimdType` in one and `Type` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) hpt-types/src/dyn_dispatch/scalar.rs:185 — hpt-types/src/dyn_dispatch/scalar.rs:185-200 | hpt-types/src/dyn_dispatch/scalar.rs:232-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/dyn_dispatch/scalar.rs:185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–17 lines × 4) · ×1
  • Duplicated block (13–17 lines × 4) hpt-codegen/src/fuse/cfg_builder.rs:185 — hpt-codegen/src/fuse/cfg_builder.rs:185-201 | hpt-codegen/src/fuse/cfg_builder.rs:329-341 | hpt-codegen/src/fuse/cfg_builder.rs:383-399 | hpt-codegen/src/fuse/cfg_builder.rs:459-475 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:185` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:297 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:297-312 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:352-367 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:305-320 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:362-377 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–16 lines × 4) · ×1
  • Duplicated block (15–16 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:64 — hpt-dyn/src/ops/tensor/pooling/template.rs:64-79 | hpt-dyn/src/ops/tensor/pooling/template.rs:256-271 | hpt/src/backends/cpu/kernels/pooling/common.rs:65-79 | hpt/src/backends/cpu/kernels/pooling/common.rs:255-269 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) hpt-dyn/src/utils/index_cal.rs:338 — hpt-dyn/src/utils/index_cal.rs:338-349 | hpt-dyn/src/utils/index_cal.rs:359-374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–16 lines × 2) · ×1
  • Duplicated block (11–16 lines × 2) hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:65 — hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:65-75 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:101-116 — before extracting anything, compare `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:65` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (15 lines × 8) · ×1
  • Duplicated block (15 lines × 8) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:152 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:152-166 | hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:185-199 | hpt-dyn/src/ops/tensor/pooling/template.rs:142-156 | hpt-dyn/src/ops/tensor/pooling/template.rs:184-198 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:152-166 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:185-199 | hpt/src/backends/cpu/kernels/pooling/common.rs:142-156 | hpt/src/backends/cpu/kernels/pooling/common.rs:184-198 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt-dyn/src/ops/tensor/pooling/template.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:152` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–15 lines × 5) · ×1
  • Duplicated block (13–15 lines × 5) hpt-dyn/src/ops/tensor/matmul/common.rs:38 — hpt-dyn/src/ops/tensor/matmul/common.rs:38-50 | hpt-dyn/src/ops/tensor/matmul/common.rs:77-89 | hpt/src/backends/cpu/kernels/matmul/common.rs:234-248 | hpt/src/backends/cpu/tensor_internal/gemm.rs:79-91 | hpt/src/backends/cpu/tensor_internal/matmul.rs:193-205 — before extracting anything, compare `hpt/src/backends/cpu/tensor_internal/gemm.rs` and `hpt/src/backends/cpu/tensor_internal/matmul.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/common.rs:38` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt/src/backends/cpu/tensor_internal/gemm.rs:94` calls `clone` and `hpt-dyn/src/ops/tensor/matmul/common.rs:53` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–14 lines × 8) · ×1
  • Duplicated block (3–14 lines × 8) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:66 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:66-75 | hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:34-36 | hpt-dyn/src/ops/tensor/conv2d/conv2d_img2col.rs:38-51 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:175-184 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:66-75 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:37-39 | hpt/src/backends/cpu/kernels/conv2d/conv2d_img2col.rs:43-52 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:82-91 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (27–28 lines × 4) · ×1
  • Duplicated block (27–28 lines × 4) hpt-dyn/src/ops/tensor/conv2d/utils.rs:76 — hpt-dyn/src/ops/tensor/conv2d/utils.rs:76-102 | hpt-dyn/src/ops/tensor/conv2d/utils.rs:160-187 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:79-105 | hpt/src/backends/cpu/kernels/conv2d/utils.rs:163-190 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/utils.rs` and `hpt/src/backends/cpu/kernels/conv2d/utils.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/utils.rs:76` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 4) · ×1
  • Duplicated block (14–15 lines × 4) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:990 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:990-1004 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1267-1280 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1880-1893 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1973-1986 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:990` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:60 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:60-72 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:62-75 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:98-110 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) hpt-dyn/src/ops/tensor/rnn/lstm.rs:529 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:529-541 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:610-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:610` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/rnn/lstm.rs:528` calls `strides`, `addmm_prepacked_` and `hpt-dyn/src/ops/tensor/rnn/lstm.rs:610` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–14 lines × 2) · ×1
  • Duplicated block (8–14 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:498 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:498-505 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:515-528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6–13 lines × 4) · ×1
  • Duplicated block (6–13 lines × 4) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:113 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:113-125 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:193-198 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:120-132 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:199-204 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:199` calls `borrow_mut` and `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:126` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 12) · ×1
  • Duplicated block (12 lines × 12) hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:106 — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:106-117 | hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:150-161 | hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:183-194 | hpt-dyn/src/ops/tensor/pooling/template.rs:89-100 | hpt-dyn/src/ops/tensor/pooling/template.rs:140-151 | hpt-dyn/src/ops/tensor/pooling/template.rs:182-193 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:106-117 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:150-161 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:183-194 | hpt/src/backends/cpu/kernels/pooling/common.rs:89-100 | hpt/src/backends/cpu/kernels/pooling/common.rs:140-151 | hpt/src/backends/cpu/kernels/pooling/common.rs:182-193 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs` and `hpt-dyn/src/ops/tensor/pooling/template.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 10) · ×1
  • Duplicated block (12 lines × 10) hpt-dyn/src/ops/tensor/normalization/kernels.rs:44 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:44-55 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:69-80 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:42-53 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:67-78 | hpt/src/backends/cpu/kernels/softmax.rs:42-53 | hpt/src/backends/cpu/kernels/softmax.rs:67-78 | hpt/src/backends/cpu/tensor_internal/gemm.rs:200-211 | hpt/src/backends/cpu/tensor_internal/matmul.rs:382-393 | hpt/src/backends/cpu/tensor_internal/normalization.rs:260-271 | hpt/src/backends/cpu/utils/unary/unary.rs:220-231 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:44` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 9) · ×1
  • Duplicated block (11–12 lines × 9) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:77 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:77-88 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:63-74 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:245-255 | hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:65-75 | hpt-dyn/src/ops/tensor/pooling/template.rs:49-59 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:77-88 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:148-158 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:65-75 | hpt/src/backends/cpu/kernels/pooling/common.rs:53-63 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–12 lines × 8) · ×1
  • Duplicated block (9–12 lines × 8) hpt-dyn/src/ops/tensor/normalization/kernels.rs:152 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:152-163 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:170-178 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:439-450 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:457-465 | hpt/src/backends/cpu/kernels/softmax.rs:150-161 | hpt/src/backends/cpu/kernels/softmax.rs:168-176 | hpt/src/backends/cpu/kernels/softmax.rs:437-448 | hpt/src/backends/cpu/kernels/softmax.rs:455-463 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/softmax.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 365 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/kernels.rs:152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:80 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:80-91 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:42-53 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:43-54 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:84-95 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:38-49 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:40-51 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:80` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) hpt-dyn/src/ops/tensor/matmul/matmul.rs:524 — hpt-dyn/src/ops/tensor/matmul/matmul.rs:524-535 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:574-585 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:654-665 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:728-739 | hpt-dyn/src/ops/tensor/matmul/matmul.rs:787-798 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (21–22 lines × 3) · ×1
  • Duplicated block (21–22 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1139 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1139-1159 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1633-1654 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1718-1739 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1139` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (3–12 lines × 3) · ×1
  • Duplicated block (3–12 lines × 3) hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:109 — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:109-111 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:133-144 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:138-149 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) hpt-dyn/src/ops/tensor/reduce/reduce.rs:447 — hpt-dyn/src/ops/tensor/reduce/reduce.rs:447-457 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:495-505 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:540-550 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:588-598 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:725-735 | hpt-dyn/src/ops/tensor/reduce/reduce.rs:770-780 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/reduce/reduce.rs:447` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) hpt-codegen/src/fuse/cfg_builder.rs:185 — hpt-codegen/src/fuse/cfg_builder.rs:185-195 | hpt-codegen/src/fuse/cfg_builder.rs:241-251 | hpt-codegen/src/fuse/cfg_builder.rs:329-339 | hpt-codegen/src/fuse/cfg_builder.rs:383-393 | hpt-codegen/src/fuse/cfg_builder.rs:459-469 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:185` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) hpt/src/backends/cuda/utils/binary/binary_normal.rs:445 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:445-452 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:489-499 | hpt/src/backends/cuda/utils/unary/unary.rs:230-240 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:445` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–11 lines × 3) · ×1
  • Duplicated block (3–11 lines × 3) hpt-dyn/src/utils/onnx/fwd.rs:136 — hpt-dyn/src/utils/onnx/fwd.rs:136-138 | hpt-dyn/src/utils/onnx/fwd.rs:142-152 | hpt-dyn/src/utils/onnx/fwd.rs:162-172 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/onnx/fwd.rs:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) hpt-macros/src/matmul_microkernels_asm.rs:139 — hpt-macros/src/matmul_microkernels_asm.rs:139-149 | hpt-macros/src/matmul_microkernels_asm.rs:151-161 | hpt-macros/src/matmul_microkernels_asm.rs:162-170 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/matmul_microkernels_asm.rs:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2244 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2244-2252 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2253-2263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 7) · ×1
  • Duplicated block (10 lines × 7) hpt-matmul/src/matmul.rs:318 — hpt-matmul/src/matmul.rs:318-327 | hpt-matmul/src/matmul.rs:335-344 | hpt-matmul/src/matmul.rs:386-395 | hpt-matmul/src/matmul.rs:474-483 | hpt-matmul/src/matmul.rs:497-506 | hpt-matmul/src/matmul.rs:561-570 | hpt-matmul/src/matmul.rs:615-624 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–10 lines × 5) · ×1
  • Duplicated block (9–10 lines × 5) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:131 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:131-140 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:128-137 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:135-144 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:134-143 | hpt/src/backends/cpu/utils/reduce/reduce.rs:546-554 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) hpt-dyn/src/utils/index_cal.rs:271 — hpt-dyn/src/utils/index_cal.rs:271-278 | hpt-dyn/src/utils/index_cal.rs:282-291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/index_cal.rs:282` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1327 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1327-1332 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2249-2258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:2249` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 8) · ×1
  • Duplicated block (9 lines × 8) hpt-dyn/src/ops/tensor/normalization/kernels.rs:229 — hpt-dyn/src/ops/tensor/normalization/kernels.rs:229-237 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:283-291 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:639-647 | hpt-dyn/src/ops/tensor/normalization/kernels.rs:694-702 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:226-234 | hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs:281-289 | hpt/src/backends/cpu/kernels/softmax.rs:227-235 | hpt/src/backends/cpu/kernels/softmax.rs:281-289 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/kernels.rs` and `hpt/src/backends/cpu/kernels/normalization/logsoftmax.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 8) · ×1
  • Duplicated block (8–9 lines × 8) hpt-macros/src/binary_float_out.rs:26 — hpt-macros/src/binary_float_out.rs:26-34 | hpt-macros/src/binary_float_out.rs:113-121 | hpt-macros/src/lib.rs:389-396 | hpt-macros/src/lib.rs:483-490 | hpt-macros/src/lib.rs:578-585 | hpt-macros/src/lib.rs:664-671 | hpt-macros/src/normal_out.rs:26-33 | hpt-macros/src/normal_out.rs:158-165 — there are 8 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/binary_float_out.rs:26` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) hpt-matmul/src/utils.rs:354 — hpt-matmul/src/utils.rs:354-362 | hpt-matmul/src/utils.rs:454-462 | hpt-matmul/src/utils.rs:495-503 | hpt/src/backends/cpu/kernels/matmul/common.rs:118-126 | hpt/src/backends/cpu/kernels/matmul/template.rs:366-374 — before extracting anything, compare `hpt-matmul/src/utils.rs` and `hpt/src/backends/cpu/kernels/matmul/common.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) hpt-dyn/src/utils/index_cal.rs:323 — hpt-dyn/src/utils/index_cal.rs:323-330 | hpt-dyn/src/utils/index_cal.rs:343-351 | hpt-dyn/src/utils/index_cal.rs:368-376 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/utils/index_cal.rs:323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (2–9 lines × 3) · ×1
  • Duplicated block (2–9 lines × 3) hpt-dyn/src/ops/tensor/binary.rs:130 — hpt-dyn/src/ops/tensor/binary.rs:130-138 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:195-203 | hpt/src/backends/cpu/utils/binary/binary_normal.rs:338-339 — before extracting anything, compare `hpt-dyn/src/ops/tensor/binary.rs` and `hpt/src/backends/cpu/utils/binary/binary_normal.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/binary.rs:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–17 lines × 2) · ×1
  • Duplicated block (9–17 lines × 2) hpt-dyn/src/utils/onnx/init.rs:929 — hpt-dyn/src/utils/onnx/init.rs:929-945 | hpt-dyn/src/utils/onnx/init.rs:1301-1309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/utils/onnx/init.rs:927` calls `as_str` and `hpt-dyn/src/utils/onnx/init.rs:1299` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 9) · ×1
  • Duplicated block (8 lines × 9) hpt-codegen/src/fuse/cfg_builder.rs:155 — hpt-codegen/src/fuse/cfg_builder.rs:155-162 | hpt-codegen/src/fuse/cfg_builder.rs:204-211 | hpt-codegen/src/fuse/cfg_builder.rs:295-302 | hpt-codegen/src/fuse/cfg_builder.rs:344-351 | hpt-codegen/src/fuse/cfg_builder.rs:410-417 | hpt-codegen/src/fuse/cfg_builder.rs:506-513 | hpt-codegen/src/fuse/cfg_builder.rs:914-921 | hpt-codegen/src/fuse/cfg_builder.rs:964-971 | hpt-codegen/src/fuse/cfg_builder.rs:1014-1021 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-codegen/src/fuse/cfg_builder.rs:203` calls `visit_block` and `hpt-codegen/src/fuse/cfg_builder.rs:153` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 8) · ×1
  • Duplicated block (12 lines × 8) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:109 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:109-120 | hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:244-255 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:106-117 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:240-251 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:113-124 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:250-261 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:112-123 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:247-258 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:109` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 8) · ×1
  • Duplicated block (8 lines × 8) hpt-macros/src/lib.rs:1183 — hpt-macros/src/lib.rs:1183-1190 | hpt-macros/src/lib.rs:1197-1204 | hpt-macros/src/lib.rs:1221-1228 | hpt-macros/src/lib.rs:1235-1242 | hpt-macros/src/lib.rs:1384-1391 | hpt-macros/src/lib.rs:1398-1405 | hpt-macros/src/lib.rs:1423-1430 | hpt-macros/src/lib.rs:1437-1444 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1183` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) hpt-codegen/src/fuse/cfg_builder.rs:1330 — hpt-codegen/src/fuse/cfg_builder.rs:1330-1337 | hpt-codegen/src/fuse/cfg_builder.rs:1382-1389 | hpt-codegen/src/fuse/cfg_builder.rs:1416-1423 | hpt-codegen/src/fuse/cfg_builder.rs:1448-1455 | hpt-codegen/src/fuse/cfg_builder.rs:1481-1488 | hpt-codegen/src/fuse/cfg_builder.rs:1515-1522 | hpt-codegen/src/fuse/cfg_builder.rs:1677-1684 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/cfg_builder.rs:1330` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:132 — hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:132-140 | hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:205-212 | hpt-dyn/src/ops/tensor/reduce/reduce_utils.rs:305-312 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:139-146 | hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs:211-218 | hpt/src/backends/cpu/utils/reduce/reduce_utils.rs:230-237 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs` and `hpt/src/backends/cpu/kernels/normalization/normalize_utils.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/normalize_utils.rs:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) hpt/src/backends/cuda/tensor_internal/softmax.rs:195 — hpt/src/backends/cuda/tensor_internal/softmax.rs:195-202 | hpt/src/backends/cuda/tensor_internal/softmax.rs:260-267 | hpt/src/backends/cuda/tensor_internal/softmax.rs:371-379 | hpt/src/backends/cuda/tensor_internal/softmax.rs:409-416 | hpt/src/backends/cuda/tensor_internal/softmax.rs:445-452 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/tensor_internal/softmax.rs:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–8 lines × 4) · ×1
  • Duplicated block (6–8 lines × 4) hpt-dyn/src/ops/tensor/pooling/template.rs:198 — hpt-dyn/src/ops/tensor/pooling/template.rs:198-205 | hpt-dyn/src/ops/tensor/pooling/template.rs:359-364 | hpt/src/backends/cpu/kernels/pooling/common.rs:198-205 | hpt/src/backends/cpu/kernels/pooling/common.rs:357-362 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/pooling/common.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 411 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/pooling/template.rs:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–8 lines × 4) · ×1
  • Duplicated block (7–8 lines × 4) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:903 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:903-910 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1144-1150 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1639-1645 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1724-1730 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:903` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–8 lines × 3) · ×1
  • Duplicated block (6–8 lines × 3) hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:191 — hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:191-196 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:469-476 | hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:610-617 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:191` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 9) · ×1
  • Duplicated block (7 lines × 9) hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:80 — hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:80-86 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:261-267 | hpt-dyn/src/ops/tensor/pooling/template.rs:66-72 | hpt-dyn/src/ops/tensor/pooling/template.rs:258-264 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:44-50 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:80-86 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:161-167 | hpt/src/backends/cpu/kernels/pooling/common.rs:66-72 | hpt/src/backends/cpu/kernels/pooling/common.rs:256-262 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) hpt-codegen/src/fuse/fuse.rs:86 — hpt-codegen/src/fuse/fuse.rs:86-92 | hpt-codegen/src/fuse/fuse.rs:178-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-codegen/src/fuse/fuse.rs:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (1–7 lines × 6) · ×1
  • Duplicated block (1–7 lines × 6) hpt-dyn/src/ops/tensor/rnn/lstm.rs:263 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:263-269 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:358-358 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:359-360 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:525-531 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:603-603 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:604-606 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/rnn/lstm.rs:358` calls `shape`, `strides` and `hpt-dyn/src/ops/tensor/rnn/lstm.rs:360` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 8) · ×1
  • Duplicated block (6 lines × 8) hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:44 — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:44-49 | hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs:29-34 | hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:153-158 | hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:34-39 | hpt/src/backends/cpu/kernels/conv2d/conv2d.rs:44-49 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:33-38 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:60-65 | hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs:34-39 — before extracting anything, compare `hpt-dyn/src/ops/tensor/conv2d/conv2d.rs` and `hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) hpt-macros/src/lib.rs:1357 — hpt-macros/src/lib.rs:1357-1362 | hpt-macros/src/simd_float_out_binary.rs:29-34 | hpt-macros/src/simd_float_out_binary.rs:139-144 | hpt-macros/src/simd_float_out_binary.rs:258-263 | hpt-macros/src/simd_normal_out.rs:29-34 | hpt-macros/src/simd_normal_out.rs:234-239 | hpt-macros/src/simd_normal_out.rs:385-390 — there are 7 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) hpt-dyn/src/ops/tensor/matmul/common.rs:46 — hpt-dyn/src/ops/tensor/matmul/common.rs:46-51 | hpt-dyn/src/ops/tensor/matmul/common.rs:85-90 | hpt/src/backends/cpu/kernels/matmul/common.rs:242-248 | hpt/src/backends/cpu/tensor_internal/gemm.rs:87-92 | hpt/src/backends/cpu/tensor_internal/matmul.rs:201-206 | hpt/src/backends/cuda/tensor_internal/matmul.rs:212-217 — before extracting anything, compare `hpt/src/backends/cpu/tensor_internal/gemm.rs` and `hpt/src/backends/cpu/tensor_internal/matmul.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/common.rs:46` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt/src/backends/cpu/tensor_internal/gemm.rs:94` calls `clone` and `hpt-dyn/src/ops/tensor/matmul/common.rs:53` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 6) · ×1
  • Duplicated block (9 lines × 6) hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:108 — hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:108-116 | hpt-types/src/vectors/arch_simd/_256bit/avx2/f16x16.rs:71-79 | hpt-types/src/vectors/arch_simd/_512bit/avx512/f16x32.rs:70-78 | matconv_simd/src/simd/_128bit/sse/f16x8.rs:112-120 | matconv_simd/src/simd/_256bit/avx2/f16x16.rs:67-75 | matconv_simd/src/simd/_512bit/avx512/f16x32.rs:69-77 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs` and `matconv_simd/src/simd/_128bit/sse/f16x8.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/sse/f16x8.rs:108` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (2–6 lines × 8) · ×1
  • Duplicated block (2–6 lines × 8) hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:57 — hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:57-62 | hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:189-194 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:53-54 | hpt-dyn/src/ops/tensor/normalization/softmax.rs:185-186 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:61-66 | hpt/src/backends/cpu/kernels/normalization/log_softmax.rs:194-199 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:59-60 | hpt/src/backends/cpu/kernels/normalization/softmax.rs:192-193 — before extracting anything, compare `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/normalization/logsoftmax.rs:57` calls `reduce`, `_max` and `hpt-dyn/src/ops/tensor/normalization/softmax.rs:53` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–6 lines × 6) · ×1
  • Duplicated block (4–6 lines × 6) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:455 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:455-460 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:415-420 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:450-455 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:494-497 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:433-438 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:510-513 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:455` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (2–6 lines × 4) · ×1
  • Duplicated block (2–6 lines × 4) hpt-dyn/src/ops/tensor/rnn/lstm.rs:254 — hpt-dyn/src/ops/tensor/rnn/lstm.rs:254-259 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:352-357 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:520-523 | hpt-dyn/src/ops/tensor/rnn/lstm.rs:601-602 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/rnn/lstm.rs:520` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-dyn/src/ops/tensor/rnn/lstm.rs:358` calls `shape`, `strides` and `hpt-dyn/src/ops/tensor/rnn/lstm.rs:260` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–6 lines × 4) · ×1
  • Duplicated block (3–6 lines × 4) hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:27 — hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:27-29 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:28-33 | matconv_simd/src/simd/_256bit/common/bf16x16.rs:14-16 | matconv_simd/src/simd/_256bit/common/f16x16.rs:16-21 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs` and `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:28` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `matconv_simd/src/simd/_256bit/common/f16x16.rs:16` calls `mul_add` and `hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:27` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–6 lines × 3) · ×1
  • Duplicated block (3–6 lines × 3) hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:25 — hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:25-27 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:28-33 | matconv_simd/src/simd/_512bit/common/f16x32.rs:17-22 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:28` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:28` calls `mul_add` and `hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:25` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 7) · ×1
  • Duplicated block (5 lines × 7) hpt-dyn/src/ops/tensor/pooling/template.rs:70 — hpt-dyn/src/ops/tensor/pooling/template.rs:70-74 | hpt-dyn/src/ops/tensor/pooling/template.rs:262-266 | hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs:52-56 | hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs:88-92 | hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs:169-173 | hpt/src/backends/cpu/kernels/pooling/common.rs:70-74 | hpt/src/backends/cpu/kernels/pooling/common.rs:260-264 — before extracting anything, compare `hpt-dyn/src/ops/tensor/pooling/template.rs` and `hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (2–5 lines × 6) · ×1
  • Duplicated block (2–5 lines × 6) hpt/src/backends/cpu/kernels/matmul/microkernels.rs:198 — hpt/src/backends/cpu/kernels/matmul/microkernels.rs:198-202 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:223-227 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:230-234 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:236-237 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:240-244 | hpt/src/backends/cpu/kernels/matmul/microkernels.rs:246-247 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cpu/kernels/matmul/microkernels.rs:198` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt/src/backends/cpu/kernels/matmul/microkernels.rs:238` calls `add`, `vld1q_f32`, `transmute` and `hpt/src/backends/cpu/kernels/matmul/microkernels.rs:203` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (2–5 lines × 5) · ×1
  • Duplicated block (2–5 lines × 5) hpt-matmul/src/microkernels.rs:218 — hpt-matmul/src/microkernels.rs:218-222 | hpt-matmul/src/microkernels.rs:225-229 | hpt-matmul/src/microkernels.rs:232-236 | hpt-matmul/src/microkernels.rs:239-240 | hpt-matmul/src/microkernels.rs:249-250 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-matmul/src/microkernels.rs:218` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–5 lines × 4) · ×1
  • Duplicated block (3–5 lines × 4) hpt-dyn/src/ops/tensor/matmul/common.rs:54 — hpt-dyn/src/ops/tensor/matmul/common.rs:54-58 | hpt-dyn/src/ops/tensor/matmul/common.rs:91-93 | hpt/src/backends/cpu/kernels/matmul/common.rs:251-255 | hpt/src/backends/cuda/tensor_internal/matmul.rs:218-221 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/matmul/common.rs:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-dyn/src/ops/tensor/matmul/common.rs:53` calls `push` and `hpt-dyn/src/ops/tensor/matmul/common.rs:91` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (1–5 lines × 5) · ×1
  • Duplicated block (1–5 lines × 5) hpt-macros/src/lib.rs:1175 — hpt-macros/src/lib.rs:1175-1178 | hpt-macros/src/lib.rs:1212-1216 | hpt-macros/src/lib.rs:1377-1379 | hpt-macros/src/lib.rs:1414-1418 | hpt-macros/src/lib.rs:1478-1478 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-macros/src/lib.rs:1175` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-macros/src/lib.rs:1174` calls `to_dtype_enum` and `hpt-macros/src/lib.rs:1212` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) hpt/src/backends/cuda/utils/unary/unary.rs:51 — hpt/src/backends/cuda/utils/unary/unary.rs:51-54 | hpt/src/backends/cuda/utils/unary/unary.rs:144-148 | hpt/src/backends/cuda/utils/unary/unary.rs:222-226 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/unary/unary.rs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt/src/backends/cuda/utils/unary/unary.rs:143` calls `check_size_match`, `size`, `borrow_mut` and `hpt/src/backends/cuda/utils/unary/unary.rs:51` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (38 lines × 5) · ×1
  • Duplicated block (38 lines × 5) hpt-types/src/vectors/arch_simd/_128bit/common/i32x4.rs:24 — hpt-types/src/vectors/arch_simd/_128bit/common/i32x4.rs:24-61 | hpt-types/src/vectors/arch_simd/_256bit/common/i32x8.rs:20-57 | hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs:21-120 | hpt-types/src/vectors/arch_simd/_512bit/common/i32x16.rs:20-57 | hpt-types/src/vectors/arch_simd/_512bit/common/i64x8.rs:21-120 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/i32x8.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/i32x16.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs:21` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (100 lines × 2) · ×1
  • Duplicated block (100 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs:21 — hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs:21-120 | hpt-types/src/vectors/arch_simd/_512bit/common/i64x8.rs:21-120 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/i64x8.rs` as WHOLE FILES: 90% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/i64x4.rs:21` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (53 lines × 2) · ×1
  • Duplicated block (53 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/i8x32.rs:24 — hpt-types/src/vectors/arch_simd/_256bit/common/i8x32.rs:24-76 | hpt-types/src/vectors/arch_simd/_512bit/common/i8x64.rs:24-76 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/i8x32.rs:24` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (144 lines × 2) · ×1
  • Duplicated block (144 lines × 2) hpt-types/src/vectors/arch_simd/_256bit/common/usizex4.rs:225 — hpt-types/src/vectors/arch_simd/_256bit/common/usizex4.rs:225-368 | hpt-types/src/vectors/arch_simd/_512bit/common/usizex8.rs:225-368 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_256bit/common/usizex4.rs` and `hpt-types/src/vectors/arch_simd/_512bit/common/usizex8.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/usizex4.rs:225` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (2–38 lines × 8) · ×1
  • Duplicated block (2–38 lines × 8) hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs:24 — hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs:24-341 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:25-26 | hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs:27-30 | matconv_simd/src/simd/_256bit/common/cplx32x4.rs:11-48 | matconv_simd/src/simd/_512bit/common/cplx32x8.rs:14-15 | matconv_simd/src/simd/_512bit/common/cplx32x8.rs:20-23 | matconv_simd/src/simd/_512bit/common/cplx64x4.rs:14-15 | matconv_simd/src/simd/_512bit/common/cplx64x4.rs:16-19 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_512bit/common/cplx32x8.rs` and `matconv_simd/src/simd/_512bit/common/cplx32x8.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 332 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-types/src/vectors/arch_simd/_256bit/common/cplx32x4.rs:24` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `mut` in one and `crate) fn mul_add(mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (5 lines × 18) · ×1
  • Duplicated block (5 lines × 18) hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:29 — hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:29-33 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:35-39 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:41-45 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:47-51 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:53-57 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:59-63 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:68-72 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:74-78 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:80-84 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:86-90 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:92-96 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:98-102 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:84-88 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:90-94 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:96-100 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:102-106 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:108-112 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:114-118 — there are 18 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 18 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) hpt/src/backends/cuda/utils/binary/binary_normal.rs:70 — hpt/src/backends/cuda/utils/binary/binary_normal.rs:70-91 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:169-190 | hpt/src/backends/cuda/utils/binary/binary_normal.rs:265-286 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt/src/backends/cuda/utils/binary/binary_normal.rs:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 9) · ×1
  • Duplicated block (11 lines × 9) hpt-dyn/src/ops/tensor/random.rs:89 — hpt-dyn/src/ops/tensor/random.rs:89-99 | hpt-dyn/src/ops/tensor/random.rs:144-154 | hpt-dyn/src/ops/tensor/random.rs:199-209 | hpt-dyn/src/ops/tensor/random.rs:364-374 | hpt-dyn/src/ops/tensor/random.rs:426-436 | hpt-dyn/src/ops/tensor/random.rs:481-491 | hpt-dyn/src/ops/tensor/random.rs:599-609 | hpt-dyn/src/ops/tensor/random.rs:716-726 | hpt-dyn/src/ops/tensor/random.rs:777-787 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-dyn/src/ops/tensor/random.rs:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:594 — hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs:594-598 | hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs:554-558 | hpt-types/src/vectors/arch_simd/_256bit/common/bf16x16.rs:601-605 | hpt-types/src/vectors/arch_simd/_256bit/common/f16x16.rs:654-658 | hpt-types/src/vectors/arch_simd/_512bit/common/bf16x32.rs:584-588 | hpt-types/src/vectors/arch_simd/_512bit/common/f16x32.rs:670-674 — before extracting anything, compare `hpt-types/src/vectors/arch_simd/_128bit/common/bf16x8.rs` and `hpt-types/src/vectors/arch_simd/_128bit/common/f16x8.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Near-duplicate member family (8 members, 11 shared lines) · ×1
  • Near-duplicate member family (8 members, 11 shared lines) hpt-tests/src/hpt/cpu/bn_conv2d.rs:60 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:60-94 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:102-136 | hpt-tests/src/hpt/cpu/conv2d.rs:65-84 | hpt-tests/src/hpt/cpu/conv2d.rs:92-111 | hpt-tests/src/hpt/cpu/conv2d_group.rs:79-106 | hpt-tests/src/hpt/cpu/conv2d_group.rs:115-142 | hpt-tests/src/hpt/cpu/dwconv2d.rs:71-97 | hpt-tests/src/hpt/cpu/dwconv2d.rs:106-132 — These 8 members are variants of one another: a block of 11 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 8 shared lines) · ×1
  • Near-duplicate member family (5 members, 8 shared lines) hpt-tests/src/hpt/cpu/bn_conv2d.rs:60 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:60-94 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:102-136 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:144-180 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:188-224 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:232-268 — These 5 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 23 shared lines) · ×1
  • Near-duplicate member family (4 members, 23 shared lines) hpt-tests/src/hpt/cuda/bn_conv2d.rs:49 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:49-89 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:97-137 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:145-187 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:195-237 — These 4 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 12 shared lines) · ×1
  • Near-duplicate member family (4 members, 12 shared lines) hpt-tests/src/hpt/cuda/conv2d.rs:104 — hpt-tests/src/hpt/cuda/conv2d.rs:104-132 | hpt-tests/src/hpt/cuda/conv2d.rs:140-168 | hpt-tests/src/hpt/cuda/dwconv2d.rs:129-158 | hpt-tests/src/hpt/cuda/dwconv2d.rs:167-193 — These 4 members are variants of one another: a block of 12 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (56 corresponding lines) · ×1
  • Edited copy of a member (56 corresponding lines) hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:4 — hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:4-71 | hpt-tests/src/macro_tests/control_flows/mix.rs:4-59 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) hpt-tests/src/hpt/cpu/conv2d_group.rs:151 — hpt-tests/src/hpt/cpu/conv2d_group.rs:151-177 | hpt-tests/src/hpt/cpu/conv2d_group.rs:186-212 | hpt-tests/src/hpt/cpu/conv2d_group.rs:221-247 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 16+ corresponding lines) hpt-tests/src/hpt/cuda/conv2d.rs:58 — hpt-tests/src/hpt/cuda/conv2d.rs:58-73 | hpt-tests/src/hpt/cuda/conv2d.rs:81-96 | hpt-tests/src/hpt/cuda/conv2d_group.rs:67-89 | hpt-tests/src/hpt/cuda/conv2d_group.rs:98-120 | hpt-tests/src/hpt/cuda/dwconv2d.rs:63-87 | hpt-tests/src/hpt/cuda/dwconv2d.rs:96-120 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 27+ corresponding lines) hpt-tests/src/hpt/cpu/conv2d.rs:30 — hpt-tests/src/hpt/cpu/conv2d.rs:30-57 | hpt-tests/src/hpt/cpu/conv2d_group.rs:33-70 | hpt-tests/src/hpt/cpu/conv2d_transpose.rs:26-59 | hpt-tests/src/hpt/cuda/conv2d.rs:24-50 | hpt-tests/src/hpt/cuda/conv2d_group.rs:21-58 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) hpt-tests/src/hpt/cpu/dwconv2d.rs:28 — hpt-tests/src/hpt/cpu/dwconv2d.rs:28-62 | hpt-tests/src/hpt/cpu/maxpool.rs:26-45 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:20-41 | hpt-tests/src/hpt/cuda/dwconv2d.rs:20-54 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 8+ corresponding lines) hpt-tests/src/hpt/cpu/binary.rs:31 — hpt-tests/src/hpt/cpu/binary.rs:31-39 | hpt-tests/src/hpt/cpu/binary.rs:42-50 | hpt-tests/src/hpt/cpu/binary_out.rs:53-60 | hpt-tests/src/hpt/cpu/binary_out.rs:63-70 | hpt-tests/src/hpt/cuda/binary.rs:31-40 | hpt-tests/src/hpt/cuda/binary.rs:43-52 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 5+ corresponding lines) hpt-tests/src/hpt/cpu/reduce.rs:57 — hpt-tests/src/hpt/cpu/reduce.rs:57-61 | hpt-tests/src/hpt/cpu/softmax.rs:25-29 | hpt-tests/src/hpt/cuda/normalization.rs:27-31 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:30 — hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:30-46 | hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:51-70 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/macro_tests/control_flows/mix.expanded.rs:30` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) hpt-tests/src/hpt/cpu/conv2d_group.rs:152 — hpt-tests/src/hpt/cpu/conv2d_group.rs:152-170 | hpt-tests/src/hpt/cpu/conv2d_group.rs:187-205 | hpt-tests/src/hpt/cpu/conv2d_group.rs:222-240 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (3–16 lines × 3) · ×1
  • Duplicated block (3–16 lines × 3) hpt-tests/src/hpt/cuda/conv2d_group.rs:133 — hpt-tests/src/hpt/cuda/conv2d_group.rs:133-135 | hpt-tests/src/hpt/cuda/conv2d_group.rs:170-185 | hpt-tests/src/hpt/cuda/conv2d_group.rs:208-223 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/conv2d_group.rs:133` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-tests/src/hpt/cuda/conv2d_group.rs:170` calls `size` and `hpt-tests/src/hpt/cuda/conv2d_group.rs:133` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–13 lines × 6) · ×1
  • Duplicated block (8–13 lines × 6) hpt-tests/src/hpt/cpu/bn_conv2d.rs:79 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:79-86 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:121-128 | hpt-tests/src/hpt/cpu/conv2d.rs:70-77 | hpt-tests/src/hpt/cpu/conv2d.rs:97-104 | hpt-tests/src/hpt/cpu/dwconv2d.rs:76-88 | hpt-tests/src/hpt/cpu/dwconv2d.rs:111-123 — before extracting anything, compare `hpt-tests/src/hpt/cpu/bn_conv2d.rs` and `hpt-tests/src/hpt/cpu/conv2d.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/bn_conv2d.rs:79` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hpt-tests/src/hpt/cpu/bn_conv2d.rs:88` calls `sqrt` and `hpt-tests/src/hpt/cpu/conv2d.rs:79` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–12 lines × 13) · ×1
  • Duplicated block (3–12 lines × 13) hpt-tests/src/hpt/cuda/conv2d.rs:66 — hpt-tests/src/hpt/cuda/conv2d.rs:66-68 | hpt-tests/src/hpt/cuda/conv2d.rs:89-91 | hpt-tests/src/hpt/cuda/conv2d.rs:125-127 | hpt-tests/src/hpt/cuda/conv2d.rs:161-163 | hpt-tests/src/hpt/cuda/conv2d_group.rs:73-84 | hpt-tests/src/hpt/cuda/conv2d_group.rs:104-115 | hpt-tests/src/hpt/cuda/conv2d_group.rs:151-153 | hpt-tests/src/hpt/cuda/conv2d_group.rs:189-191 | hpt-tests/src/hpt/cuda/conv2d_group.rs:227-229 | hpt-tests/src/hpt/cuda/dwconv2d.rs:69-80 | hpt-tests/src/hpt/cuda/dwconv2d.rs:102-113 | hpt-tests/src/hpt/cuda/dwconv2d.rs:149-151 | hpt-tests/src/hpt/cuda/dwconv2d.rs:184-186 — before extracting anything, compare `hpt-tests/src/hpt/cuda/conv2d.rs` and `hpt-tests/src/hpt/cuda/conv2d_group.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/conv2d_group.rs:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-tests/src/hpt/cuda/conv2d.rs:65` calls `conv2d` and `hpt-tests/src/hpt/cuda/conv2d_group.rs:73` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 8) · ×1
  • Duplicated block (10 lines × 8) hpt-tests/src/hpt/cpu/conv2d_group.rs:91 — hpt-tests/src/hpt/cpu/conv2d_group.rs:91-100 | hpt-tests/src/hpt/cpu/conv2d_group.rs:127-136 | hpt-tests/src/hpt/cpu/dwconv2d.rs:82-91 | hpt-tests/src/hpt/cpu/dwconv2d.rs:117-126 | hpt-tests/src/hpt/cuda/conv2d_group.rs:72-81 | hpt-tests/src/hpt/cuda/conv2d_group.rs:103-112 | hpt-tests/src/hpt/cuda/dwconv2d.rs:68-77 | hpt-tests/src/hpt/cuda/dwconv2d.rs:101-110 — before extracting anything, compare `hpt-tests/src/hpt/cpu/conv2d_group.rs` and `hpt-tests/src/hpt/cpu/dwconv2d.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/conv2d_group.rs:91` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (2–10 lines × 7) · ×1
  • Duplicated block (2–10 lines × 7) hpt-tests/src/hpt/cpu/bn_conv2d.rs:67 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:67-76 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:109-118 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:150-151 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:152-161 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:194-195 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:196-205 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:238-239 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/bn_conv2d.rs:67` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-tests/src/hpt/cpu/bn_conv2d.rs:66` calls `arange` and `hpt-tests/src/hpt/cpu/bn_conv2d.rs:149` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) hpt-tests/src/hpt/cuda/reduce.rs:64 — hpt-tests/src/hpt/cuda/reduce.rs:64-79 | hpt-tests/src/hpt/cuda/reduce.rs:99-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/reduce.rs:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (2–9 lines × 6) · ×1
  • Duplicated block (2–9 lines × 6) hpt-tests/src/hpt/cuda/bn_conv2d.rs:62 — hpt-tests/src/hpt/cuda/bn_conv2d.rs:62-70 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:110-118 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:157-158 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:159-167 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:207-208 | hpt-tests/src/hpt/cuda/bn_conv2d.rs:209-217 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/bn_conv2d.rs:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-tests/src/hpt/cuda/bn_conv2d.rs:60` calls `arange` and `hpt-tests/src/hpt/cuda/bn_conv2d.rs:155` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (1–9 lines × 5) · ×1
  • Duplicated block (1–9 lines × 5) hpt-tests/src/hpt/cpu/bn_conv2d.rs:164 — hpt-tests/src/hpt/cpu/bn_conv2d.rs:164-172 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:208-216 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:260-260 | hpt-tests/src/hpt/cpu/dwconv2d.rs:180-188 | hpt-tests/src/hpt/cpu/dwconv2d.rs:218-219 — before extracting anything, compare `hpt-tests/src/hpt/cpu/bn_conv2d.rs` and `hpt-tests/src/hpt/cpu/dwconv2d.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/bn_conv2d.rs:164` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) hpt-tests/src/hpt/cuda/reduce.rs:29 — hpt-tests/src/hpt/cuda/reduce.rs:29-37 | hpt-tests/src/hpt/cuda/reduce.rs:44-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/reduce.rs:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `a` to `&hpt::Tensor<i64, Cuda>` in one and `&hpt::Tensor<bool, Cuda>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (6 lines × 25) · ×1
  • Duplicated block (6 lines × 25) hpt-tests/src/hpt/cpu/adaptive_avg_pool.rs:38 — hpt-tests/src/hpt/cpu/adaptive_avg_pool.rs:38-43 | hpt-tests/src/hpt/cpu/adaptive_max_pool.rs:37-42 | hpt-tests/src/hpt/cpu/avg_pool.rs:57-62 | hpt-tests/src/hpt/cpu/avg_pool.rs:76-81 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:89-94 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:131-136 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:175-180 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:219-224 | hpt-tests/src/hpt/cpu/bn_conv2d.rs:263-268 | hpt-tests/src/hpt/cpu/conv2d.rs:79-84 | hpt-tests/src/hpt/cpu/conv2d.rs:106-111 | hpt-tests/src/hpt/cpu/conv2d.rs:139-144 | hpt-tests/src/hpt/cpu/conv2d.rs:172-177 | hpt-tests/src/hpt/cpu/conv2d.rs:207-212 | hpt-tests/src/hpt/cpu/conv2d_group.rs:101-106 | hpt-tests/src/hpt/cpu/conv2d_group.rs:137-142 | hpt-tests/src/hpt/cpu/conv2d_group.rs:172-177 | hpt-tests/src/hpt/cpu/conv2d_group.rs:207-212 | hpt-tests/src/hpt/cpu/conv2d_group.rs:242-247 | hpt-tests/src/hpt/cpu/dwconv2d.rs:92-97 | hpt-tests/src/hpt/cpu/dwconv2d.rs:127-132 | hpt-tests/src/hpt/cpu/dwconv2d.rs:160-165 | hpt-tests/src/hpt/cpu/dwconv2d.rs:190-195 | hpt-tests/src/hpt/cpu/dwconv2d.rs:222-227 | hpt-tests/src/hpt/cuda/binary.rs:23-28 — before extracting anything, compare `hpt-tests/src/hpt/cpu/bn_conv2d.rs` and `hpt-tests/src/hpt/cpu/conv2d.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cpu/adaptive_avg_pool.rs:38` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hpt-tests/src/hpt/cpu/bn_conv2d.rs:88` calls `sqrt` and `hpt-tests/src/hpt/cpu/conv2d.rs:78` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) hpt-tests/src/hpt/cuda/conv2d.rs:68 — hpt-tests/src/hpt/cuda/conv2d.rs:68-73 | hpt-tests/src/hpt/cuda/conv2d.rs:91-96 | hpt-tests/src/hpt/cuda/conv2d.rs:127-132 | hpt-tests/src/hpt/cuda/conv2d.rs:163-168 | hpt-tests/src/hpt/cuda/conv2d_group.rs:84-89 | hpt-tests/src/hpt/cuda/conv2d_group.rs:115-120 | hpt-tests/src/hpt/cuda/conv2d_group.rs:153-158 | hpt-tests/src/hpt/cuda/conv2d_group.rs:191-196 | hpt-tests/src/hpt/cuda/conv2d_group.rs:229-234 — before extracting anything, compare `hpt-tests/src/hpt/cuda/conv2d.rs` and `hpt-tests/src/hpt/cuda/conv2d_group.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hpt-tests/src/hpt/cuda/conv2d.rs:68` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: matconv_simd — matconv_simd: abstractness 0.06, instability 0.00, distance 0.94 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
SC1 · Supply-chain hygiene · JavaScript dependencies are not locked · ×1
  • JavaScript dependencies are not locked package.json:13 — package.json declares dependencies that no committed lockfile resolves — there is no package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Minor — 523 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×493
  • Orphaned file hpt-dyn/src/ops/tensor/reduce/reduce.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt/src/backends/cpu/std_ops.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimddp.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/utils/onnx/operators.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-codegen/src/fuse/cfg_builder.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-types/src/vectors/arch_simd/sleef/libm/sleefsimdsp.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-tests/src/hpt/cuda/reduce.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt/src/backends/cpu/kernels/matmul/microkernels.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-matmul/src/microkernels.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-macros/src/lib.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/ops/tensor/unary.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt/src/backends/cpu/tensor_external/float_out_unary.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/utils/onnx/init.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-types/src/cuda_types/convertion.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-codegen/src/fuse/cfg.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/ops/tensor/binary.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt/src/backends/cpu/kernels/conv2d/conv2d_micro_kernels.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/ops/tensor/conv2d/conv2d_micro_kernels.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-conv/src/microkernels.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-codegen/src/fuse/build_graph.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-common/src/shape/shape_utils.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/ops/tensor/random.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/ops/tensor/rnn/lstm.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt-dyn/src/ops/tensor/matmul/matmul.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file hpt/src/backends/cpu/tensor_internal/advance.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 468 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×17
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/conv2d.rs:33 — `!input.is_contiguous() || input.parent.is_some()` appears character-identically in 2 files — hpt-dyn/src/ops/tensor/conv2d/conv2d.rs, hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/utils.rs:329 — `(cache.cache_type() == CacheType::Data || cache.cache_type() == CacheType::Unified) && cache.level() <= 3` appears character-identically in 2 files — hpt-dyn/src/ops/tensor/conv2d/utils.rs, hpt-matmul/src/utils.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-matmul/src/matmul.rs:34 — `(lhs_col_stride == 1 && n > 128 * nr) || lhs_col_stride != 1` appears character-identically in 3 files — hpt-matmul/src/matmul.rs, hpt/src/backends/cpu/kernels/matmul/matmul.rs, hpt/src/backends/cpu/kernels/matmul/matmul_post.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:107 — `h * step_height + kh * dh < ph_start || h * step_height + kh * dh - ph_start >= img_height` appears character-identically in 4 files — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs, hpt-dyn/src/ops/tensor/pooling/template.rs, hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs, hpt/src/backends/cpu/kernels/pooling/common.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/utils.rs:45 — `in_y >= 0 && in_y < in_height && in_x >= 0 && in_x < in_width` appears character-identically in 2 files — hpt-dyn/src/ops/tensor/conv2d/utils.rs, hpt/src/backends/cpu/kernels/conv2d/utils.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/reduce/reduce.rs:449 — `inp.is_contiguous() && inp.parent.is_none()` appears character-identically in 2 files — hpt-dyn/src/ops/tensor/reduce/reduce.rs, hpt-dyn/src/utils/onnx/fwd.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/matmul/common.rs:25 — `lhs.shape().len() == 2 && rhs.shape().len() == 2` appears character-identically in 5 files — hpt-dyn/src/ops/tensor/matmul/common.rs, hpt/src/backends/cpu/kernels/matmul/common.rs, hpt/src/backends/cpu/tensor_internal/gemm.rs, hpt/src/backends/cpu/tensor_internal/matmul.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/shape_manipulate.rs:424 — `offset < 0 || offset >= (self.data.len as i64)` appears character-identically in 2 files — hpt-dyn/src/ops/tensor/shape_manipulate.rs, hpt/src/backends/common/slice.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-conv/src/lib.rs:73 — `offset < 0 || offset >= (self.len as i64)` appears character-identically in 2 files — hpt-conv/src/lib.rs, hpt-matmul/src/lib.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs:94 — `ph_start != 0 || pw_start != 0 || ph_end != 0 || pw_end != 0` appears character-identically in 4 files — hpt-dyn/src/ops/tensor/conv2d/conv2d_direct.rs, hpt-dyn/src/ops/tensor/conv2d/conv2d_group.rs, hpt/src/backends/cpu/kernels/conv2d/conv2d_direct.rs, hpt/src/backends/cpu/kernels/conv2d/conv2d_group.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs:316 — `ph_start == 0 && pw_start == 0 && ph_end == 0 && pw_end == 0` appears character-identically in 2 files — hpt-dyn/src/ops/tensor/conv2d/conv2d_mp.rs, hpt/src/backends/cpu/kernels/conv2d/conv2d_new_mp.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/binary.rs:137 — `rhs.is_contiguous() && lhs.is_contiguous() && rhs.shape() == lhs.shape()` appears character-identically in 3 files — hpt-dyn/src/ops/tensor/binary.rs, hpt/src/backends/cpu/utils/binary/binary_normal.rs, hpt/src/backends/cuda/utils/binary/binary_normal.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-iterator/src/par_strided_zip.rs:134 — `self.a.all_last_stride_one() && self.b.all_last_stride_one()` appears character-identically in 2 files — hpt-iterator/src/par_strided_zip.rs, hpt-iterator/src/strided_zip.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt/src/backends/cpu/tensor_impls.rs:305 — `self.is_contiguous() && self.parent().is_none()` appears character-identically in 2 files — hpt/src/backends/cpu/tensor_impls.rs, hpt/src/backends/cuda/tensor_internal/normalization.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-types/src/vectors/arch_simd/_128bit/neon/i64x2.rs:22 — `vgetq_lane_u64(cmp, 0) == 0xffffffffffffffff && vgetq_lane_u64(cmp, 1) == 0xffffffffffffffff` appears character-identically in 2 files — hpt-types/src/vectors/arch_simd/_128bit/neon/i64x2.rs, hpt-types/src/vectors/arch_simd/_128bit/neon/u64x2.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-types/src/vectors/arch_simd/_128bit/neon/i8x16.rs:14 — `vmaxvq_u8(cmp) == 0xff && vminvq_u8(cmp) == 0xff` appears character-identically in 2 files — hpt-types/src/vectors/arch_simd/_128bit/neon/i8x16.rs, hpt-types/src/vectors/arch_simd/_128bit/neon/u8x16.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs:113 — `w * step_width + kw * dw < pw_start || w * step_width + kw * dw - pw_start >= img_width` appears character-identically in 4 files — hpt-dyn/src/ops/tensor/conv2d/dwconv2d.rs, hpt-dyn/src/ops/tensor/pooling/template.rs, hpt/src/backends/cpu/kernels/conv2d/dwconv2d.rs, hpt/src/backends/cpu/kernels/pooling/common.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×3
  • Projects may be oversized for their cohesion hpt-types/Cargo.toml:1 — `hpt-types` (55042 LoC, 104 module-visible types across 14 directories) overshoots its size bounds. 3 of 17 build unit(s) (Cargo, npm) overshoot their size bounds, lowering Project Cohesion to 6.5/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion hpt/Cargo.toml:1 — `hpt` (39018 LoC, 59 module-visible types across 17 directories) overshoots its size bounds. 3 of 17 build unit(s) (Cargo, npm) overshoot their size bounds, lowering Project Cohesion to 6.5/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion hpt-dyn/Cargo.toml:1 — `hpt-dyn` (20870 LoC, 47 module-visible types across 12 directories) overshoots its size bounds. 3 of 17 build unit(s) (Cargo, npm) overshoot their size bounds, lowering Project Cohesion to 6.5/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Most significant orphaned file · ×3
  • Most significant orphaned file hpt-types/src/vectors/arch_simd/sleef/table.rs:1 — One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
  • Most significant orphaned file hpt-tests/src/hpt_types/tests.rs:1 — One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
  • Most significant orphaned file hpt/src/backends/cuda/std_ops.rs:1 — One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found Cargo.toml:121 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `Cargo.toml` makes this repository a deployable product (line 121).
D34 · Knowledge Freshness · Dormant codebase · ×1
  • Dormant codebase — 496 of 496 significant files have no living knowledge — the codebase as a whole is dormant, not 496 separate risks. Counted over 496 of the 758 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. Re-engage owners or document before change.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/5 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `hpt-bench`, `hpt-examples`, `hpt-tests`.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation package.json:13 — `package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Minor — 2 finding(s)
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: hpt-cudakernels — hpt-cudakernels: abstractness 0.00, instability 0.00, distance 1.00 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: hpt-common — hpt-common: abstractness 0.00, instability 0.13, distance 0.88 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-9dbeb8593da14d6fb87cf4935a00fbb7/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=800" --report-format json --report-path /tmp/watchdog-gitleaks-9dbeb8593da14d6fb87cf4935a00fbb7/history-1.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=1000 --max-count=952" --report-format json --report-path /tmp/watchdog-gitleaks-9dbeb8593da14d6fb87cf4935a00fbb7/history-2.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-2.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-9dbeb8593da14d6fb87cf4935a00fbb7/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .12artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0—
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1e690-b87e-79df-acba-aabbadf08aab · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md