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.90, 1.76, 3.83, 6.31, 7.01, 10.61, 20.50, 24.39]
line [0.86, 1.78, 3.58, 6.27, 7.13, 10.37, 20.75, 20.91]
line [0.89, 1.88, 3.94, 6.49, 7.28, 9.33, 19.98, 20.86]
---
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.27, 0.51, 0.63, 0.82, 1.13, 1.18, 1.40, 1.51]
line [0.27, 0.68, 0.64, 0.77, 1.11, 1.12, 1.36, 1.49]
line [0.31, 0.52, 0.67, 0.87, 1.10, 1.15, 1.40, 1.53]
---
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.81, 1.93, 4.19, 6.56, 11.35, 23.95, 52.24, 105.74]
line [0.82, 1.93, 3.40, 5.90, 11.58, 24.17, 53.81, 106.14]
line [0.95, 2.15, 4.18, 6.56, 11.96, 23.99, 51.96, 107.53]
|
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.