Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSL: SubgroupFunctionNode #30022

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

cmhhelgeson
Copy link
Contributor

Related issue: #XXXX

Description

Adds basic wave intrinsic/subgroup function support to TSL. Function definitions are derived from this link:
https://github.com/gpuweb/gpuweb/blob/main/proposals/subgroups.md.

Copy link

github-actions bot commented Dec 3, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.11
78.98
339.11
78.98
+0 B
+0 B
WebGPU 484.86
134.6
488.15
135.44
+3.29 kB
+844 B
WebGPU Nodes 484.32
134.5
487.61
135.34
+3.29 kB
+839 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465
112.04
465
112.04
+0 B
+0 B
WebGPU 554.24
150.04
556.83
150.73
+2.59 kB
+684 B
WebGPU Nodes 510.12
139.75
512.71
140.43
+2.59 kB
+676 B

import TempNode from '../core/TempNode.js';
import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js';

class SubgroupFunctionNode extends TempNode {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind adding JSDoc for SubgroupFunctionNode?

For new modules, we should add documentation right from the beginning. Use FunctionNode as an orientation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the class, how about this:

This class represents a set of built in WGSL shader functions that synchronously execute an operation across a subgroup, or 'wave', of compute or fragment shader invocations within a workgroup. Typically, these functions will synchronously execute an operation using data from all active invocations within the subgroup, then broadcast that result to all active invocations. In other graphics APIs, subgroup functions are also referred to as wave intrinsics (DirectX/HLSL) or warp intrinsics (CUDA).

@cmhhelgeson cmhhelgeson marked this pull request as ready for review December 4, 2024 18:53
@cmhhelgeson cmhhelgeson force-pushed the subgroup_function_node branch from 890d56f to 62fc41a Compare December 5, 2024 05:11
@cmhhelgeson cmhhelgeson marked this pull request as draft December 5, 2024 05:12
@cmhhelgeson cmhhelgeson force-pushed the subgroup_function_node branch from 62fc41a to 890d56f Compare December 5, 2024 05:16
@mrdoob mrdoob requested a review from sunag December 12, 2024 05:44
@sunag
Copy link
Collaborator

sunag commented Dec 12, 2024

It would be important if we had an example using this feature, just to be sure that this feature will be working release after release.

@cmhhelgeson
Copy link
Contributor Author

It would be important if we had an example using this feature, just to be sure that this feature will be working release after release.

Working on it 👍. Been busy with work.

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.

3 participants