Skip to content

impr: tracking possibleSideEffects#2695

Open
cieplypolar wants to merge 22 commits into
mainfrom
fix/possible-side-effects-flow
Open

impr: tracking possibleSideEffects#2695
cieplypolar wants to merge 22 commits into
mainfrom
fix/possible-side-effects-flow

Conversation

@cieplypolar

@cieplypolar cieplypolar commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator
  • accurate tracking of possibleSideEffects
  • passing $gpuCallable to the accessors
  • tpgu.rawCodeSnippet optional possibleSideEffects field

Closes #2646.

pullfrog Bot and others added 16 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
Copilot AI review requested due to automatic review settings July 7, 2026 10:54
@cieplypolar cieplypolar force-pushed the fix/possible-side-effects-flow branch from 7435193 to befe8de Compare July 7, 2026 10:55
@github-actions

github-actions Bot commented Jul 7, 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@81a30b1c8194ca3edf44138cf94db9f3519ee10e
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@81a30b1c8194ca3edf44138cf94db9f3519ee10e
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@81a30b1c8194ca3edf44138cf94db9f3519ee10e
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@81a30b1c8194ca3edf44138cf94db9f3519ee10e
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@81a30b1c8194ca3edf44138cf94db9f3519ee10e

benchmark
view benchmark

commit
view commit

@cieplypolar cieplypolar force-pushed the fix/possible-side-effects-flow branch from befe8de to 6d5ee16 Compare July 7, 2026 10:56
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased ➖ Unchanged 🔴 Increased (max 2.94%) ❔ Unknown
0 36 284 0

import * as ... in PR vs import * as ... in target (did bundle size increase?):

Click to reveal the results table (144 entries).
Test tsdown
d_ref.ts 4.93 kB ($${\color{red}+2.9\%}$$)
d_bool.ts 13.17 kB ($${\color{red}+1.1\%}$$)
d_f16.ts 13.17 kB ($${\color{red}+1.1\%}$$)
d_f32.ts 13.17 kB ($${\color{red}+1.1\%}$$)
d_i32.ts 13.17 kB ($${\color{red}+1.1\%}$$)
d_u32.ts 13.17 kB ($${\color{red}+1.1\%}$$)
d_u16.ts 13.19 kB ($${\color{red}+1.1\%}$$)
std_discard.ts 14.46 kB ($${\color{red}+1.1\%}$$)
std_copy.ts 14.70 kB ($${\color{red}+1.1\%}$$)
std_arrayLength.ts 14.71 kB ($${\color{red}+1.1\%}$$)
d_textureDepth2d.ts 13.61 kB ($${\color{red}+1.1\%}$$)
d_textureDepthCube.ts 13.62 kB ($${\color{red}+1.1\%}$$)
d_texture1d.ts 13.62 kB ($${\color{red}+1.1\%}$$)
d_texture2d.ts 13.62 kB ($${\color{red}+1.1\%}$$)
d_texture3d.ts 13.62 kB ($${\color{red}+1.1\%}$$)
d_textureCube.ts 13.63 kB ($${\color{red}+1.1\%}$$)
d_textureDepth2dArray.ts 13.63 kB ($${\color{red}+1.1\%}$$)
d_textureDepthCubeArray.ts 13.63 kB ($${\color{red}+1.1\%}$$)
d_textureDepthMultisampled2d.ts 13.63 kB ($${\color{red}+1.1\%}$$)
d_texture2dArray.ts 13.64 kB ($${\color{red}+1.1\%}$$)
d_textureCubeArray.ts 13.64 kB ($${\color{red}+1.1\%}$$)
d_textureMultisampled2d.ts 13.65 kB ($${\color{red}+1.1\%}$$)
std_dpdx.ts 15.42 kB ($${\color{red}+1.1\%}$$)
std_dpdxCoarse.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_dpdxFine.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_dpdy.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_dpdyCoarse.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_dpdyFine.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_fwidth.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_fwidthCoarse.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_fwidthFine.ts 15.43 kB ($${\color{red}+1.1\%}$$)
std_atomicLoad.ts 16.22 kB ($${\color{red}+1.0\%}$$)
std_atomicStore.ts 16.23 kB ($${\color{red}+1.0\%}$$)
std_textureBarrier.ts 16.23 kB ($${\color{red}+1.0\%}$$)
std_atomicAdd.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_atomicAnd.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_atomicMax.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_atomicMin.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_atomicOr.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_atomicSub.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_atomicXor.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_storageBarrier.ts 16.24 kB ($${\color{red}+1.0\%}$$)
std_workgroupBarrier.ts 16.24 kB ($${\color{red}+1.0\%}$$)
d_vec2b.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec2f.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec2h.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec2i.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec2u.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec3b.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec3f.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec3h.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec3i.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec3u.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec4b.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec4f.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec4h.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec4i.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_vec4u.ts 19.60 kB ($${\color{red}+0.8\%}$$)
d_uint8.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float16.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float16x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float16x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float32.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float32x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float32x3.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_float32x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint16.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint16x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint16x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint32.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint32x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint32x3.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint32x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint8.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint8x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_sint8x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_snorm16.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_snorm16x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_snorm16x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_snorm8.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_snorm8x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_snorm8x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint16.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint16x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint16x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint32.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint32x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint32x3.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint32x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint8x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_uint8x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm10_10_10_2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm16.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm16x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm16x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm8.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm8x2.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm8x4.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_unorm8x4_bgra.ts 21.10 kB ($${\color{red}+0.7\%}$$)
d_formatToWGSLType.ts 21.09 kB ($${\color{red}+0.7\%}$$)
d_packedFormats.ts 21.12 kB ($${\color{red}+0.7\%}$$)
d_isPackedData.ts 21.16 kB ($${\color{red}+0.7\%}$$)
d_alignmentOf.ts 22.05 kB ($${\color{red}+0.7\%}$$)
std_subgroupAdd.ts 24.55 kB ($${\color{red}+0.7\%}$$)
std_subgroupAll.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupAnd.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupAny.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupBallot.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupBroadcast.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupBroadcastFirst.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupElect.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupExclusiveAdd.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupExclusiveMul.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupInclusiveAdd.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupInclusiveMul.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupMax.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupMin.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupMul.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupOr.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupShuffle.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupShuffleDown.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupShuffleUp.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupShuffleXor.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_subgroupXor.ts 24.56 kB ($${\color{red}+0.7\%}$$)
std_textureDimensions.ts 26.16 kB ($${\color{red}+0.6\%}$$)
std_textureGather.ts 26.16 kB ($${\color{red}+0.6\%}$$)
std_textureLoad.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSample.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSampleBaseClampToEdge.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSampleBias.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSampleCompare.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSampleCompareLevel.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSampleGrad.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureSampleLevel.ts 26.17 kB ($${\color{red}+0.6\%}$$)
std_textureStore.ts 26.17 kB ($${\color{red}+0.6\%}$$)
d_isBuiltin.ts 24.77 kB ($${\color{red}+0.6\%}$$)
d_sizeOf.ts 24.82 kB ($${\color{red}+0.6\%}$$)
d_isContiguous.ts 24.83 kB ($${\color{red}+0.6\%}$$)
d_getLongestContiguousPrefix.ts 24.84 kB ($${\color{red}+0.6\%}$$)
d_size.ts 26.51 kB ($${\color{red}+0.6\%}$$)
d_align.ts 26.51 kB ($${\color{red}+0.6\%}$$)
d_location.ts 26.51 kB ($${\color{red}+0.6\%}$$)
d_interpolate.ts 26.51 kB ($${\color{red}+0.6\%}$$)
d_invariant.ts 26.88 kB ($${\color{red}+0.6\%}$$)

import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):

Click to reveal the results table (297 entries).
Test tsdown
d_Void.ts 87.71 kB ($${\color{red}+12135.8\%}$$)
d_sampler.ts 87.71 kB ($${\color{red}+12004.3\%}$$)
d_isPtr.ts 87.71 kB ($${\color{red}+11843.1\%}$$)
d_comparisonSampler.ts 87.72 kB ($${\color{red}+11828.8\%}$$)
d_isSizeAttrib.ts 87.71 kB ($${\color{red}+11812.3\%}$$)
d_isWgslArray.ts 87.71 kB ($${\color{red}+11812.2\%}$$)
d_isAlignAttrib.ts 87.71 kB ($${\color{red}+11796.7\%}$$)
d_isWgslStruct.ts 87.71 kB ($${\color{red}+11796.6\%}$$)
d_isAtomic.ts 87.71 kB ($${\color{red}+11796.0\%}$$)
d_isBuiltinAttrib.ts 87.72 kB ($${\color{red}+11765.5\%}$$)
d_isLocationAttrib.ts 87.72 kB ($${\color{red}+11750.0\%}$$)
d_isDecorated.ts 87.71 kB ($${\color{red}+11749.3\%}$$)
d_isInterpolateAttrib.ts 87.72 kB ($${\color{red}+11703.7\%}$$)
d_atomic.ts 87.71 kB ($${\color{red}+11429.3\%}$$)
d_ptrHandle.ts 87.71 kB ($${\color{red}+10454.2\%}$$)
d_ptrUniform.ts 87.71 kB ($${\color{red}+10441.9\%}$$)
d_ptrStorage.ts 87.71 kB ($${\color{red}+10392.6\%}$$)
d_ptrPrivate.ts 87.71 kB ($${\color{red}+10368.2\%}$$)
d_ptrFn.ts 87.71 kB ($${\color{red}+10355.4\%}$$)
d_ptrWorkgroup.ts 87.71 kB ($${\color{red}+10344.1\%}$$)
d_textureExternal.ts 87.72 kB ($${\color{red}+10188.9\%}$$)
d_textureStorage1d.ts 87.72 kB ($${\color{red}+8561.8\%}$$)
d_textureStorage2d.ts 87.72 kB ($${\color{red}+8561.8\%}$$)
d_textureStorage3d.ts 87.72 kB ($${\color{red}+8561.8\%}$$)
d_textureStorage2dArray.ts 87.72 kB ($${\color{red}+8414.5\%}$$)
d_isDisarray.ts 87.71 kB ($${\color{red}+7785.6\%}$$)
d_isUnstruct.ts 87.71 kB ($${\color{red}+7785.6\%}$$)
d_isLooseDecorated.ts 87.72 kB ($${\color{red}+7738.0\%}$$)
d_isLooseData.ts 87.71 kB ($${\color{red}+7473.2\%}$$)
d_isWgslData.ts 87.71 kB ($${\color{red}+6592.8\%}$$)
d_unstruct.ts 87.71 kB ($${\color{red}+5566.6\%}$$)
d_isData.ts 87.71 kB ($${\color{red}+4752.1\%}$$)
d_deepEqual.ts 87.71 kB ($${\color{red}+3900.7\%}$$)
d_struct.ts 87.71 kB ($${\color{red}+2333.3\%}$$)
d_ref.ts 87.71 kB ($${\color{red}+1679.5\%}$$)
std_discard.ts 105.53 kB ($${\color{red}+629.7\%}$$)
std_isBeingTranspiled.ts 105.54 kB ($${\color{red}+625.4\%}$$)
std_getTargetShaderLanguage.ts 105.55 kB ($${\color{red}+622.2\%}$$)
std_extensionEnabled.ts 105.54 kB ($${\color{red}+619.6\%}$$)
std_copy.ts 105.53 kB ($${\color{red}+617.7\%}$$)
std_arrayLength.ts 105.53 kB ($${\color{red}+617.5\%}$$)
std_range.ts 105.53 kB ($${\color{red}+606.7\%}$$)
std_dpdx.ts 105.53 kB ($${\color{red}+584.2\%}$$)
std_fwidthCoarse.ts 105.54 kB ($${\color{red}+584.0\%}$$)
std_dpdxCoarse.ts 105.53 kB ($${\color{red}+584.0\%}$$)
std_dpdyCoarse.ts 105.53 kB ($${\color{red}+584.0\%}$$)
std_fwidthFine.ts 105.53 kB ($${\color{red}+584.0\%}$$)
std_dpdxFine.ts 105.53 kB ($${\color{red}+584.0\%}$$)
std_dpdyFine.ts 105.53 kB ($${\color{red}+584.0\%}$$)
std_fwidth.ts 105.53 kB ($${\color{red}+584.0\%}$$)
std_dpdy.ts 105.53 kB ($${\color{red}+584.0\%}$$)
d_bool.ts 87.71 kB ($${\color{red}+566.2\%}$$)
d_f16.ts 87.71 kB ($${\color{red}+566.1\%}$$)
d_f32.ts 87.71 kB ($${\color{red}+566.1\%}$$)
d_i32.ts 87.71 kB ($${\color{red}+566.1\%}$$)
d_u32.ts 87.71 kB ($${\color{red}+566.1\%}$$)
d_u16.ts 87.71 kB ($${\color{red}+565.0\%}$$)
std_atomicLoad.ts 105.53 kB ($${\color{red}+550.5\%}$$)
std_textureBarrier.ts 105.54 kB ($${\color{red}+550.2\%}$$)
std_atomicStore.ts 105.53 kB ($${\color{red}+550.2\%}$$)
std_workgroupBarrier.ts 105.54 kB ($${\color{red}+550.0\%}$$)
std_storageBarrier.ts 105.54 kB ($${\color{red}+550.0\%}$$)
std_atomicAdd.ts 105.53 kB ($${\color{red}+550.0\%}$$)
std_atomicAnd.ts 105.53 kB ($${\color{red}+550.0\%}$$)
std_atomicMax.ts 105.53 kB ($${\color{red}+550.0\%}$$)
std_atomicMin.ts 105.53 kB ($${\color{red}+550.0\%}$$)
std_atomicSub.ts 105.53 kB ($${\color{red}+550.0\%}$$)
std_atomicXor.ts 105.53 kB ($${\color{red}+550.0\%}$$)
std_atomicOr.ts 105.53 kB ($${\color{red}+550.0\%}$$)
d_textureDepth2d.ts 87.72 kB ($${\color{red}+544.5\%}$$)
d_textureDepthCube.ts 87.72 kB ($${\color{red}+544.3\%}$$)
d_texture1d.ts 87.71 kB ($${\color{red}+544.0\%}$$)
d_texture2d.ts 87.71 kB ($${\color{red}+544.0\%}$$)
d_texture3d.ts 87.71 kB ($${\color{red}+544.0\%}$$)
d_textureDepth2dArray.ts 87.72 kB ($${\color{red}+543.7\%}$$)
d_textureCube.ts 87.71 kB ($${\color{red}+543.7\%}$$)
d_textureDepthCubeArray.ts 87.72 kB ($${\color{red}+543.5\%}$$)
d_textureDepthMultisampled2d.ts 87.73 kB ($${\color{red}+543.4\%}$$)
d_texture2dArray.ts 87.72 kB ($${\color{red}+543.2\%}$$)
d_textureCubeArray.ts 87.72 kB ($${\color{red}+542.9\%}$$)
d_textureMultisampled2d.ts 87.72 kB ($${\color{red}+542.9\%}$$)
d_disarrayOf.ts 87.71 kB ($${\color{red}+480.8\%}$$)
d_vec2b.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec2f.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec2h.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec2i.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec2u.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec3b.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec3f.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec3h.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec3i.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec3u.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec4b.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec4f.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec4h.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec4i.ts 87.71 kB ($${\color{red}+347.5\%}$$)
d_vec4u.ts 87.71 kB ($${\color{red}+347.5\%}$$)
std_subgroupAdd.ts 105.53 kB ($${\color{red}+329.8\%}$$)
std_subgroupBroadcastFirst.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupExclusiveAdd.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupExclusiveMul.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupInclusiveAdd.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupInclusiveMul.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffleDown.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffleXor.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupBroadcast.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffleUp.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffle.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupBallot.ts 105.54 kB ($${\color{red}+329.8\%}$$)
std_subgroupElect.ts 105.54 kB ($${\color{red}+329.7\%}$$)
std_subgroupAll.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupAnd.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupAny.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupMax.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupMin.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupMul.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupXor.ts 105.53 kB ($${\color{red}+329.7\%}$$)
std_subgroupOr.ts 105.53 kB ($${\color{red}+329.7\%}$$)
d_formatToWGSLType.ts 87.72 kB ($${\color{red}+315.9\%}$$)
d_uint8.ts 87.71 kB ($${\color{red}+315.8\%}$$)
d_unorm10_10_10_2.ts 87.72 kB ($${\color{red}+315.7\%}$$)
d_unorm8x4_bgra.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float16x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float16x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float32x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float32x3.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float32x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_snorm16x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_snorm16x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_unorm16x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_unorm16x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint16x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint16x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint32x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint32x3.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint32x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_snorm8x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_snorm8x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint16x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint16x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint32x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint32x3.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint32x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_unorm8x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_unorm8x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float16.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_float32.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint8x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint8x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_snorm16.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint8x2.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_uint8x4.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_unorm16.ts 87.71 kB ($${\color{red}+315.7\%}$$)
d_sint16.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_sint32.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_snorm8.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_uint16.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_uint32.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_unorm8.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_sint8.ts 87.71 kB ($${\color{red}+315.6\%}$$)
d_packedFormats.ts 87.71 kB ($${\color{red}+315.3\%}$$)
d_isPackedData.ts 87.71 kB ($${\color{red}+314.5\%}$$)
std_textureDimensions.ts 105.54 kB ($${\color{red}+303.4\%}$$)
std_textureGather.ts 105.54 kB ($${\color{red}+303.4\%}$$)
std_textureSampleBaseClampToEdge.ts 105.55 kB ($${\color{red}+303.3\%}$$)
std_textureSampleCompareLevel.ts 105.55 kB ($${\color{red}+303.3\%}$$)
std_textureSampleCompare.ts 105.54 kB ($${\color{red}+303.3\%}$$)
std_textureSampleLevel.ts 105.54 kB ($${\color{red}+303.3\%}$$)
std_textureSampleBias.ts 105.54 kB ($${\color{red}+303.3\%}$$)
std_textureSampleGrad.ts 105.54 kB ($${\color{red}+303.3\%}$$)
std_textureSample.ts 105.54 kB ($${\color{red}+303.3\%}$$)
std_textureStore.ts 105.54 kB ($${\color{red}+303.3\%}$$)
std_textureLoad.ts 105.53 kB ($${\color{red}+303.3\%}$$)
d_alignmentOf.ts 87.71 kB ($${\color{red}+297.9\%}$$)
std_translation4.ts 105.54 kB ($${\color{red}+287.8\%}$$)
std_rotationX4.ts 105.53 kB ($${\color{red}+287.8\%}$$)
std_rotationY4.ts 105.53 kB ($${\color{red}+287.8\%}$$)
std_rotationZ4.ts 105.53 kB ($${\color{red}+287.8\%}$$)
std_identity2.ts 105.53 kB ($${\color{red}+287.7\%}$$)
std_identity3.ts 105.53 kB ($${\color{red}+287.7\%}$$)
std_identity4.ts 105.53 kB ($${\color{red}+287.7\%}$$)
std_scaling4.ts 105.53 kB ($${\color{red}+287.7\%}$$)
d_isBuiltin.ts 87.71 kB ($${\color{red}+254.1\%}$$)
d_sizeOf.ts 87.71 kB ($${\color{red}+253.4\%}$$)
d_isContiguous.ts 87.71 kB ($${\color{red}+253.3\%}$$)
d_getLongestContiguousPrefix.ts 87.73 kB ($${\color{red}+253.2\%}$$)
d_arrayOf.ts 87.71 kB ($${\color{red}+234.0\%}$$)
d_size.ts 87.71 kB ($${\color{red}+230.9\%}$$)
d_align.ts 87.71 kB ($${\color{red}+230.9\%}$$)
d_location.ts 87.71 kB ($${\color{red}+230.9\%}$$)
d_interpolate.ts 87.71 kB ($${\color{red}+230.8\%}$$)
d_invariant.ts 87.71 kB ($${\color{red}+226.3\%}$$)
d_mat4x4f.ts 87.71 kB ($${\color{red}+222.3\%}$$)
d_mat2x2f.ts 87.71 kB ($${\color{red}+222.2\%}$$)
d_mat3x3f.ts 87.71 kB ($${\color{red}+222.2\%}$$)
d_matToArray.ts 87.71 kB ($${\color{red}+220.7\%}$$)
d_builtin.ts 87.71 kB ($${\color{red}+205.4\%}$$)
std_unpack2x16float.ts 105.54 kB ($${\color{red}+191.0\%}$$)
std_unpack4x8unorm.ts 105.54 kB ($${\color{red}+191.0\%}$$)
std_pack2x16float.ts 105.54 kB ($${\color{red}+191.0\%}$$)
std_pack4x8unorm.ts 105.54 kB ($${\color{red}+191.0\%}$$)
std_bitcastU32toF32.ts 105.54 kB ($${\color{red}+137.5\%}$$)
std_bitcastU32toI32.ts 105.54 kB ($${\color{red}+137.4\%}$$)
std_neg.ts 105.53 kB ($${\color{red}+116.7\%}$$)
std_bitShiftRight.ts 105.54 kB ($${\color{red}+116.7\%}$$)
std_bitShiftLeft.ts 105.54 kB ($${\color{red}+116.7\%}$$)
std_add.ts 105.53 kB ($${\color{red}+116.6\%}$$)
std_div.ts 105.53 kB ($${\color{red}+116.6\%}$$)
std_mod.ts 105.53 kB ($${\color{red}+116.6\%}$$)
std_mul.ts 105.53 kB ($${\color{red}+116.6\%}$$)
std_sub.ts 105.53 kB ($${\color{red}+116.6\%}$$)
std_translate4.ts 105.53 kB ($${\color{red}+113.0\%}$$)
std_rotateX4.ts 105.53 kB ($${\color{red}+113.0\%}$$)
std_scale4.ts 105.53 kB ($${\color{red}+113.0\%}$$)
std_rotateY4.ts 105.53 kB ($${\color{red}+113.0\%}$$)
std_rotateZ4.ts 105.53 kB ($${\color{red}+113.0\%}$$)
d_memoryLayoutOf.ts 87.72 kB ($${\color{red}+108.2\%}$$)
std_and.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_or.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_select.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_allEq.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_all.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_not.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_eq.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_lt.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_ne.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_isCloseTo.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_any.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_ge.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_gt.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_le.ts 105.53 kB ($${\color{red}+101.8\%}$$)
std_dot4U8Packed.ts 105.54 kB ($${\color{red}+57.0\%}$$)
std_length.ts 105.53 kB ($${\color{red}+57.0\%}$$)
std_countTrailingZeros.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_distance.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_dot.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_countLeadingZeros.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_firstTrailingBit.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_firstLeadingBit.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_fract.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_frexp.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_modf.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_quantizeToF16.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_mix.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_countOneBits.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_dot4I8Packed.ts 105.54 kB ($${\color{red}+56.9\%}$$)
std_determinant.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_extractBits.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_faceForward.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_inverseSqrt.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_reverseBits.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_insertBits.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_smoothstep.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_normalize.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_transpose.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_saturate.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_degrees.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_radians.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_reflect.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_refract.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_acosh.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_asinh.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_atan2.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_atanh.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_clamp.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_cross.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_floor.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_ldexp.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_round.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_trunc.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_acos.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_asin.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_atan.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_ceil.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_cosh.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_exp2.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_log2.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_sign.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_sinh.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_sqrt.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_step.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_tanh.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_abs.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_cos.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_exp.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_fma.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_log.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_max.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_min.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_pow.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_sin.ts 105.53 kB ($${\color{red}+56.9\%}$$)
std_tan.ts 105.53 kB ($${\color{red}+56.9\%}$$)
common_fullScreenTriangle.ts 57.22 kB ($${\color{red}+41.5\%}$$)
common_writeSoA.ts 57.21 kB ($${\color{red}+38.2\%}$$)
STATIC_allImports.ts 289.98 kB ($${\color{green}-1.7\%}$$)
STATIC_d.ts 87.70 kB ($${\color{green}-2.6\%}$$)
STATIC_std.ts 105.52 kB ($${\color{green}-2.6\%}$$)

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

@github-actions

github-actions Bot commented Jul 7, 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.96, 1.85, 4.13, 6.62, 8.37, 11.19, 21.73, 23.54]
  line [0.96, 2.01, 4.35, 6.63, 7.79, 10.58, 23.96, 22.64]
  line [0.91, 1.93, 4.39, 7.14, 8.33, 11.16, 22.59, 25.85]
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.61, 0.70, 0.87, 1.15, 1.23, 1.47, 1.68]
  line [0.36, 0.56, 0.70, 0.85, 1.15, 1.21, 1.51, 1.65]
  line [0.29, 0.49, 0.76, 0.83, 1.13, 1.21, 1.46, 1.60]
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.95, 2.16, 4.69, 7.39, 13.68, 27.55, 56.39, 116.20]
  line [0.80, 2.21, 4.94, 7.04, 13.17, 26.48, 55.21, 116.74]
  line [0.79, 2.13, 4.02, 6.39, 13.08, 26.44, 57.48, 115.59]
Loading

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.

Pull request overview

This PR extends the TGSL snippet system to track possibleSideEffects more precisely, enabling additional safe codegen optimizations (notably allowing runtime-value ternaries when both branches are side-effect-free) and adds/expands tests around side-effect classification.

Changes:

  • Thread possibleSideEffects through snippet creation/conversion paths (generator, conversion helpers, resource handles, raw snippets, etc.).
  • Relax ternary restrictions by permitting runtime conditions when both branches are proven side-effect-free (compiled to select()).
  • Expand side-effect test coverage across literals, resources, accessors, indexing, conversions, refs, and logical operators.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/typegpu/tests/utils/parseResolved.ts Improves return-expression extraction by using typed expression generation when return type is known; broadens expectSideEffects input types.
packages/typegpu/tests/tgsl/sideEffects.test.ts Adds extensive side-effect classification tests for many TGSL constructs and resource reads.
packages/typegpu/src/tgsl/wgslGenerator.ts Propagates possibleSideEffects across generated snippets and updates conditional/select and operator logic.
packages/typegpu/src/tgsl/generationHelpers.ts Preserves possibleSideEffects through concretization/coercion helpers.
packages/typegpu/src/tgsl/forOfUtils.ts Marks range/default iteration snippets as side-effect-free constants.
packages/typegpu/src/tgsl/conversion.ts Preserves possibleSideEffects across snippet conversions/actions.
packages/typegpu/src/std/boolean.ts Updates default precision snippet to be explicitly side-effect-free.
packages/typegpu/src/resolutionCtx.ts Ensures snippet resolution preserves possibleSideEffects.
packages/typegpu/src/data/snippet.ts Clarifies semantics/docs for possibleSideEffects and documents snip’s default behavior.
packages/typegpu/src/data/ref.ts Threads possibleSideEffects through ref/deref operations.
packages/typegpu/src/core/variable/tgpuVariable.ts Marks variable .$ snippet generation as side-effect-free.
packages/typegpu/src/core/unroll/tgpuUnroll.ts Preserves possibleSideEffects when resolving/unrolling iterables.
packages/typegpu/src/core/texture/texture.ts Marks texture-view handle snippets as side-effect-free.
packages/typegpu/src/core/texture/externalTexture.ts Marks external texture handle snippets as side-effect-free.
packages/typegpu/src/core/slot/accessor.ts Avoids eagerly executing GPU-callable functions during accessor resolution; propagates possibleSideEffects when calling functions.
packages/typegpu/src/core/sampler/sampler.ts Marks sampler handle snippets as side-effect-free.
packages/typegpu/src/core/rawCodeSnippet/tgpuRawCodeSnippet.ts Adds possibleSideEffects parameter to raw snippets and preserves it in .$ and resolution.
packages/typegpu/src/core/function/dualImpl.ts Sets function call snippet possibleSideEffects using options.sideEffects and/or argument side effects.
apps/typegpu-docs/src/content/docs/apis/utils.mdx Documents ternary relaxation for side-effect-free branches and the new possibleSideEffects raw snippet parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/typegpu/src/tgsl/wgslGenerator.ts
Comment thread packages/typegpu/tests/tgsl/sideEffects.test.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — minor suggestions inline.

Reviewed changes — this PR threads possibleSideEffects through TypeGPU's snippet resolution and codegen so runtime ternaries can safely lower to select() when both branches are pure.

  • Propagate side-effect bits across snip() call sites in accessors, refs, conversions, struct/array constructors, unary/binary operators, loops, raw snippets, and DualImpl calls.
  • Mark pure sources as side-effect-free: literals, constants, parameters, variable reads, buffer/texture/sampler handles, and pure builtins.
  • Keep impure calls conservative: user-defined functions and builtins like discard/atomics remain possibleSideEffects: true.
  • Expand test coverage in sideEffects.test.ts for pure and impure expression shapes, and update docs to reflect that runtime ternary conditions are allowed when branches are pure.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/tgsl/wgslGenerator.ts Outdated
Comment thread packages/typegpu/tests/tgsl/sideEffects.test.ts Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in the latest push; prior feedback still stands.

Reviewed changes since last review — the latest push restores the atomicLoad example in DualImplOptions.sideEffects docs and switches the punctuation back to ASCII arrows/hyphens.

  • Docs-only polish in packages/typegpu/src/core/function/dualImpl.ts.

Pullfrog  | Fix it ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The latest push addresses the prior ! constant-fallback feedback, but the updated float NaN guard now misclassifies 0.0 as NaN.

Reviewed changes — the latest commit switches the unary ! constant fallback to possibleSideEffects: false and polishes the side-effect test suite, including renaming tests, using std.isBeingTranspiled, broadening expectSideEffects, and routing returns through _typedExpression in the test helper.

  • Addressed prior feedback in packages/typegpu/src/tgsl/wgslGenerator.ts by returning possibleSideEffects: false for the constant ! fallback.
  • Polished sideEffects.test.ts with clearer test names, reorganized cases, additional ! and conversion coverage, and std.* builtins.
  • Updated parseResolved.ts to type return expressions against the function return type and accept TgpuFn in expectSideEffects.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/tgsl/wgslGenerator.ts
Comment thread packages/typegpu/tests/tgsl/sideEffects.test.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in the latest push; prior feedback still stands.

Reviewed changes since last review — added coverage for zero-argument dualFn accessors and polished a side-effect test name.

  • Added allows zero-argument dualFn test in packages/typegpu/tests/accessor.test.ts to verify tgpu.accessor(d.bool, std.subgroupElect).$ resolves correctly.
  • Renamed side-effect test in packages/typegpu/tests/tgsl/sideEffects.test.ts from "pure function access from accessor" to "pure function call from accessor".

Pullfrog  | Fix it ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/core/unroll/tgpuUnroll.ts Outdated
Comment thread packages/typegpu/src/core/unroll/tgpuUnroll.ts Outdated
Comment thread packages/typegpu/src/data/ref.ts Outdated
@cieplypolar cieplypolar requested a review from iwoplaza July 7, 2026 16:26
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.

bug: possibleSideEffects are not propagated correctly

3 participants