feat: bitcastF32toU32#2517
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:
Dynamic test results:
📋 All resultsClick to reveal the results table (356 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
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 [0.75, 1.58, 3.19, 5.11, 6.47, 8.95, 18.69, 19.04]
line [0.84, 1.67, 3.34, 5.35, 6.24, 9.64, 19.22, 20.22]
line [0.84, 1.73, 3.64, 5.89, 6.16, 9.57, 20.24, 22.57]
---
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.31, 0.48, 0.59, 0.72, 0.99, 1.00, 1.22, 1.28]
line [0.29, 0.52, 0.64, 0.76, 1.06, 1.09, 1.29, 1.38]
line [0.33, 0.51, 0.62, 0.75, 1.04, 1.08, 1.23, 1.43]
---
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.80, 1.80, 3.12, 5.50, 10.20, 21.69, 47.42, 95.17]
line [0.74, 1.72, 3.01, 5.37, 10.46, 22.37, 45.25, 94.10]
line [0.80, 1.83, 3.95, 5.22, 10.87, 22.62, 48.64, 99.81]
|
There was a problem hiding this comment.
Pull request overview
Adds a new std helper bitcastF32toU32 (CPU + WGSL codegen) to reinterpret f32 bit patterns as u32, including vector support, and extends the test suite to cover the new behavior.
Changes:
- Implement
std.bitcastF32toU32withdualImplsupport for scalars andvec2f/vec3f/vec4f. - Add CPU bitcast implementation (
bitcastF32toU32Impl) and vector-component CPU helpers. - Extend
bitcasttests to cover scalar/vector behavior and shader codegen snapshots.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/tests/std/bitcast.test.ts | Adds scalar/vector tests and shader snapshots for bitcastF32toU32 (currently introduces a Node Buffer typing issue). |
| packages/typegpu/src/std/index.ts | Exports bitcastF32toU32 from the std barrel. |
| packages/typegpu/src/std/bitcast.ts | Adds the new dualImpl wrapper for bitcastF32toU32 (signature currently doesn’t reject unsupported input types). |
| packages/typegpu/src/data/vectorOps.ts | Adds CPU vector implementations for bitcastF32toU32. |
| packages/typegpu/src/data/numberOps.ts | Adds the scalar CPU bitcast implementation for f32 -> u32. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iwoplaza
left a comment
There was a problem hiding this comment.
I would add a few more dataType checks like the AI said, but other than that, you have my stamp of approval ![]()
No description provided.