Repository navigation
feat: Accept loose schemas in d.memoryLayoutOf - #3278
cieplypolar wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
pkg.pr.new packages benchmark commit |
b435a5f to
677f88e
Compare
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [1.06, 2.10, 4.26, 7.40, 8.58, 14.41, 26.31, 25.40]
line [0.99, 1.88, 4.38, 7.51, 8.95, 13.66, 27.03, 27.93]
line [1.00, 2.17, 4.45, 7.08, 8.68, 12.84, 27.14, 26.08]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.33, 0.54, 0.74, 0.88, 1.12, 1.24, 1.48, 1.64]
line [0.35, 0.53, 0.75, 0.90, 1.23, 1.25, 1.46, 1.65]
line [0.36, 0.53, 0.75, 0.91, 1.24, 1.30, 1.55, 1.64]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.98, 2.29, 4.01, 7.62, 13.35, 27.56, 60.74, 120.04]
line [0.92, 2.23, 3.81, 7.58, 14.00, 27.65, 57.63, 118.26]
line [0.90, 2.51, 3.67, 7.82, 15.19, 28.14, 60.20, 120.60]
|
Bundle size comparison (
|
| 🟢 Decreased (max -0.20%) | ➖ Unchanged | 🔴 Increased (max 1.50%) | ❔ Unknown |
|---|---|---|---|
| 6 | 320 | 29 | 0 |
import * as ... in PR vs import * as ... in target (did bundle size increase?):
| Test | tsdown |
|---|---|
| tgpu_vertexLayout.ts | 35.19 kB ( |
| d_alignmentOf.ts | 30.02 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This PR extends d.memoryLayoutOf to accept loose schemas (unstruct, disarray) and packed vertex formats, removing the throwIfLoose guard and teaching the offset proxy to descend into them.
- Loose struct/array support —
makeProxynow acceptsBaseDataand dispatchesUnstruct/Disarrayto the existing struct/array proxies;makeStructProxy/makeArrayProxyaccept the loose variants.makeArrayProxysizes elements viasizeOf(undecorate(elementType)), so custom-size decoration is treated as padding rather than data (only affectsDisarray;arrayOfrejects decorated elements). - Packed formats — a new
makePackedProxyreturns the format's offset/contiguous markers while rejecting component/index access (s.pos.x,s.pos[1]) with a clear error, since packed byte layouts (e.g.unorm10-10-10-2) don't match the mapped WGSL vector. - Tests — the old "throws for loose schemas" cases are replaced with coverage of unstruct/disarray/packed offsets, custom sizes, alignment padding, nested continuation, and the packed component-access errors.
I verified the changed tests plus the related schema suites pass (offsetUtils, disarray, compiledIO, getLongestContiguousPrefix, isContiguous, size), tsc --noEmit is clean, and oxlint/oxfmt report no issues.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
677f88e to
f9a8c97
Compare
f9a8c97 to
55cef47
Compare
55cef47 to
202ef01
Compare
202ef01 to
4d8443a
Compare

No description provided.