You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f67adf5
Browse filesBrowse the repository at this point in the historyBrowse files
Qualcomm AI Engine Direct - Adding QNN backend support for scatter.value core ATen op (pytorch#20998)
### Summary
Adds support for `aten.scatter.value` on the QNN backend by extending
the existing `ScatterElements` builder.
`torch.scatter(data, dim, index, value)` scatters a scalar `value` into
`data` at positions specified by `index`. Unlike `scatter.src` (which
takes a tensor), `scatter.value` takes a scalar which requires special
handling in the builder to convert the scalar to a static tensor
compatible with QNN's `ScatterElements` op.
Also updated the `new_op_development` Claude skill to include testing
information for the new testing framework.
### Test plan
```
pytest backends/qualcomm/tests/rework/htp/op/v68/test.py -k "test_scatter_value" -v
python backends/qualcomm/tests/test_qnn_delegate.py TestQNNQuantizedOperator.test_qnn_backend_scatter_value --soc_model SM8750 --host aisw-vm15-labsd --device 545ee4aa --build_folder build-android
python backends/qualcomm/tests/test_qnn_delegate.py TestQNNFloatingPointOperator.test_qnn_backend_scatter_value --soc_model SM8750 --host aisw-vm15-labsd --device 545ee4aa --build_folder build-android
```
Emulator-based tests at `backends/qualcomm/tests/rework/` — no device needed, preferred for CI. Read existing ops in `src/op.py` for reference patterns.
171
+
172
+
**Add op class** to `tests/rework/src/op.py` (alphabetical by *class name* in `src/op.py` and by *function name* in `test.py`
173
+
). All imports (`torch`, `itertools`, `unpack_fixtures`, `export_and_verify`) are file-level — don't add per-class. Class is auto-exported via `from ... import *` in test.py. Use `__class__` (Python idiom for enclosing class in `@staticmethod`):
- Multi-output ops (sort, topk): only return float tensors — don't expose raw int indices as outputs (causes dtype/memory issues). Use `gather` to consume indices or return only values.
207
+
-`subtests` fixture requires `pytest-subtests` package. Omit for single-case ops (use just `qnn_config, quantizer, compile_spec, expected` params).
208
+
- Some ops fail on x86 emulator but work on-device (TopK/Sort fp, scatter.value quantized). Mark with `pytest.raises(AssertionError)`.
209
+
210
+
---
211
+
168
212
## Step 9: Prevent Decomposition (if needed)
169
213
170
214
If the ATen op exists in ExecuTorch's decomp table and you have a builder for it:
0 commit comments