Skip to content

fix: improve runtime ternary support by refining side-effect detection#2615

Open
pullfrog[bot] wants to merge 9 commits into
mainfrom
pullfrog/2587-improve-ternary-side-effect-detection
Open

fix: improve runtime ternary support by refining side-effect detection#2615
pullfrog[bot] wants to merge 9 commits into
mainfrom
pullfrog/2587-improve-ternary-side-effect-detection

Conversation

@pullfrog

@pullfrog pullfrog Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes runtime ternary operator support by correcting side-effect detection across multiple code paths. Addresses all failing cases from #2587.

Changes

Bug fixes (source)

  • resolutionCtx.ts: Function arguments (snip(name, type, origin)) now correctly set possibleSideEffects: false — reading a function parameter is always side-effect-free
  • tgpuConstant.ts: tgpu.const().$ proxy snippet now correctly set possibleSideEffects: false — reading a compile-time constant is side-effect-free
  • wgslGenerator.ts: Pure binary operators (comparisons, bit shifts, bitwise, modulo) now propagate operand side-effects instead of always defaulting to true
  • dualImpl.ts: Added missing side-effect tracking — dualImpl callable functions now return noSideEffects(result) when all arguments are side-effect-free, matching the behavior already present in callableSchema
  • bufferUsage.ts: Buffer read accesses (uniform, readonly, mutable) now correctly set possibleSideEffects: false

Tests

  • ternaryRuntime.test.ts (new): 8 tests covering all failing cases from the issue, including:
    • Subtraction in branches with function parameters
    • tgpu.const array indexing in branches
    • Nested runtime ternaries
    • Bit shift in branches
    • Struct field access across ternaries
    • Buffer layout access in ternary branches
    • Ternary with assignment in branch (should throw)
    • Ternary with comparison and unary negation
  • ternaryOperator.test.ts: Updated the "should throw" test to "should generate select()" since n > 0 ? n : -n now correctly produces a select() call

Verification

  • All 2018 tests pass (155 test files)
  • TypeScript typecheck passes (tsc --noEmit)

Closes #2587

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

pullfrog Bot added 2 commits June 15, 2026 19:16
- Mark function arguments as side-effect-free
- Mark tgpu.const reads as side-effect-free
- Propagate operand side-effects in pure binary operators
- Add side-effect tracking to dualImpl (matching callableSchema)
- Mark buffer reads (uniform/readonly/mutable) as side-effect-free
- Add comprehensive ternary runtime tests from issue #2587
- Update existing ternary test for runtime select() generation
- Mark function arguments as side-effect-free
- Mark tgpu.const reads as side-effect-free
- Propagate operand side-effects in pure binary operators
- Add side-effect tracking to dualImpl (matching callableSchema)
- Mark buffer reads (uniform/readonly/mutable) as side-effect-free
- Add comprehensive ternary runtime tests from issue #2587
- Update existing ternary test for runtime select() generation
@pullfrog pullfrog Bot requested review from Copilot and iwoplaza June 15, 2026 19:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@69aee8b3ed6b406208ba278c872094b5c94b87a1
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@69aee8b3ed6b406208ba278c872094b5c94b87a1
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@69aee8b3ed6b406208ba278c872094b5c94b87a1
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@69aee8b3ed6b406208ba278c872094b5c94b87a1
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@69aee8b3ed6b406208ba278c872094b5c94b87a1

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

📊 Bundle Size Comparison

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 156 200 0

👀 Notable results

Static test results:

Test tsdown
stdImportEverything.ts 108.06 kB ($${\color{red}+2.2\%}$$)
importEntireLibrary.ts 291.24 kB ($${\color{red}+0.8\%}$$)
tgpuImportEverything.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpuImportOne.ts 262.51 kB ($${\color{red}+0.6\%}$$)
stdImportOneDirect.ts 48.62 kB ($${\color{red}+0.5\%}$$)
stdImportOneStar.ts 48.62 kB ($${\color{red}+0.5\%}$$)

Dynamic test results:

‼️ Click to reveal the results table (163 entries).
Test tsdown
std from typegpu.ts 105.22 kB ($${\color{red}+2.3\%}$$)
dot from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
length from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
distance from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
dot4U8Packed from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
fract from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
frexp from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
mix from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
modf from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
abs from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
acos from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
acosh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
asin from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
asinh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
atan2 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
atan from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
atanh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
ceil from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
clamp from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
cos from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
cosh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
countLeadingZeros from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
countOneBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
countTrailingZeros from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
cross from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
degrees from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
determinant from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
dot4I8Packed from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
exp2 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
exp from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
extractBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
faceForward from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
firstLeadingBit from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
firstTrailingBit from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
floor from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
fma from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
insertBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
inverseSqrt from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
ldexp from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
log2 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
log from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
max from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
min from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
normalize from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
pow from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
quantizeToF16 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
radians from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
reflect from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
refract from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
reverseBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
round from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
saturate from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sign from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sin from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sinh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
smoothstep from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sqrt from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
step from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
tan from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
tanh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
transpose from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
trunc from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
subgroupAdd from typegpustd.ts 24.34 kB ($${\color{red}+1.5\%}$$)
subgroupAll from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupAnd from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupAny from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupBallot from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupBroadcastFirst from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupBroadcast from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupElect from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupExclusiveAdd from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupExclusiveMul from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupInclusiveAdd from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupInclusiveMul from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupMax from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupMin from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupMul from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupOr from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffleDown from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffleUp from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffleXor from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffle from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupXor from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
atomicLoad from typegpustd.ts 16.02 kB ($${\color{red}+1.5\%}$$)
atomicStore from typegpustd.ts 16.02 kB ($${\color{red}+1.5\%}$$)
textureBarrier from typegpustd.ts 16.02 kB ($${\color{red}+1.5\%}$$)
atomicAdd from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicAnd from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicMax from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicMin from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicOr from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicSub from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicXor from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
storageBarrier from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
workgroupBarrier from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
WgslGenerator from typegpu.ts 115.84 kB ($${\color{red}+1.2\%}$$)
dpdx from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdxCoarse from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdxFine from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdyCoarse from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdyFine from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdy from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
fwidthCoarse from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
fwidthFine from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
fwidth from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
and from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
or from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
allEq from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
all from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
eq from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
lt from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
ne from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
not from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
select from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
any from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
ge from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
gt from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
isCloseTo from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
le from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
textureDimensions from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureGather from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureLoad from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleBaseClampToEdge from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleBias from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleCompareLevel from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleCompare from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleGrad from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleLevel from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSample from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureStore from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
rotateX4 from typegpustd.ts 49.44 kB ($${\color{red}+0.6\%}$$)
scale4 from typegpustd.ts 49.44 kB ($${\color{red}+0.6\%}$$)
translate4 from typegpustd.ts 49.44 kB ($${\color{red}+0.6\%}$$)
rotateY4 from typegpustd.ts 49.45 kB ($${\color{red}+0.6\%}$$)
rotateZ4 from typegpustd.ts 49.45 kB ($${\color{red}+0.6\%}$$)
tgpu from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.fn from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.init from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.lazy from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.slot from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.const from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.unroll from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.resolve from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.accessor from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.comptime from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.vertexFn from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.computeFn from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.fragmentFn from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.privateVar from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.vertexLayout from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.workgroupVar from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.initFromDevice from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.bindGroupLayout from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.mutableAccessor from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.resolveWithContext from typegpu.ts 262.52 kB ($${\color{red}+0.6\%}$$)
neg from typegpustd.ts 48.60 kB ($${\color{red}+0.5\%}$$)
add from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
bitShiftLeft from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
bitShiftRight from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
div from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
mod from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
mul from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
sub from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)

📋 All results

Click to reveal the results table (355 entries).
Test tsdown
std from typegpu.ts 105.22 kB ($${\color{red}+2.3\%}$$)
stdImportEverything.ts 108.06 kB ($${\color{red}+2.2\%}$$)
dot from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
length from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
distance from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
dot4U8Packed from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
fract from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
frexp from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
mix from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
modf from typegpustd.ts 66.95 kB ($${\color{red}+1.7\%}$$)
abs from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
acos from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
acosh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
asin from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
asinh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
atan2 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
atan from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
atanh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
ceil from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
clamp from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
cos from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
cosh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
countLeadingZeros from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
countOneBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
countTrailingZeros from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
cross from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
degrees from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
determinant from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
dot4I8Packed from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
exp2 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
exp from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
extractBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
faceForward from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
firstLeadingBit from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
firstTrailingBit from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
floor from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
fma from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
insertBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
inverseSqrt from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
ldexp from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
log2 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
log from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
max from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
min from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
normalize from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
pow from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
quantizeToF16 from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
radians from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
reflect from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
refract from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
reverseBits from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
round from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
saturate from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sign from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sin from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sinh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
smoothstep from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
sqrt from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
step from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
tan from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
tanh from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
transpose from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
trunc from typegpustd.ts 66.96 kB ($${\color{red}+1.7\%}$$)
subgroupAdd from typegpustd.ts 24.34 kB ($${\color{red}+1.5\%}$$)
subgroupAll from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupAnd from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupAny from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupBallot from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupBroadcastFirst from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupBroadcast from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupElect from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupExclusiveAdd from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupExclusiveMul from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupInclusiveAdd from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupInclusiveMul from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupMax from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupMin from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupMul from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupOr from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffleDown from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffleUp from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffleXor from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupShuffle from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
subgroupXor from typegpustd.ts 24.35 kB ($${\color{red}+1.5\%}$$)
atomicLoad from typegpustd.ts 16.02 kB ($${\color{red}+1.5\%}$$)
atomicStore from typegpustd.ts 16.02 kB ($${\color{red}+1.5\%}$$)
textureBarrier from typegpustd.ts 16.02 kB ($${\color{red}+1.5\%}$$)
atomicAdd from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicAnd from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicMax from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicMin from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicOr from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicSub from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
atomicXor from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
storageBarrier from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
workgroupBarrier from typegpustd.ts 16.03 kB ($${\color{red}+1.5\%}$$)
WgslGenerator from typegpu.ts 115.84 kB ($${\color{red}+1.2\%}$$)
dpdx from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdxCoarse from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdxFine from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdyCoarse from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdyFine from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
dpdy from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
fwidthCoarse from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
fwidthFine from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
fwidth from typegpustd.ts 15.22 kB ($${\color{red}+1.2\%}$$)
and from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
or from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
allEq from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
all from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
eq from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
lt from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
ne from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
not from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
select from typegpustd.ts 52.19 kB ($${\color{red}+0.9\%}$$)
any from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
ge from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
gt from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
isCloseTo from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
le from typegpustd.ts 52.20 kB ($${\color{red}+0.9\%}$$)
importEntireLibrary.ts 291.24 kB ($${\color{red}+0.8\%}$$)
textureDimensions from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureGather from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureLoad from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleBaseClampToEdge from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleBias from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleCompareLevel from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleCompare from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleGrad from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSampleLevel from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureSample from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
textureStore from typegpustd.ts 25.96 kB ($${\color{red}+0.8\%}$$)
rotateX4 from typegpustd.ts 49.44 kB ($${\color{red}+0.6\%}$$)
scale4 from typegpustd.ts 49.44 kB ($${\color{red}+0.6\%}$$)
translate4 from typegpustd.ts 49.44 kB ($${\color{red}+0.6\%}$$)
rotateY4 from typegpustd.ts 49.45 kB ($${\color{red}+0.6\%}$$)
rotateZ4 from typegpustd.ts 49.45 kB ($${\color{red}+0.6\%}$$)
tgpuImportEverything.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.fn from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.init from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.lazy from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.slot from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.const from typegpu.ts 262.50 kB ($${\color{red}+0.6\%}$$)
tgpu.unroll from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.resolve from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.accessor from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.comptime from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.vertexFn from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.computeFn from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.fragmentFn from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.privateVar from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpuImportOne.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.vertexLayout from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.workgroupVar from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.initFromDevice from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.bindGroupLayout from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.mutableAccessor from typegpu.ts 262.51 kB ($${\color{red}+0.6\%}$$)
tgpu.resolveWithContext from typegpu.ts 262.52 kB ($${\color{red}+0.6\%}$$)
neg from typegpustd.ts 48.60 kB ($${\color{red}+0.5\%}$$)
add from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
bitShiftLeft from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
bitShiftRight from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
div from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
mod from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
mul from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
sub from typegpustd.ts 48.61 kB ($${\color{red}+0.5\%}$$)
stdImportOneDirect.ts 48.62 kB ($${\color{red}+0.5\%}$$)
stdImportOneStar.ts 48.62 kB ($${\color{red}+0.5\%}$$)
discard from typegpustd.ts 14.26 kB ($${\color{red}+0.5\%}$$)
copy from typegpustd.ts 14.50 kB ($${\color{red}+0.5\%}$$)
arrayLength from typegpustd.ts 14.50 kB ($${\color{red}+0.5\%}$$)
mat4x4f from typegpudata.ts 27.12 kB ($${\color{red}+0.5\%}$$)
identity2 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
identity3 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
identity4 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
mat2x2f from typegpudata.ts 27.12 kB ($${\color{red}+0.5\%}$$)
mat3x3f from typegpudata.ts 27.12 kB ($${\color{red}+0.5\%}$$)
rotationX4 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
rotationY4 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
rotationZ4 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
scaling4 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
translation4 from typegpustd.ts 27.12 kB ($${\color{red}+0.5\%}$$)
matToArray from typegpudata.ts 27.25 kB ($${\color{red}+0.5\%}$$)
isUsableAsUniform from typegpu.ts 63.17 kB ($${\color{red}+0.4\%}$$)
isTexture from typegpu.ts 63.18 kB ($${\color{red}+0.4\%}$$)
isSampler from typegpu.ts 63.19 kB ($${\color{red}+0.4\%}$$)
isComparisonSampler from typegpu.ts 63.20 kB ($${\color{red}+0.4\%}$$)
isVariable from typegpu.ts 64.90 kB ($${\color{red}+0.4\%}$$)
bitcastU32toF32 from typegpustd.ts 44.35 kB ($${\color{red}+0.4\%}$$)
bitcastU32toI32 from typegpustd.ts 44.35 kB ($${\color{red}+0.4\%}$$)
pack2x16float from typegpustd.ts 36.06 kB ($${\color{red}+0.3\%}$$)
pack4x8unorm from typegpustd.ts 36.06 kB ($${\color{red}+0.3\%}$$)
unpack2x16float from typegpustd.ts 36.06 kB ($${\color{red}+0.3\%}$$)
unpack4x8unorm from typegpustd.ts 36.06 kB ($${\color{red}+0.3\%}$$)
d from typegpu.ts 87.41 kB ($${\color{red}+0.3\%}$$)
isUsableAsVertex from typegpu.ts 88.75 kB ($${\color{red}+0.3\%}$$)
isBuffer from typegpu.ts 88.76 kB ($${\color{red}+0.3\%}$$)
dataImportEverything.ts 89.73 kB ($${\color{red}+0.3\%}$$)
readFromArrayBuffer from typegpu.ts 51.82 kB ($${\color{red}+0.2\%}$$)
dataImportOneDirect.ts 24.62 kB (➖)
dataImportOneStar.ts 24.62 kB (➖)
functionWithUseGpu.ts 282 B (➖)
functionWithoutUseGpu.ts 24 B (➖)
MissingBindGroupsError from typegpu.ts 1.35 kB (➖)
MissingSlotValueError from typegpu.ts 151 B (➖)
MissingVertexBuffersError from typegpu.ts 1.36 kB (➖)
NotUniformError from typegpu.ts 1.31 kB (➖)
ResolutionError from typegpu.ts 2.33 kB (➖)
ShaderGenerator from typegpu.ts 1.66 kB (➖)
Void from typegpudata.ts 734 B (➖)
align from typegpudata.ts 26.31 kB (➖)
alignmentOf from typegpudata.ts 21.85 kB (➖)
arrayOf from typegpudata.ts 26.17 kB (➖)
atomic from typegpudata.ts 779 B (➖)
bool from typegpudata.ts 12.97 kB (➖)
builtin from typegpudata.ts 28.63 kB (➖)
common from typegpu.ts 58.44 kB (➖)
comparisonSampler from typegpudata.ts 753 B (➖)
deepEqual from typegpudata.ts 2.19 kB (➖)
disarrayOf from typegpudata.ts 15.02 kB (➖)
extensionEnabled from typegpustd.ts 14.58 kB (➖)
f16 from typegpudata.ts 12.97 kB (➖)
f32 from typegpudata.ts 12.97 kB (➖)
float16 from typegpudata.ts 20.91 kB (➖)
float16x2 from typegpudata.ts 20.91 kB (➖)
float16x4 from typegpudata.ts 20.91 kB (➖)
float32 from typegpudata.ts 20.91 kB (➖)
float32x2 from typegpudata.ts 20.91 kB (➖)
float32x3 from typegpudata.ts 20.91 kB (➖)
float32x4 from typegpudata.ts 20.91 kB (➖)
formatToWGSLType from typegpudata.ts 20.90 kB (➖)
getLongestContiguousPrefix from typegpudata.ts 24.64 kB (➖)
getTargetShaderLanguage from typegpustd.ts 14.53 kB (➖)
i32 from typegpudata.ts 12.97 kB (➖)
interpolate from typegpudata.ts 26.32 kB (➖)
invariant from typegpudata.ts 26.69 kB (➖)
isAccessor from typegpu.ts 65 B (➖)
isAlignAttrib from typegpudata.ts 755 B (➖)
isAtomic from typegpudata.ts 755 B (➖)
isBeingTranspiled from typegpustd.ts 14.47 kB (➖)
isBufferShorthand from typegpu.ts 1.71 kB (➖)
isBuiltinAttrib from typegpudata.ts 757 B (➖)
isBuiltin from typegpudata.ts 24.57 kB (➖)
isContiguous from typegpudata.ts 24.63 kB (➖)
isData from typegpudata.ts 1.81 kB (➖)
isDecorated from typegpudata.ts 758 B (➖)
isDisarray from typegpudata.ts 1.11 kB (➖)
isInterpolateAttrib from typegpudata.ts 761 B (➖)
isLazy from typegpu.ts 61 B (➖)
isLocationAttrib from typegpudata.ts 758 B (➖)
isLooseData from typegpudata.ts 1.16 kB (➖)
isLooseDecorated from typegpudata.ts 1.12 kB (➖)
isMutableAccessor from typegpu.ts 73 B (➖)
isPackedData from typegpudata.ts 20.97 kB (➖)
isPtr from typegpudata.ts 752 B (➖)
isSizeAttrib from typegpudata.ts 754 B (➖)
isSlot from typegpu.ts 61 B (➖)
isTgpuComputeFn from typegpu.ts 69 B (➖)
isTgpuFn from typegpu.ts 765 B (➖)
isTgpuFragmentFn from typegpu.ts 70 B (➖)
isTgpuVertexFn from typegpu.ts 68 B (➖)
isUnstruct from typegpudata.ts 1.11 kB (➖)
isUsableAsRender from typegpu.ts 55 B (➖)
isUsableAsSampled from typegpu.ts 56 B (➖)
isUsableAsStorage from typegpu.ts 56 B (➖)
isWgslArray from typegpudata.ts 754 B (➖)
isWgslData from typegpudata.ts 1.31 kB (➖)
isWgslStruct from typegpudata.ts 755 B (➖)
location from typegpudata.ts 26.31 kB (➖)
memoryLayoutOf from typegpudata.ts 41.95 kB (➖)
packedFormats from typegpudata.ts 20.92 kB (➖)
patchArrayBuffer from typegpu.ts 51.09 kB (➖)
ptrFn from typegpudata.ts 859 B (➖)
ptrHandle from typegpudata.ts 851 B (➖)
ptrPrivate from typegpudata.ts 858 B (➖)
ptrStorage from typegpudata.ts 856 B (➖)
ptrUniform from typegpudata.ts 852 B (➖)
ptrWorkgroup from typegpudata.ts 860 B (➖)
range from typegpustd.ts 14.85 kB (➖)
ref from typegpudata.ts 4.79 kB (➖)
sampler from typegpudata.ts 742 B (➖)
sint16 from typegpudata.ts 20.91 kB (➖)
sint16x2 from typegpudata.ts 20.91 kB (➖)
sint16x4 from typegpudata.ts 20.91 kB (➖)
sint32 from typegpudata.ts 20.91 kB (➖)
sint32x2 from typegpudata.ts 20.91 kB (➖)
sint32x3 from typegpudata.ts 20.91 kB (➖)
sint32x4 from typegpudata.ts 20.91 kB (➖)
sint8 from typegpudata.ts 20.91 kB (➖)
sint8x2 from typegpudata.ts 20.91 kB (➖)
sint8x4 from typegpudata.ts 20.91 kB (➖)
sizeOf from typegpudata.ts 24.62 kB (➖)
size from typegpudata.ts 26.31 kB (➖)
snorm16 from typegpudata.ts 20.91 kB (➖)
snorm16x2 from typegpudata.ts 20.91 kB (➖)
snorm16x4 from typegpudata.ts 20.91 kB (➖)
snorm8 from typegpudata.ts 20.91 kB (➖)
snorm8x2 from typegpudata.ts 20.91 kB (➖)
snorm8x4 from typegpudata.ts 20.91 kB (➖)
struct from typegpudata.ts 3.42 kB (➖)
texture1d from typegpudata.ts 13.43 kB (➖)
texture2dArray from typegpudata.ts 13.45 kB (➖)
texture2d from typegpudata.ts 13.43 kB (➖)
texture3d from typegpudata.ts 13.43 kB (➖)
textureCubeArray from typegpudata.ts 13.45 kB (➖)
textureCube from typegpudata.ts 13.43 kB (➖)
textureDepth2dArray from typegpudata.ts 13.44 kB (➖)
textureDepth2d from typegpudata.ts 13.42 kB (➖)
textureDepthCubeArray from typegpudata.ts 13.44 kB (➖)
textureDepthCube from typegpudata.ts 13.42 kB (➖)
textureDepthMultisampled2d from typegpudata.ts 13.44 kB (➖)
textureExternal from typegpudata.ts 873 B (➖)
textureMultisampled2d from typegpudata.ts 13.45 kB (➖)
textureStorage1d from typegpudata.ts 1.01 kB (➖)
textureStorage2dArray from typegpudata.ts 1.03 kB (➖)
textureStorage2d from typegpudata.ts 1.01 kB (➖)
textureStorage3d from typegpudata.ts 1.01 kB (➖)
u16 from typegpudata.ts 13.00 kB (➖)
u32 from typegpudata.ts 12.97 kB (➖)
uint16 from typegpudata.ts 20.91 kB (➖)
uint16x2 from typegpudata.ts 20.91 kB (➖)
uint16x4 from typegpudata.ts 20.91 kB (➖)
uint32 from typegpudata.ts 20.91 kB (➖)
uint32x2 from typegpudata.ts 20.91 kB (➖)
uint32x3 from typegpudata.ts 20.91 kB (➖)
uint32x4 from typegpudata.ts 20.91 kB (➖)
uint8 from typegpudata.ts 20.90 kB (➖)
uint8x2 from typegpudata.ts 20.91 kB (➖)
uint8x4 from typegpudata.ts 20.91 kB (➖)
unorm10 10 10 2 from typegpudata.ts 20.91 kB (➖)
unorm16 from typegpudata.ts 20.91 kB (➖)
unorm16x2 from typegpudata.ts 20.91 kB (➖)
unorm16x4 from typegpudata.ts 20.91 kB (➖)
unorm8 from typegpudata.ts 20.91 kB (➖)
unorm8x2 from typegpudata.ts 20.91 kB (➖)
unorm8x4 bgra from typegpudata.ts 20.91 kB (➖)
unorm8x4 from typegpudata.ts 20.91 kB (➖)
unstruct from typegpudata.ts 1.55 kB (➖)
vec2b from typegpudata.ts 19.41 kB (➖)
vec2f from typegpudata.ts 19.41 kB (➖)
vec2h from typegpudata.ts 19.41 kB (➖)
vec2i from typegpudata.ts 19.41 kB (➖)
vec2u from typegpudata.ts 19.41 kB (➖)
vec3b from typegpudata.ts 19.41 kB (➖)
vec3f from typegpudata.ts 19.41 kB (➖)
vec3h from typegpudata.ts 19.41 kB (➖)
vec3i from typegpudata.ts 19.41 kB (➖)
vec3u from typegpudata.ts 19.41 kB (➖)
vec4b from typegpudata.ts 19.41 kB (➖)
vec4f from typegpudata.ts 19.41 kB (➖)
vec4h from typegpudata.ts 19.41 kB (➖)
vec4i from typegpudata.ts 19.41 kB (➖)
vec4u from typegpudata.ts 19.41 kB (➖)
writeToArrayBuffer from typegpu.ts 50.89 kB (➖)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@pullfrog

pullfrog Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

CI failure was caused by formatting issues in packages/typegpu/src/tgsl/wgslGenerator.ts and packages/typegpu/tests/tgsl/ternaryRuntime.test.ts — the oxfmt check failed. Ran oxfmt --write on both files to apply the correct formatting. Verified typecheck and affected tests pass. Pushed as 59ebd23.

Task list (7/7 completed)
  • Checkout PR branch
  • Fetch check suite logs
  • Diagnose failure — formatting issues in wgslGenerator.ts and ternaryRuntime.test.ts
  • Fix formatting with oxfmt
  • Verify fix by re-running CI commands
  • Commit and push
  • Report progress

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

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.88, 1.86, 4.34, 6.79, 7.57, 10.88, 23.47, 25.43]
  line [1.00, 1.85, 4.09, 6.86, 8.44, 10.26, 21.93, 27.11]
  line [0.97, 1.99, 4.76, 7.20, 8.33, 10.94, 23.27, 25.11]
Loading
---
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.55, 0.70, 0.84, 1.18, 1.28, 1.56, 1.82]
  line [0.30, 0.55, 0.69, 0.85, 1.18, 1.23, 1.52, 1.67]
  line [0.30, 0.56, 0.75, 0.89, 1.26, 1.31, 1.59, 1.66]
Loading
---
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.94, 2.08, 4.51, 6.54, 12.68, 26.50, 57.52, 117.06]
  line [0.89, 2.36, 3.97, 6.36, 12.54, 27.69, 57.07, 117.81]
  line [1.06, 2.25, 4.43, 6.86, 13.78, 28.48, 57.96, 121.18]
Loading

@iwoplaza iwoplaza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think all dualImpls are side-effect free. Take for example a textureStore function, or atomicStore. I think there should be a "sideEffects" prop that is required whenever a dualImpl is defined. If true, then the result always has possible side effects. If false, then the result has side effects if any of the arguments have side effects.

@pullfrog

pullfrog Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the reviewer's feedback: added a sideEffects prop to DualImplOptions (defaults false) so that inherently side-effecting functions like textureStore, atomicStore, and barriers correctly mark their results with possibleSideEffects: true. Marked all 11 side-effecting dualImpl functions with sideEffects: true. All 2018 tests pass, typecheck is clean. No inline threads to resolve — feedback was in the review body.

Task list (5/6 completed)
  • Checkout PR branch
  • Fetch review comments
  • Add sideEffects prop to DualImplOptions + update dualImpl.ts logic
  • Add sideEffects: true to textureStore, atomic functions, and barriers
  • Run tests and quality check
  • Push, reply, resolve threads, report progress

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog

pullfrog Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review feedback:

  • Added a sideEffects prop (default false) to DualImplOptions. When true, the result always has possibleSideEffects: true regardless of argument side-effects.
  • Marked all inherently side-effecting dualImpl functions with sideEffects: true: textureStore, workgroupBarrier, storageBarrier, textureBarrier, atomicStore, atomicAdd, atomicSub, atomicMax, atomicMin, atomicAnd, atomicOr, atomicXor.
  • Pure functions (math ops, comparisons, texture reads, etc.) default to false — they will still propagate arg side-effects correctly.

All 2018 tests pass, typecheck is clean.

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@iwoplaza iwoplaza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if the sideEffects prop of DualImplOptions was required, so that it will be harder to miss and reason about on a case-by-case basis, even if it produces a lot of code changes.

@pullfrog

pullfrog Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Made sideEffects required in DualImplOptions and added explicit sideEffects: false to all ~87 dualImpl calls across 16 files that didn't already declare it. The 12 calls that already had sideEffects: true (barriers, atomics, textureStore) are unchanged. All 2018 tests pass and typecheck is clean.

Task list (5/5 completed)
  • Checkout PR branch
  • Fetch and analyze review comments
  • Make sideEffects required in DualImplOptions and add explicit sideEffects to all dualImpl calls
  • Quality check (format, typecheck, tests) and commit changes
  • Push, reply to comments, resolve threads, report progress

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/tests/tgsl/ternaryRuntime.test.ts Outdated
Comment thread packages/typegpu/src/core/function/dualImpl.ts Outdated
Comment thread packages/typegpu/src/std/discard.ts Outdated
@pullfrog

pullfrog Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both review findings:

  • dualImpl.ts: Replaced the conditional noSideEffects wrapping with direct computation of possibleSideEffects passed as the fourth argument to snip.
  • discard.ts: Changed sideEffects from false to truediscard; is inherently side-effecting.

All 2017 tests pass, typecheck passes. Both threads resolved.

Task list (5/5 completed)
  • Checkout PR branch
  • Fetch review comments
  • Address each review comment (verify, fix or push back, record)
  • Quality check and commit changes
  • Push, reply to threads, and resolve

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/core/function/tgpuFn.ts Outdated
Comment thread packages/typegpu/src/core/function/tgpuFn.ts Outdated
@pullfrog

pullfrog Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both review comments: changed sideEffects: false to sideEffects: true in createFn and createBoundFunction in tgpuFn.ts. User-defined functions can have side-effects, so assuming they do is the safe default until a proper side-effect-free detection mechanism exists. All ternary tests pass and typecheck is clean.

Task list (8/8 completed)
  • Fetch and read review comments
  • Understand each review comment and verify against code
  • Make code changes: tgpuFn.ts line 241 sideEffects: false → true
  • Make code changes: tgpuFn.ts line 301 sideEffects: false → true
  • Test changes and review diff
  • Commit and push changes
  • Reply to review comments and resolve threads
  • Final progress report

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@iwoplaza iwoplaza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🐸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Improve runtime ternary support

2 participants