File size: 2,041 Bytes
e3afe0f
 
 
 
bb904f8
 
e3afe0f
bb904f8
 
 
e3afe0f
 
 
 
bb904f8
 
e3afe0f
 
 
 
bb904f8
 
 
 
 
 
 
 
 
 
 
 
e3afe0f
 
 
 
 
 
 
 
 
bb904f8
 
 
 
 
 
 
 
 
 
 
 
e3afe0f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  "domain": "ai.onnx",
  "name": "BitwiseNot",
  "sinceVersion": 18,
  "inputs": { "x": { "onnx": "X", "dtype": "T" } },
  "outputs": { "y": { "onnx": "Y", "dtype": "T", "rank": "ranks.x", "shape": "shapes.x" } },
  "typeConstraints": { "T": ["uint32", "int32", "int16", "uint8", "int8"] },
  "tunables": { "WORKGROUP_SIZE": { "default": 256 } },
  "derive": { "shapeContract": "numel(shapes.x) == numel(shapes.y)", "logicalDtype": "tensorDtypes.y" },
  "when": ["shapeContract"],
  "variants": [
    {
      "id": "elementwise_vec4",
      "priority": 20,
      "when": ["numel(shapes.x) % 4 == 0"],
      "derive": { "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
      "passes": [
        {
          "id": "main",
          "name": "BitwiseNot.vec4",
          "shader": "bitwise-not.wgsl.jinja",
          "derive": { "vectorizedSpec": true },
          "bindings": [
            { "arg": "x", "elementType": "$vectorScalar" },
            { "arg": "y", "elementType": "$vectorScalar" },
            { "name": "params", "struct": [{ "name": "count", "type": "u32", "value": "numel(shapes.y) / 4" }] }
          ],
          "dispatch": {
            "x": "min(ceilDiv((numel(shapes.y) / 4), (tunables.WORKGROUP_SIZE)), 65535)",
            "y": "ceilDiv(ceilDiv((numel(shapes.y) / 4), (tunables.WORKGROUP_SIZE)), 65535)",
            "z": 1
          }
        }
      ]
    },
    {
      "id": "elementwise",
      "passes": [
        {
          "id": "main",
          "name": "BitwiseNot",
          "shader": "bitwise-not.wgsl.jinja",
          "derive": { "vectorizedSpec": false },
          "bindings": [
            "x",
            "y",
            { "name": "params", "struct": [{ "name": "count", "type": "u32", "value": "numel(shapes.y)" }] }
          ],
          "dispatch": {
            "x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)",
            "y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)",
            "z": 1
          }
        }
      ]
    }
  ]
}