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

Bitonic Sort Update 2 #318

Merged
merged 29 commits into from
Dec 4, 2023
Merged

Conversation

cmhhelgeson
Copy link
Contributor

  1. Collapsed Step Index and Total Steps into a single GUI element 'Current Step' to condense space
  2. Collapsed Grid Width and Grid Height into a single GUI element 'Grid Dimensions' to condense space
  3. Added a 'Thread Constraint' GUI element that constrains the maximum number of threads per workgroup to less than device.limits.maxComputeWorkgroupSizeX. Depending on the chosen thread constraint, the sort may dispatch more workgroups and/or execute more Global Flip and Disperse operations.

…'cell' to 'controller' to accord with Dat.gui's built in types
Merge main into my fork
…mic account of number of swaps performed during a sort
…workgroup, which reflects in the execution information as well
@cmhhelgeson
Copy link
Contributor Author

@ben-clayton Hoping to get this checked in to if that is also possible.

Copy link
Collaborator

@ben-clayton ben-clayton left a comment

Choose a reason for hiding this comment

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

At the bottom of main.ts you have:

      {
        name: './bitonicCompute.frag.wgsl',
        contents: NaiveBitonicCompute(64),
      },

As you're replacing ${threadsPerWorkgroup} with 64 in the source view of the sample, this gives the impression that it's always 64, when it is not. This had me scratching my head for ages. I'd strongly recommend showing the real, unprocessed, WGSL source.

src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
…ed portions of code, codeMirror for compute shader now displays the .ts file from which the compute shader is constructed rather than a version of the compute shader that takes an arbitrary number of invocationsPerWorkgroup
Copy link
Collaborator

@ben-clayton ben-clayton left a comment

Choose a reason for hiding this comment

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

Thank you for the changes so far. This is helped me understand the code a lot better. I've made a few more terminology suggestions that I think would help.

src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/bitonicCompute.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
for (let i = maxElements; i >= 4; i /= 2) {
totalElementLengths.push(i);
}

const totalInvocationLengths: number[] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe workgroupSizeOptions ?
Please add a comment saying that this is the list of 'Workgroup Size' that the user can select in the UI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's more accurate to say that it's the options for the size limit, so I changed to sizeLimitOptions.

src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Show resolved Hide resolved
@cmhhelgeson
Copy link
Contributor Author

@ben-clayton Added suggested changes, barring the naming issue with 'Size Limit'. I also rewrote many of the comments for the settings object, and wrote new comments for Step Type explaining the differences of each StepType category.

Copy link
Collaborator

@ben-clayton ben-clayton left a comment

Choose a reason for hiding this comment

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

A few more suggested changes to name. Nothing major, so approving.

This is much clearer (at least for me) to read. Thank you for all the changes!

src/sample/bitonicSort/bitonicCompute.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
src/sample/bitonicSort/main.ts Outdated Show resolved Hide resolved
@ben-clayton
Copy link
Collaborator

PR requires a rebase.

@cmhhelgeson
Copy link
Contributor Author

PR requires a rebase.

Is this a note for me or someone else?

@ben-clayton
Copy link
Collaborator

I meant you you, but I'm just getting confused by GitHub's UI. Ignore me.

@ben-clayton ben-clayton merged commit 6ab3292 into webgpu:main Dec 4, 2023
1 check passed
@cmhhelgeson cmhhelgeson deleted the bitonic_sort_branch branch December 4, 2023 21:56
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.

2 participants