Xenova HF Staff commited on
Commit
24ebab4
·
verified ·
1 Parent(s): ea833c8

sync c928d21e6cc1

Browse files
build/webgpu/bitwise-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
@@ -90,7 +90,8 @@
90
  "cShape": "shapes.C",
91
  "aRank": "ranks.A",
92
  "bRank": "ranks.B",
93
- "cRank": "ranks.C"
 
94
  }
95
  },
96
  "bindings": [
@@ -104,7 +105,7 @@
104
  "struct": { "name": "Params", "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.C)" }] }
105
  }
106
  ],
107
- "dispatch": { "threads": "numel(shapes.C)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
108
  }
109
  ]
110
  },
 
90
  "cShape": "shapes.C",
91
  "aRank": "ranks.A",
92
  "bRank": "ranks.B",
93
+ "cRank": "ranks.C",
94
+ "itemsPerInvocation": 4
95
  }
96
  },
97
  "bindings": [
 
105
  "struct": { "name": "Params", "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.C)" }] }
106
  }
107
  ],
108
+ "dispatch": { "threads": "ceilDiv(numel(shapes.C), 4)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
109
  }
110
  ]
111
  },
build/webgpu/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "ai.onnx.BitwiseAnd",
3
- "id": "_ai_onnx_bitwiseand_webgpu_fc31afb",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
@@ -8,12 +8,12 @@
8
  "algorithm": "sha256",
9
  "files": {
10
  "bench.json": "fRx315OyxB60G0bWyXB3DTHeebA2A5Krm0LATx+ggio=",
11
- "bitwise-binary-broadcast.wgsl.jinja": "N06Hs2oYVObcwu7yEYqmZQBNqGsjZGlVeWMhjxT23Hw=",
12
  "bitwise-binary-vec4.wgsl.jinja": "IO1Z3esuK46FeyJHI7IeZb9mo2iV7Ugp4we/V1WbKO4=",
13
- "manifest.json": "gQy4ymK2zflXsJlqRfiDKdS3O0qJ4PYc0cgfXssQI2U=",
14
  "test.json": "neQ6KvNwAJ/6IyyYII8qCB+Z0MYKiwA1A8Y8ugemDaA="
15
  }
16
  },
17
- "provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
18
  "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.BitwiseAnd" }
19
  }
 
1
  {
2
  "name": "ai.onnx.BitwiseAnd",
3
+ "id": "_ai_onnx_bitwiseand_webgpu_6e80cf2",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
 
8
  "algorithm": "sha256",
9
  "files": {
10
  "bench.json": "fRx315OyxB60G0bWyXB3DTHeebA2A5Krm0LATx+ggio=",
11
+ "bitwise-binary-broadcast.wgsl.jinja": "RCjn7BVX/bwpqqBWr5VMlxLy7mqeOJptl9+uJazGZ/w=",
12
  "bitwise-binary-vec4.wgsl.jinja": "IO1Z3esuK46FeyJHI7IeZb9mo2iV7Ugp4we/V1WbKO4=",
13
+ "manifest.json": "R/soQJlNHuIudBB4Obz05CjZ99bY9ppN1UpPTb4CJoc=",
14
  "test.json": "neQ6KvNwAJ/6IyyYII8qCB+Z0MYKiwA1A8Y8ugemDaA="
15
  }
16
  },
17
+ "provenance": { "kernel": { "sha": "c928d21e6cc1310861cba3bafb75f5f679ecf5f3", "dirty": false } },
18
  "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.BitwiseAnd" }
19
  }