| { |
| "domain": "ai.onnx", |
| "name": "BitwiseNot", |
| "sinceVersion": 18, |
| "description": "Applies a bitwise NOT to each element of the input tensor, flipping every bit. The output has the same shape and integer dtype as the input.", |
| "inputs": [{ "role": "X", "dtype": "T", "description": "Input integer tensor." }], |
| "outputs": [ |
| { |
| "role": "Y", |
| "dtype": "T", |
| "rank": "ranks.X", |
| "description": "Output tensor with each element bitwise-negated; same shape and dtype as `X`.", |
| "shape": "shapes.X" |
| } |
| ], |
| "typeConstraints": { "T": ["uint32", "int32", "int16", "uint8", "int8"] }, |
| "args": { |
| "x": { "kind": "tensor", "semantic": "X", "role": "input" }, |
| "y": { "kind": "tensor", "semantic": "Y", "role": "output" } |
| }, |
| "tunables": { "WORKGROUP_SIZE": 256 }, |
| "derive": { "shapeContract": "numel(shapes.X) == numel(shapes.Y)" }, |
| "constants": { "logicalDtype": "tensorDtypes.Y" }, |
| "bindingSets": { |
| "vector": [ |
| { "name": "x", "arg": "x", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, |
| { "name": "y", "arg": "y", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, |
| { |
| "name": "params", |
| "semantic": "kernel.params", |
| "buffer": { "type": "uniform" }, |
| "struct": { "name": "Params", "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.y) / 4" }] } |
| } |
| ], |
| "scalar": [ |
| { "name": "x", "arg": "x", "semantic": "X", "buffer": { "type": "read-only-storage" }, "elementType": "$T" }, |
| { "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$T" }, |
| { |
| "name": "params", |
| "semantic": "kernel.params", |
| "buffer": { "type": "uniform" }, |
| "struct": { "name": "Params", "fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.Y)" }] } |
| } |
| ] |
| }, |
| "variants": [ |
| { |
| "id": "elementwise_vec4", |
| "priority": 20, |
| "when": ["numel(shapes.X) % 4 == 0", "shapeContract"], |
| "constants": { "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" }, |
| "passes": [ |
| { |
| "id": "main", |
| "name": "BitwiseNot.vec4", |
| "source": { "shader": "bitwise-not.wgsl.jinja", "inputs": { "vectorized": true } }, |
| "bindings": "vector", |
| "dispatch": { "threads": "numel(shapes.Y) / 4", "workgroupSize": "tunables.WORKGROUP_SIZE" } |
| } |
| ] |
| }, |
| { |
| "id": "elementwise", |
| "when": "shapeContract", |
| "passes": [ |
| { |
| "id": "main", |
| "name": "BitwiseNot", |
| "source": { "shader": "bitwise-not.wgsl.jinja", "inputs": { "vectorized": false } }, |
| "bindings": "scalar", |
| "dispatch": { "threads": "numel(shapes.Y)", "workgroupSize": "tunables.WORKGROUP_SIZE" } |
| } |
| ] |
| } |
| ] |
| } |
|
|