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.68, 1.33, 2.83, 3.85, 4.86, 7.83, 14.02, 15.84]
line [0.61, 1.24, 2.59, 4.16, 5.28, 7.05, 13.97, 16.27]
line [0.68, 1.32, 3.00, 4.09, 5.23, 8.23, 15.37, 15.12]
---
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.22, 0.37, 0.51, 0.60, 0.78, 0.83, 1.00, 1.15]
line [0.22, 0.33, 0.48, 0.56, 0.73, 0.78, 1.01, 1.05]
line [0.21, 0.39, 0.47, 0.63, 0.88, 0.82, 1.02, 1.11]
---
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.61, 1.36, 2.38, 4.19, 8.45, 17.52, 38.53, 76.51]
line [0.65, 1.42, 2.50, 4.32, 8.07, 17.89, 37.19, 75.56]
line [0.67, 1.43, 3.04, 4.34, 8.39, 17.83, 38.17, 76.34]
|
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.