From 7aab2a34342ce27ddb6400e4720b6eff4b51e94c Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Sun, 6 Jul 2025 16:54:21 -0700 Subject: [PATCH 1/6] init branch --- examples/webgpu_compute_reduce.html | 741 ++++++++++++++++++++++++++++ 1 file changed, 741 insertions(+) create mode 100644 examples/webgpu_compute_reduce.html diff --git a/examples/webgpu_compute_reduce.html b/examples/webgpu_compute_reduce.html new file mode 100644 index 00000000000000..c691777996f2d9 --- /dev/null +++ b/examples/webgpu_compute_reduce.html @@ -0,0 +1,741 @@ + + + three.js webgpu - compute reduction + + + + + + +
+ three.js +
This example demonstrates the performance of various simple parallel reduction kernels. +
Reference implementations are translated from the CUDA code present in the following books/repos: +
Programming in Parallel with CUDA by Richard Ansorge +
+
+
+
+ + + + + + \ No newline at end of file From e5792f2dc2e8283e133244cfdb3cab2cfef935b6 Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Sun, 6 Jul 2025 16:57:16 -0700 Subject: [PATCH 2/6] add example meta data --- examples/files.json | 1 + examples/screenshots/webgpu_compute_reduce.jpg | Bin 0 -> 11445 bytes examples/tags.json | 1 + 3 files changed, 2 insertions(+) create mode 100644 examples/screenshots/webgpu_compute_reduce.jpg diff --git a/examples/files.json b/examples/files.json index 3a51bc11df9da8..c10a9cc96deb2d 100644 --- a/examples/files.json +++ b/examples/files.json @@ -313,6 +313,7 @@ "webgpu_compute_particles_rain", "webgpu_compute_particles_snow", "webgpu_compute_points", + "webgpu_compute_reduce", "webgpu_compute_sort_bitonic", "webgpu_compute_texture", "webgpu_compute_texture_3d", diff --git a/examples/screenshots/webgpu_compute_reduce.jpg b/examples/screenshots/webgpu_compute_reduce.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6664b13dd131dfefa222fe93d6342333386057e5 GIT binary patch literal 11445 zcmeHMc~leU7XLz66hTBl5tqm+i()~_rVwijA%ajqh*lpIMX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$NOl1$TH}OsX!cILLR!g2ertC$aM>twqo84o-6A^%N=Xy4j}Z)3X^$*Xj26 zvW;@Azh)MslY&mzb?VgbCWTdWpS;8zmQY95_pcDXYiv#z9d-bFcn2GF1W0KI{F5^dHU|I zyz@}~ujZ@KQJx0V8(#Q|2CGmx*Ly^vj%G#y&tM3L0vc7SjM3rat=s(^_dB#16dZmt z;48GDziptOxAGapv%s;o<AB%YD9TNcIWMADdDadQ~?Nai4XZhARHk5xej1;OyDT9yPHVH6B8{qhjN zl7|`%%T?iXBn60`sX2$xQlK~SS5BbK$9fG5w67`giRVyUq?ZqYzan271=-rqfgE(| zsoafEywE|a4LVVck>Q+_XuxsR`lJz1+gFB;YEhhg?*Nr+vfBv-T~3<=rIW&OQ-0-- z(f;L6OVJ46m~0seeu`MN909?%yb(Z2`y@&@VT}GaF*29pUxm?hEm_*&nL??&ji#$V zdxY3Ib+PN{-~wZn<%7b;S;Hw#eh8KB_GIxZ!w#3 zn*&=BP$FLV+91Hbl#`mufwr-}$%vE z^fb_rLr5S$swqDwc5g$#A!10w{+-9&Su>|36{Ej7kg)xVmBV(Hw4+bf@Pnj>>Zu%3 zr%p{(=9mIKA61xVX07BS*vNa6m-}{JB!$)QDfG>bdzkHfMX|H7)S@o;O6Hmu7VD4l zmCzh+4X{CTSZ~0UheOACyhF6J&_@YLnBk*2@Nr7w^jI5UN>dQTgbL7R|SUpphlr(sxN&~0gdPJSts`+g_Lw(cjbZy(%%} z?#E20r&OT>9M^nYW$3J|NZg;(7F1_uCFV1ScT)5j+?%CNeRjR~E{Vh67aT4$`om}m MJ^jI*D}g-v9YrSA%m4rY literal 0 HcmV?d00001 diff --git a/examples/tags.json b/examples/tags.json index 01c2dbbd681b00..b1b9ba0c5dafba 100644 --- a/examples/tags.json +++ b/examples/tags.json @@ -126,6 +126,7 @@ "webgpu_compute_particles_rain": [ "gpgpu" ], "webgpu_compute_particles_snow_external": [ "gpgpu" ], "webgpu_compute_points": [ "gpgpu" ], + "webgpu_compute_reduce": [ "gpgpu" ], "webgpu_compute_sort_bitonic": [ "gpgpu" ], "webgpu_compute_texture": [ "gpgpu" ], "webgpu_compute_texture_pingpong": [ "gpgpu" ], From 753bc01046310ff391e90489b872c0ea9a3f7525 Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Mon, 7 Jul 2025 19:24:31 -0700 Subject: [PATCH 3/6] remove logs, simplify comments, use more appropriate syntax (instancedArray instead of storage) --- examples/webgpu_compute_reduce.html | 97 ++++++++++++----------------- 1 file changed, 40 insertions(+), 57 deletions(-) diff --git a/examples/webgpu_compute_reduce.html b/examples/webgpu_compute_reduce.html index c691777996f2d9..fb05e568153a54 100644 --- a/examples/webgpu_compute_reduce.html +++ b/examples/webgpu_compute_reduce.html @@ -55,7 +55,7 @@ From d0fec846485c95bf16f965cf20873f14f446340c Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Mon, 7 Jul 2025 21:47:48 -0700 Subject: [PATCH 5/6] remove unused function --- examples/webgpu_compute_reduce.html | 6 ------ 1 file changed, 6 deletions(-) diff --git a/examples/webgpu_compute_reduce.html b/examples/webgpu_compute_reduce.html index c9ca22a97eb577..ee064435367ead 100644 --- a/examples/webgpu_compute_reduce.html +++ b/examples/webgpu_compute_reduce.html @@ -483,12 +483,6 @@ ]; - const createReduce4Fn = ( workgroupSize, dispatch, numElements ) => { - - - - }; - const calls = { 'Reduce 0 (N/2)': reduce0Calls, 'Reduce 1 (Naive Accumulate)': reduce1Calls, From ba57a26d0b0ea07f2b0e6e9d5842ce5bcaa8336f Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Mon, 7 Jul 2025 21:58:53 -0700 Subject: [PATCH 6/6] add screenshot to puppeteer exceptions --- test/e2e/puppeteer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e/puppeteer.js b/test/e2e/puppeteer.js index a4b2784928f7a6..2ee266c9fd96ce 100644 --- a/test/e2e/puppeteer.js +++ b/test/e2e/puppeteer.js @@ -140,6 +140,7 @@ const exceptionList = [ // Awaiting for WebGPU Backend support in Puppeteer 'webgpu_storage_buffer', 'webgpu_compute_sort_bitonic', + 'webgpu_compute_reduce', 'webgpu_struct_drawindirect', // WebGPURenderer: Unknown problem