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.97, 1.89, 4.47, 6.67, 7.65, 10.67, 21.61, 23.62]
line [0.96, 1.97, 4.56, 6.55, 7.80, 11.44, 21.99, 23.67]
line [1.02, 2.04, 4.13, 6.83, 8.24, 11.51, 22.95, 23.56]
---
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.55, 0.68, 0.85, 1.16, 1.21, 1.45, 1.59]
line [0.35, 0.55, 0.71, 0.87, 1.21, 1.21, 1.50, 1.65]
line [0.35, 0.54, 0.71, 0.92, 1.24, 1.28, 1.51, 1.68]
---
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.85, 2.00, 3.73, 6.83, 12.86, 26.06, 55.49, 111.57]
line [0.91, 2.03, 4.40, 6.59, 12.68, 26.62, 56.36, 117.24]
line [0.87, 2.09, 4.47, 6.39, 13.36, 26.05, 56.17, 115.74]
|
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.