Xenova HF Staff commited on
Commit
eebf847
·
verified ·
1 Parent(s): 427a1a2

sync c928d21e6cc1

Browse files
build/webgpu/binary-broadcast.wgsl.jinja CHANGED
@@ -4,23 +4,14 @@ fn main(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgroups)
4
  // 2D-folded flat index: gid.y carries the high bits when the element count exceeds the
5
  // maxComputeWorkgroupsPerDimension limit (the dispatch caps x and spills the rest into y).
6
  let invocation = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
7
- {% if source.itemsPerInvocation is defined %}
8
  // Tail-safe scalar x4 keeps vector-like dispatch density without requiring
9
  // the logical tensor length (or its storage binding) to be vec4 aligned.
10
  let begin = invocation * {{ source.itemsPerInvocation }}u;
11
  let end = min(begin + {{ source.itemsPerInvocation }}u, params.count);
12
  for (var i = begin; i < end; i = i + 1u) {
13
- {%- else %}
14
- let i = invocation;
15
- if (i >= params.count) {
16
- return;
17
- }
18
- {%- endif %}
19
- {% endmacro %}
20
  {% macro flat_tail_close() %}
21
- {% if source.itemsPerInvocation is defined %}
22
  }
23
- {% endif %}
24
  {% endmacro %}
25
 
26
  {% macro offset_fn(fn_name, opShape, opRank, op_same, op_numel, outShape, outRank, out_numel) %}
 
4
  // 2D-folded flat index: gid.y carries the high bits when the element count exceeds the
5
  // maxComputeWorkgroupsPerDimension limit (the dispatch caps x and spills the rest into y).
6
  let invocation = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
 
7
  // Tail-safe scalar x4 keeps vector-like dispatch density without requiring
8
  // the logical tensor length (or its storage binding) to be vec4 aligned.
9
  let begin = invocation * {{ source.itemsPerInvocation }}u;
10
  let end = min(begin + {{ source.itemsPerInvocation }}u, params.count);
11
  for (var i = begin; i < end; i = i + 1u) {
12
+ {%- endmacro %}
 
 
 
 
 
 
13
  {% macro flat_tail_close() %}
 
14
  }
 
15
  {% endmacro %}
16
 
17
  {% macro offset_fn(fn_name, opShape, opRank, op_same, op_numel, outShape, outRank, out_numel) %}
build/webgpu/manifest.json CHANGED
@@ -200,7 +200,8 @@
200
  "bRank": "ranks.B",
201
  "cRank": "ranks.C",
202
  "op": "\"div\"",
203
- "cDtype": "tensorDtypes.C"
 
204
  }
205
  },
206
  "bindings": [
@@ -226,7 +227,7 @@
226
  "struct": { "name": "Params", "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.C)" }] }
227
  }
228
  ],
229
- "dispatch": { "threads": "numel(shapes.C)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
230
  }
231
  ]
232
  }
 
200
  "bRank": "ranks.B",
201
  "cRank": "ranks.C",
202
  "op": "\"div\"",
203
+ "cDtype": "tensorDtypes.C",
204
+ "itemsPerInvocation": 4
205
  }
206
  },
207
  "bindings": [
 
227
  "struct": { "name": "Params", "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.C)" }] }
228
  }
229
  ],
230
+ "dispatch": { "threads": "ceilDiv(numel(shapes.C), 4)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
231
  }
232
  ]
233
  }
build/webgpu/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "ai.onnx.Div",
3
- "id": "_ai_onnx_div_webgpu_9467649",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
@@ -9,12 +9,12 @@
9
  "files": {
10
  "bench.json": "T8ahwVvFuvykKXC3r8ulXGaNXUQDbPI1PbKp5rqstSQ=",
11
  "binary-broadcast-vec4.wgsl.jinja": "U3eGI7MMFuwzIsyzIo+9YCReBwWqdMojY4wfH4yOWOU=",
12
- "binary-broadcast.wgsl.jinja": "hyTo/QI6/9I5TVuqD9MrooSb/hxNGsrwOg/b8Phbr9g=",
13
  "binary-vec4.wgsl.jinja": "d/SCw5hd7ZTCW1+V/zDeZmzTq2Cvy/VGcup4xlfnW+g=",
14
- "manifest.json": "C4DQRfrhZB1r/+6SiF4W0erh8QdowaaM8w8ns1iFS3U=",
15
  "test.json": "nI5UD3dutlCko0fqrCnHpndsor6lw9SEhDbEPGMZst4="
16
  }
17
  },
18
- "provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
19
  "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.Div" }
20
  }
 
1
  {
2
  "name": "ai.onnx.Div",
3
+ "id": "_ai_onnx_div_webgpu_af5d5b7",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
 
9
  "files": {
10
  "bench.json": "T8ahwVvFuvykKXC3r8ulXGaNXUQDbPI1PbKp5rqstSQ=",
11
  "binary-broadcast-vec4.wgsl.jinja": "U3eGI7MMFuwzIsyzIo+9YCReBwWqdMojY4wfH4yOWOU=",
12
+ "binary-broadcast.wgsl.jinja": "ZA6kUovcMlxJK9HzmH0+wH0TlN2L0iGq57j5ayF+Sl8=",
13
  "binary-vec4.wgsl.jinja": "d/SCw5hd7ZTCW1+V/zDeZmzTq2Cvy/VGcup4xlfnW+g=",
14
+ "manifest.json": "fbw8UcqY7Gfrzy2KqagX1azKQlVfXg5RUivgVT5pxL8=",
15
  "test.json": "nI5UD3dutlCko0fqrCnHpndsor6lw9SEhDbEPGMZst4="
16
  }
17
  },
18
+ "provenance": { "kernel": { "sha": "c928d21e6cc1310861cba3bafb75f5f679ecf5f3", "dirty": false } },
19
  "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.Div" }
20
  }