Skip to content

fix MATVEC pattern: reject equal-range elementwise reduces#16111

Closed
kimjune01 wants to merge 3 commits intotinygrad:masterfrom
kimjune01:matvec-strict-subset
Closed

fix MATVEC pattern: reject equal-range elementwise reduces#16111
kimjune01 wants to merge 3 commits intotinygrad:masterfrom
kimjune01:matvec-strict-subset

Conversation

@kimjune01
Copy link
Copy Markdown
Contributor

The MATVEC subset check all(r in idx1.ranges for r in idx0.ranges) is trivially true when both buffers share identical ranges (e.g. (a*b).sum()). A true matvec has asymmetric access — vector ranges are a strict subset of matrix ranges. Adding set(idx0.ranges) != set(idx1.ranges) rejects the equal case.

Evidence & provenance: HYPOTHESIS_GRAPH.md §H5.2

kimjune01 added 2 commits May 8, 2026 15:57
The subset check `all(r in idx1.ranges for r in idx0.ranges)` is
trivially true when both buffers share identical ranges (e.g.
(a*b).sum()). A true matvec has asymmetric access: vector ranges
are a strict subset of matrix ranges.

Evidence: kimjune01/tinygrad-abduction-engine §H5.2
@kimjune01 kimjune01 force-pushed the matvec-strict-subset branch from 61e1997 to 34fab7c Compare May 8, 2026 23:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Changes

Name                                 Lines    Diff    Tokens/Line    Diff
---------------------------------  -------  ------  -------------  ------
tinygrad/codegen/opt/heuristic.py      133      +0           16.1    +0.1


total lines changes: 0

@geohot
Copy link
Copy Markdown
Collaborator

geohot commented May 8, 2026

I don't even understand what this does. I'm not reading anything written by AI

@geohot geohot closed this May 8, 2026
This was referenced May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants