Skip to content

add support for Operators for Generic target needed in MAGIA (again)#195

Open
marchioa wants to merge 12 commits into
pulp-platform:develfrom
FondazioneChipsIT:am/magia-kernels-2
Open

add support for Operators for Generic target needed in MAGIA (again)#195
marchioa wants to merge 12 commits into
pulp-platform:develfrom
FondazioneChipsIT:am/magia-kernels-2

Conversation

@marchioa

@marchioa marchioa commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

This PR is a PR193 follow up that adds the support for Operators needed for MAGIA that are not available in the Generic target.

Added

  • Elu: fp32 only
  • LeakyRelu: fp32 only
  • Selu: fp32 only
  • Scatter (deprecated) and ScatterElements: s8, u8, and fp32. Easily extendible to other standard datatypes as it is implemented with a define-based template.
  • Col2Im: s8, u8, and fp32. Exactly as in ScatterElements, it is implemented with a define-based template supporting any standard datatype.
  • Resize: s8, u8, and fp32. Easily extendible to other standard datatypes not because of a define-based template but because implemented with void pointers and simple helper functions depending on the data type.
  • ConvTranspose: fp32 only.
    • adds the 2D version of the kernel (only 1D was available).
    • adds support for missing optional attributes.
    • adds 1D and 2D tests.
    • general refactor (Parser, Layer, and Template). Main change: moved most parsing to the general ConvTranspose parser, leaving the dimension specific parser much simpler.

Changed

  • DeeployTypes.py: I added the possibility for an onnx operator to have empty inputs (e.g., Resize). I simply added some guards in the input parsing, buffer allocation and initialization, etc. to skip those inputs that have no name or type.

Fixed

  • ConvTranspose. Solved issue with output buffer shape due to shape computation in ConvTransposeLayer.

PR Merge Checklist

  1. The PR is rebased on the latest devel commit and pointing to devel.
  2. Your PR reviewed and approved.
  3. All checks are passing.
  4. The CHANGELOG.md file has been updated.
  5. If the docker was modified, change back its link after review.

@Victor-Jung

Copy link
Copy Markdown
Member

@marchioa
hippo

@marchioa marchioa force-pushed the am/magia-kernels-2 branch 2 times, most recently from e869395 to 106771a Compare June 23, 2026 07:52
@marchioa marchioa force-pushed the am/magia-kernels-2 branch from 8f9ee82 to 11a95c2 Compare July 2, 2026 10:10
@marchioa marchioa marked this pull request as ready for review July 2, 2026 10:49
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@marchioa, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 60e51073-560f-4ae9-9cee-506c22d37b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 72e708e and d9b5d14.

📒 Files selected for processing (1)
  • Deeploy/Targets/Generic/Templates/FloatSqrtTemplate.py
📝 Walkthrough

Walkthrough

This PR adds Generic-target support for new ONNX operators, splits ConvTranspose into 1D/2D variants, hardens input handling for empty names and missing buffer types, and updates related kernels, templates, bindings, tests, and changelog entries.

Changes

Generic target operator support and robustness

Layer / File(s) Summary
Empty inputs and missing buffer types
Deeploy/DeeployTypes.py, Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py
Parsing, type inference, binding, and memory/codegen paths now skip empty-name inputs and buffers without _type.
ConvTranspose 1D/2D split
Deeploy/Targets/Generic/Parsers.py, Layers.py, Bindings.py, Platform.py, Templates/ConvTransposeTemplate.py, TargetLibraries/Generic/inc/kernel/ConvTranspose_fp32.h, .../src/ConvTranspose_fp32.c, .../inc/kernel/ConvTranspose1d_fp32.h, .../src/ConvTranspose1d_fp32.c, DeeployTest/test_generic_config.py
ConvTranspose is refactored into separate 1D and 2D parser/binding/template/kernel paths with updated shape and op calculations.
Unary activations
Deeploy/Targets/Generic/Parsers.py, Layers.py, Bindings.py, Platform.py, Templates/Float{Unary,Elu,Selu,LeakyRelu}Template.py, kernel headers/sources, DeeployTest/test_generic_config.py
Adds ELU, SELU, and LeakyReLU support and introduces a shared float unary template helper.
Scatter, Col2Im, and Resize
Deeploy/Targets/Generic/Parsers.py, Layers.py, Bindings.py, Platform.py, Templates/{Scatter,Col2Im,Resize}Template.py, kernel headers/sources, DeeployTest/test_generic_config.py, TargetLibraries/Generic/inc/DeeployBasicMath.h
Adds Scatter/ScatterElements, Col2Im, and Resize support across type checking, templates, kernels, and Generic target wiring.
Generic type-checker cleanup
Deeploy/Targets/Generic/TypeCheckers.py
Introduces shared checker bases and replaces many per-operator checker definitions with aliases or lighter subclasses.
Numerical fixes and changelog
TargetLibraries/Generic/src/GlobalAveragePool_fp32.c, GlobalMaxPool_fp32.c, HardSwish_fp32.c, Layernorm_fp32.c, CHANGELOG.md
Adjusts several existing fp32 kernels and updates the unreleased changelog entries.

Estimated code review effort: 4 (Complex) | ~75 minutes

Possibly related PRs

  • pulp-platform/Deeploy#98: Both PRs touch the Generic ConvTranspose stack, including bindings, parsers, and kernel/template plumbing.

Suggested labels: Feature

Suggested reviewers: Xeratec, runwangdl, Victor-Jung

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the PR’s main change: adding Generic target operator support for MAGIA-related ONNX ops.
Description check ✅ Passed The description directly summarizes the same Generic target operator support and ConvTranspose/empty-input fixes in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py (1)

24-43: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard empty optional inputs before lookup()

parseInputs skips empty-name tensors, but the checker still walks the raw node.inputs list and calls ctxt.lookup(inputNode.name) unconditionally in both typeCheckNodeInputs and typeInferGlobalCtxt. An omitted optional input will still raise KeyError here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py` around lines 24
- 43, The SignPropTypeChecker logic is still calling ctxt.lookup on raw
node.inputs entries, so omitted optional inputs can raise KeyError even though
parseInputs skips them. Update SignPropTypeChecker.typeInferGlobalCtxt (and the
related input handling in the checker flow) to ignore inputs with empty/missing
names before lookup, matching the filtering already used in parseInputs and the
node.inputs iteration pattern.
Deeploy/DeeployTypes.py (1)

1294-1340: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Guard absent optional inputs here and in SignPropTypeChecker.typeInferGlobalCtxt
parseInputs skips empty-name ONNX optionals, but these loops still call ctxt.lookup(inputNode.name) unconditionally. That will raise on any missing optional input; skip empty names before lookup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/DeeployTypes.py` around lines 1294 - 1340, The optional-input
handling in type checking is incomplete because typeCheckNodeInputs and
SignPropTypeChecker.typeInferGlobalCtxt still call ctxt.lookup(inputNode.name)
for every input, including skipped ONNX optionals with empty names. Update both
loops to guard against empty input names before any lookup or annotation, and
only run the existing VariableBuffer/ConstantBuffer logic for real named inputs.
TargetLibraries/Generic/src/Layernorm_fp32.c (1)

45-91: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix the LayerNorm gradient formula to sum dy * scale.

The current expression factors scale[j] outside and averages raw grad_in, which gives incorrect grad_out when scale varies across the normalized dimension.

Proposed fix
-  float32_t sum_dy, sum_dy_scaled;
+  float32_t sum_dy_scaled, sum_dy_scaled_centered;
@@
-    sum_dy = 0.0f;
     sum_dy_scaled = 0.0f;
+    sum_dy_scaled_centered = 0.0f;
@@
-    // RW: Calculate sum(dy) and sum(dy * scale * (x - mean) / std)
+    // RW: Calculate sum(dy * scale) and sum(dy * scale * (x - mean) / std)
     for (int j = 0; j < lastDimLength; j++) {
-      sum_dy += grad_in[j + i * lastDimLength];
       centered_input = data_in[j + i * lastDimLength] - mean;
-      sum_dy_scaled +=
-          grad_in[j + i * lastDimLength] * scale[j] * centered_input * inv_std;
+      float32_t dy_scaled = grad_in[j + i * lastDimLength] * scale[j];
+      sum_dy_scaled += dy_scaled;
+      sum_dy_scaled_centered += dy_scaled * centered_input * inv_std;
@@
       grad_out[j + i * lastDimLength] =
-          inv_std * scale[j] *
-          (grad_in[j + i * lastDimLength] -
-           (sum_dy / (float32_t)lastDimLength) -
-           (centered_input * inv_std * inv_std / (float32_t)lastDimLength) *
-               sum_dy_scaled);
+          inv_std *
+          ((grad_in[j + i * lastDimLength] * scale[j]) -
+           (sum_dy_scaled / (float32_t)lastDimLength) -
+           (centered_input * inv_std / (float32_t)lastDimLength) *
+               sum_dy_scaled_centered);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@TargetLibraries/Generic/src/Layernorm_fp32.c` around lines 45 - 91, The
gradient computation in the LayerNorm backward pass is using the wrong
reduction: `sum_dy` currently accumulates raw `grad_in` and `scale[j]` is
applied outside the summed term, which breaks the formula when `scale` varies.
Update the `Layernorm_fp32` gradient logic so the reduction term sums `grad_in[j
+ i * lastDimLength] * scale[j]` across the normalized dimension, then use that
corrected aggregate in the `grad_out` expression while keeping the rest of the
`mean`, `variance`, and `sum_dy_scaled` flow intact.
🧹 Nitpick comments (3)
Deeploy/Targets/Generic/Layers.py (1)

817-817: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Ambiguous unicode multiplication sign in comment.

Ruff (RUF003) flags × in the comment; consider using ASCII x for tooling/portability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/Targets/Generic/Layers.py` at line 817, The comment in the layer
shape annotation uses a Unicode multiplication symbol that triggers Ruff RUF003.
Update the inline comment near the affected layer-shape notation to use plain
ASCII x instead of × so the documentation remains tooling-friendly and portable.

Source: Linters/SAST tools

Deeploy/Targets/Generic/Templates/FloatSeluTemplate.py (1)

9-23: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consolidate near-identical fp32 activation templates.

_SeluTemplate, _LeakyReluTemplate (FloatLeakyReluTemplate.py), and _EluTemplate (FloatEluTemplate.py) share identical alignToContext bodies, differing only in the emitted kernel name and extra scalar args. Consider a shared base class (e.g. _UnaryElementwiseTemplate) that computes size/type_width once, with subclasses only supplying the template string and any extra parameters.

♻️ Suggested shared base
class _ElementwiseFPTemplateBase(NodeTemplate):

    def alignToContext(self, ctxt, operatorRepresentation):
        data_in = ctxt.lookup(operatorRepresentation['data_in'])
        operatorRepresentation['size'] = int(np.prod(data_in.shape))
        operatorRepresentation['type_width'] = data_in._type.referencedType.typeWidth
        return ctxt, operatorRepresentation, []
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/Targets/Generic/Templates/FloatSeluTemplate.py` around lines 9 - 23,
The fp32 activation templates duplicate the same alignToContext logic across
_SeluTemplate, _LeakyReluTemplate, and _EluTemplate. Introduce a shared base
such as _UnaryElementwiseTemplate or _ElementwiseFPTemplateBase in the relevant
Float*Template modules to compute size and type_width once from the input
lookup, then have each subclass keep only its kernel template string and any
extra scalar arguments like alpha/gamma.
Deeploy/DeeployTypes.py (1)

1923-1923: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add strict= to zip().

Ruff (B905) flags the missing strict= parameter; adding it guards against silent shape-count mismatches between validInputNodes + self.node.outputs and the computed shapes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/DeeployTypes.py` at line 1923, The zip in the shape-mapping loop is
missing the strict parameter, so update the iteration in the node shape
assignment logic to use strict= when pairing validInputNodes + self.node.outputs
with newInputShapes + newOutputShapes. This change belongs in the code path that
processes the node’s input/output shapes, and it should ensure the two sequences
must match exactly instead of allowing silent truncation.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Deeploy/Targets/Generic/Bindings.py`:
- Around line 330-359: Rename the comprehension variable used in the new
conv-transpose binding lists in BasicConvTranspose1DBindings and
BasicConvTranspose2DBindings from type to dtype (or similar) so it does not
shadow the Python builtin; update every PointerClass(...) reference in those
comprehensions to use the new name, and apply the same cleanup to the additional
affected binding comprehensions noted in the review.

In `@Deeploy/Targets/Generic/Parsers.py`:
- Around line 3349-3356: The helper _is_empty currently uses a parameter named
input, which shadows the built-in and triggers Ruff A002. Rename the parameter
in _is_empty to something non-conflicting, and update the internal isinstance
checks to use the new name while keeping the same behavior for gs.Constant,
gs.Variable, and None.
- Around line 3328-3335: The Col2Im mapper currently indexes data_out.shape[1]
before validating the output rank, so malformed outputs with rank below 2 can
raise IndexError instead of failing cleanly. Update the Col2Im parsing logic in
the branch that computes N and C from data_out.shape to first check that
data_out has at least 2 dimensions, then proceed with the existing shape checks
using data_in, data_out, block_shape, and image_shape so the mapper returns
False for invalid ranks.
- Around line 2798-2867: In the ConvTranspose parser logic, add explicit channel
validation and reset stale optional state before populating
operatorRepresentation. Use the existing ConvTranspose parsing block that
inspects data_in, weight, and data_out to verify weight.shape[0] matches the
input channels and data_out.shape[1] matches weight.shape[1] * rep['group'].
Also guard the optional bias path so empty third inputs are ignored instead of
calling ctxt.lookup("") and ensure rep does not retain a previous 'bias' entry
when len(node.inputs) != 3. Keep the final rep['has_bias'] assignment in sync
with the presence of a valid bias.
- Around line 3373-3390: The Resize parser currently accepts unsupported options
that the C kernel does not handle, so tighten the validation in the Resize
parsing logic to reject them up front. In the parser method that populates
operatorRepresentation for Resize, disallow mode values like cubic and
coord_mode values like tf_crop_and_resize, and also reject any non-default
antialias setting instead of silently accepting it. Keep the existing
allowed-value checks in the same validation block so unsupported combinations
fail before reaching the backend.
- Around line 3231-3258: The Scatter parser in Parsers.py accepts axis and shape
metadata without validating the node contract, so add explicit checks in the
Scatter parsing path before storing values in operatorRepresentation. In the
parser method that reads axis/reduction and in parseNodeCtxt, verify axis is
within the rank of data_in and that data_out and updates shapes are compatible
with the Scatter/ScatterElements semantics for the selected reduction, returning
False when the contract is invalid. Keep the validation close to the existing
lookups of data_in, indices, updates, and data_out so malformed nodes are
rejected before code generation.

In `@Deeploy/Targets/Generic/TypeCheckers.py`:
- Around line 56-64: The sign-consistency check in
ConcatChecker._inferSignedness is incorrect because the second all() wraps the
comprehension in an extra list, so mixed signed inputs can slip through. Fix the
assert to evaluate the per-input booleans directly for both positive and
negative cases, and simplify the comparisons to use truthy/falsy checks instead
of == True/== False to satisfy Ruff E712.

In `@TargetLibraries/Generic/src/ConvTranspose_fp32.c`:
- Around line 7-82: The ConvTranspose kernels only handle the simple zero-pad,
unit-dilation, ungrouped case, so update the parser/validation path around
ConvTranspose1d_fp32 and ConvTranspose2d_fp32 to reject unsupported attribute
combinations instead of silently accepting them. Add explicit guards for
non-default pads, output_padding, dilations, and group values, or route these
attributes into the kernel if you intend to support them; make the checks in the
ConvTranspose parsing/template code that feeds these functions.

In `@TargetLibraries/Generic/src/Scatter.c`:
- Around line 16-42: The Scatter implementation in Scatter.c is using a
scalar-only index/update loop that matches ScatterElements, not ONNX Scatter, so
trailing-slice updates are handled incorrectly. Update the Scatter kernel entry
point and the main loop so Scatter is either restricted to the ScatterElements
path or routed to a separate slice-update implementation; use the existing
stride/index logic around indices_size, stride_data, stride_idx, and the fi loop
to locate the code that needs to be split.

---

Outside diff comments:
In `@Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py`:
- Around line 24-43: The SignPropTypeChecker logic is still calling ctxt.lookup
on raw node.inputs entries, so omitted optional inputs can raise KeyError even
though parseInputs skips them. Update SignPropTypeChecker.typeInferGlobalCtxt
(and the related input handling in the checker flow) to ignore inputs with
empty/missing names before lookup, matching the filtering already used in
parseInputs and the node.inputs iteration pattern.

In `@Deeploy/DeeployTypes.py`:
- Around line 1294-1340: The optional-input handling in type checking is
incomplete because typeCheckNodeInputs and
SignPropTypeChecker.typeInferGlobalCtxt still call ctxt.lookup(inputNode.name)
for every input, including skipped ONNX optionals with empty names. Update both
loops to guard against empty input names before any lookup or annotation, and
only run the existing VariableBuffer/ConstantBuffer logic for real named inputs.

In `@TargetLibraries/Generic/src/Layernorm_fp32.c`:
- Around line 45-91: The gradient computation in the LayerNorm backward pass is
using the wrong reduction: `sum_dy` currently accumulates raw `grad_in` and
`scale[j]` is applied outside the summed term, which breaks the formula when
`scale` varies. Update the `Layernorm_fp32` gradient logic so the reduction term
sums `grad_in[j + i * lastDimLength] * scale[j]` across the normalized
dimension, then use that corrected aggregate in the `grad_out` expression while
keeping the rest of the `mean`, `variance`, and `sum_dy_scaled` flow intact.

---

Nitpick comments:
In `@Deeploy/DeeployTypes.py`:
- Line 1923: The zip in the shape-mapping loop is missing the strict parameter,
so update the iteration in the node shape assignment logic to use strict= when
pairing validInputNodes + self.node.outputs with newInputShapes +
newOutputShapes. This change belongs in the code path that processes the node’s
input/output shapes, and it should ensure the two sequences must match exactly
instead of allowing silent truncation.

In `@Deeploy/Targets/Generic/Layers.py`:
- Line 817: The comment in the layer shape annotation uses a Unicode
multiplication symbol that triggers Ruff RUF003. Update the inline comment near
the affected layer-shape notation to use plain ASCII x instead of × so the
documentation remains tooling-friendly and portable.

In `@Deeploy/Targets/Generic/Templates/FloatSeluTemplate.py`:
- Around line 9-23: The fp32 activation templates duplicate the same
alignToContext logic across _SeluTemplate, _LeakyReluTemplate, and _EluTemplate.
Introduce a shared base such as _UnaryElementwiseTemplate or
_ElementwiseFPTemplateBase in the relevant Float*Template modules to compute
size and type_width once from the input lookup, then have each subclass keep
only its kernel template string and any extra scalar arguments like alpha/gamma.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef2b0826-312f-44da-8560-a69d4100ca0c

📥 Commits

Reviewing files that changed from the base of the PR and between 6818f31 and 11a95c2.

📒 Files selected for processing (70)
  • CHANGELOG.md
  • Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py
  • Deeploy/DeeployTypes.py
  • Deeploy/Targets/Generic/Bindings.py
  • Deeploy/Targets/Generic/Layers.py
  • Deeploy/Targets/Generic/Parsers.py
  • Deeploy/Targets/Generic/Platform.py
  • Deeploy/Targets/Generic/Templates/Col2ImTemplate.py
  • Deeploy/Targets/Generic/Templates/ConvTransposeTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatEluTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatLeakyReluTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatSeluTemplate.py
  • Deeploy/Targets/Generic/Templates/ResizeTemplate.py
  • Deeploy/Targets/Generic/Templates/ScatterTemplate.py
  • Deeploy/Targets/Generic/TypeCheckers.py
  • DeeployTest/Tests/Kernels/FP32/Col2Im/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/Col2Im/network.onnx
  • DeeployTest/Tests/Kernels/FP32/Col2Im/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/ConvTranspose/Regular_1D/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/ConvTranspose/Regular_1D/network.onnx
  • DeeployTest/Tests/Kernels/FP32/ConvTranspose/Regular_1D/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/ConvTranspose/Regular_2D/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/ConvTranspose/Regular_2D/network.onnx
  • DeeployTest/Tests/Kernels/FP32/ConvTranspose/Regular_2D/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/Elu/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/Elu/network.onnx
  • DeeployTest/Tests/Kernels/FP32/Elu/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/LeakyRelu/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/LeakyRelu/network.onnx
  • DeeployTest/Tests/Kernels/FP32/LeakyRelu/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/Resize/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/Resize/network.onnx
  • DeeployTest/Tests/Kernels/FP32/Resize/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/ScatterElements/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/ScatterElements/network.onnx
  • DeeployTest/Tests/Kernels/FP32/ScatterElements/outputs.npz
  • DeeployTest/Tests/Kernels/FP32/Selu/inputs.npz
  • DeeployTest/Tests/Kernels/FP32/Selu/network.onnx
  • DeeployTest/Tests/Kernels/FP32/Selu/outputs.npz
  • DeeployTest/Tests/Kernels/Integer/Col2Im/inputs.npz
  • DeeployTest/Tests/Kernels/Integer/Col2Im/network.onnx
  • DeeployTest/Tests/Kernels/Integer/Col2Im/outputs.npz
  • DeeployTest/Tests/Kernels/Integer/Resize/inputs.npz
  • DeeployTest/Tests/Kernels/Integer/Resize/network.onnx
  • DeeployTest/Tests/Kernels/Integer/Resize/outputs.npz
  • DeeployTest/Tests/Kernels/Integer/ScatterElements/inputs.npz
  • DeeployTest/Tests/Kernels/Integer/ScatterElements/network.onnx
  • DeeployTest/Tests/Kernels/Integer/ScatterElements/outputs.npz
  • DeeployTest/test_generic_config.py
  • TargetLibraries/Generic/inc/DeeployBasicMath.h
  • TargetLibraries/Generic/inc/kernel/Col2Im.h
  • TargetLibraries/Generic/inc/kernel/ConvTranspose1d_fp32.h
  • TargetLibraries/Generic/inc/kernel/ConvTranspose_fp32.h
  • TargetLibraries/Generic/inc/kernel/Elu.h
  • TargetLibraries/Generic/inc/kernel/LeakyRelu.h
  • TargetLibraries/Generic/inc/kernel/Resize.h
  • TargetLibraries/Generic/inc/kernel/Scatter.h
  • TargetLibraries/Generic/inc/kernel/Selu.h
  • TargetLibraries/Generic/src/Col2Im.c
  • TargetLibraries/Generic/src/ConvTranspose1d_fp32.c
  • TargetLibraries/Generic/src/ConvTranspose_fp32.c
  • TargetLibraries/Generic/src/Elu_fp32.c
  • TargetLibraries/Generic/src/GlobalAveragePool_fp32.c
  • TargetLibraries/Generic/src/GlobalMaxPool_fp32.c
  • TargetLibraries/Generic/src/HardSwish_fp32.c
  • TargetLibraries/Generic/src/Layernorm_fp32.c
  • TargetLibraries/Generic/src/LeakyRelu_fp32.c
  • TargetLibraries/Generic/src/Resize.c
  • TargetLibraries/Generic/src/Scatter.c
  • TargetLibraries/Generic/src/Selu_fp32.c
💤 Files with no reviewable changes (3)
  • TargetLibraries/Generic/src/GlobalMaxPool_fp32.c
  • TargetLibraries/Generic/inc/kernel/ConvTranspose1d_fp32.h
  • TargetLibraries/Generic/src/ConvTranspose1d_fp32.c

Comment thread Deeploy/Targets/Generic/Bindings.py
Comment thread Deeploy/Targets/Generic/Parsers.py Outdated
Comment thread Deeploy/Targets/Generic/Parsers.py
Comment thread Deeploy/Targets/Generic/Parsers.py
Comment thread Deeploy/Targets/Generic/Parsers.py Outdated
Comment thread Deeploy/Targets/Generic/Parsers.py
Comment thread Deeploy/Targets/Generic/TypeCheckers.py
Comment thread TargetLibraries/Generic/src/ConvTranspose_fp32.c
Comment thread TargetLibraries/Generic/src/Scatter.c

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Deeploy/Targets/Generic/Templates/FloatSqrtTemplate.py (1)

10-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Collapse the Sqrt template overrideFloatSqrtTemplate.py sets operatorRepresentation['data_type'], but nothing in the Sqrt template path uses it and the template string never interpolates ${data_type}. This can be simplified to _FloatUnaryTemplate like the other unary templates unless a Sqrt-specific consumer is added later.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Deeploy/Targets/Generic/Templates/FloatSqrtTemplate.py` around lines 10 - 19,
The _SqrtTemplate.alignToContext override is only assigning
operatorRepresentation['data_type'] and does not affect the Sqrt template
output, so simplify this path by removing the Sqrt-specific override and relying
on _FloatUnaryTemplate like the other unary templates. If you keep
_SqrtTemplate, ensure there is a real Sqrt-specific consumer of data_type in the
template or downstream logic; otherwise delete the unused lookup and assignment
in alignToContext.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Deeploy/Targets/Generic/Templates/FloatSqrtTemplate.py`:
- Around line 10-19: The _SqrtTemplate.alignToContext override is only assigning
operatorRepresentation['data_type'] and does not affect the Sqrt template
output, so simplify this path by removing the Sqrt-specific override and relying
on _FloatUnaryTemplate like the other unary templates. If you keep
_SqrtTemplate, ensure there is a real Sqrt-specific consumer of data_type in the
template or downstream logic; otherwise delete the unused lookup and assignment
in alignToContext.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f52b7bf-3a84-4d17-ba75-5701a9070f7c

📥 Commits

Reviewing files that changed from the base of the PR and between 11a95c2 and 72e708e.

📒 Files selected for processing (20)
  • Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py
  • Deeploy/DeeployTypes.py
  • Deeploy/Targets/Generic/Bindings.py
  • Deeploy/Targets/Generic/Layers.py
  • Deeploy/Targets/Generic/Parsers.py
  • Deeploy/Targets/Generic/Templates/FloatCeilTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatClipTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatEluTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatExpTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatFloorTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatHardSigmoidTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatHardSwishTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatLeakyReluTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatSeluTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatSigmoidTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatSqrtTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatSwishTemplate.py
  • Deeploy/Targets/Generic/Templates/FloatUnaryTemplate.py
  • Deeploy/Targets/Generic/TypeCheckers.py
  • TargetLibraries/Generic/src/Layernorm_fp32.c
✅ Files skipped from review due to trivial changes (1)
  • Deeploy/Targets/Generic/Templates/FloatUnaryTemplate.py
🚧 Files skipped from review as they are similar to previous changes (6)
  • Deeploy/CommonExtensions/TypeCheckers/SignPropTypeChecker.py
  • Deeploy/DeeployTypes.py
  • Deeploy/Targets/Generic/Bindings.py
  • Deeploy/Targets/Generic/Layers.py
  • Deeploy/Targets/Generic/Parsers.py
  • Deeploy/Targets/Generic/TypeCheckers.py

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.

2 participants