Skip to content

Add New Operators to the Generic Target - #213

Draft
mohasnik wants to merge 3 commits into
pulp-platform:develfrom
mohasnik:extra-layers
Draft

mohasnik wants to merge 3 commits into
pulp-platform:develfrom
mohasnik:extra-layers

Conversation

@mohasnik

@mohasnik mohasnik commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds 24 new ONNX layer implementations to Deeploy’s Generic backend:

  1. And
  2. Cast
  3. Cos
  4. Equal
  5. Erf
  6. Expand
  7. GatherElements
  8. Greater
  9. GridSample
  10. IsInf
  11. IsNaN
  12. Less
  13. Log
  14. Mod
  15. Not
  16. ReduceMax
  17. Resize
  18. ScatterND
  19. Sin
  20. Split
  21. Tanh
  22. Tile
  23. TopK
  24. Where

The implementation includes the corresponding parsers, layers, type checkers, bindings, code-generation templates, and Generic C kernels.

Data Type Support

Each layer supports selected input and output data types through its bindings. Supporting additional data types may require extending the bindings, type checkers, templates, or kernels.

Boolean data type: Some of the provided layers apply Boolean operations or expect Boolean data types. Since Deeploy does not support this data type in the backend yet, it is represented by uint8_t.

ONNX Compatibility and Known Limitations

The following section explains the known limitations of each layer and whether they are fully compatible with the ONNX standard.

Fully Compatible Layers

  • IsNaN
  • IsInf
  • Tanh
  • Sin
  • Cos

Limited Layers

And

  • Broadcasting is not implemented: the template indexes both inputs directly using the output element count. Inputs must have matching shapes.

Not

  • Does not apply Deeploy’s signedness offsets, so offset-encoded Boolean inputs can produce incorrect result

ReduceMax

  • Direct code generation handles one reduction axis per node (len(axes) == 1).
  • UnrollReduceMaxPass decomposes a multi-axis reduction into a sequence of single-axis ReduceMax nodes when keepdims = 0.
  • The unrolling pass does not transform nodes with keepdims = 1. The parser does not explicitly validate this attribute.
  • The parser requires axes as a node attribute; it does not read axes from an input tensor.

ScatterND

  • Supports FP32 or int8_t data, updates, and output, with int64_t indices.
  • Requires the updates shape to match indices.shape[:-1] + data.shape[k:].
  • Supports replacement updates only. The add, mul, max, and min reduction modes raise an exception.
  • Negative indices are not wrapped relative to the corresponding dimensions.
  • Index bounds and index-tuple length are not fully validated.
  • Duplicate indices are not rejected; later updates overwrite earlier ones.

The remaining layers not listed above are currently undergoing testing and evaluation to identify and/or resolve any limitations.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant