From 92a8407b392bf87f2d0d0d556a2eb6dfe2929eef Mon Sep 17 00:00:00 2001 From: Xu Xing Date: Sat, 13 Jul 2024 03:34:34 +0800 Subject: [PATCH] [js/webgpu] Remove unnecessary initialization of var (#21312) This var has been initialized to 0 in tint, so no need extra loop to do it again: ``` float tint_symbol_52[1][4] = (float[1][4])0; { for(int tint_symbol_53 = 0; (tint_symbol_53 < 1); tint_symbol_53 = (tint_symbol_53 + 1)) { { for(int tint_symbol_54 = 0; (tint_symbol_54 < 4); tint_symbol_54 = (tint_symbol_54 + 1)) { tint_symbol_52[min(uint(tint_symbol_53), 0u)][min(uint(tint_symbol_54), 3u)] = 0.0f; } } } } ``` ### Description ### Motivation and Context --- .../wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts index 29c7941e6bd30..9b37247167bab 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts @@ -328,13 +328,6 @@ fn main(@builtin(local_invocation_id) localId : vec3, var kStart = ${splitK ? `i32(globalId.z) * ${splitedDimInner}` : '0'}; var acc : array, rowPerThread>; - - // Without this initialization strange values show up in acc. - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - acc[innerRow][innerCol] = 0.0; - } - } ${matmulSnippet} } `;