Skip to content

Conversation

@marchioa
Copy link

In generic platform, GEMM was not correctly hoisting the bias tensor when required.
To solve the issue, bias hoisting has been moved from MatMulParser.parseNodeCtxt to GEMMParser.parseNode.
Moreover, the default value of noBiasHoisting flag in GenericGEMMParser has been changed from True to False to be compliant with the template.

Added

  • testFloatGEMMnobias

Changed

  • Generic\Parser.py file (MatMulParser, GEMMParser, and GenericGEMMParser)

Fixed

  • fix bias hoisting in GEMM with no bias

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Restructured bias tensor handling in matrix multiplication operations.
    • Updated default bias hoisting behavior for improved consistency.

Walkthrough

GEMM parser initialization now delegates bias-hoisting handling to the base class; synthetic C/bias tensor generation paths for no-bias-hoisting were removed from the contextual parser, and GenericGEMMParser's default noBiasHoisting flipped from True to False. parseNode now handles the 2-input case explicitly when bias hoisting is disabled.

Changes

Cohort / File(s) Summary
GEMM Parser Refactoring
Deeploy/Targets/Generic/Parsers.py
- GEMMParser init now calls super().__init__(noBiasHoisting) and no longer assigns self.noBiasHoisting directly.
- Removed code that created and injected synthetic C (bias) tensors and mock bias matrices in parseNodeCtxt when bias hoisting was disabled.
- parseNode added explicit logic to create a bias C tensor when there are exactly 2 inputs and bias hoisting is disabled.
- When 3 inputs are present, existing C handling remains; the fallback path that previously synthesized a mock bias matrix for no-bias-hoisting was removed.
- GenericGEMMParser default noBiasHoisting changed from True to False.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant GEMMParser
  participant BaseParser
  Note over GEMMParser,BaseParser: Initialization
  Caller->>GEMMParser: instantiate(noBiasHoisting)
  GEMMParser->>BaseParser: super().__init__(noBiasHoisting)
  Note right of BaseParser: Base handles bias-hoisting flag

  Note over Caller,GEMMParser: parseNode flow (high-level)
  Caller->>GEMMParser: parseNode(node)
  alt node.inputs == 3
    GEMMParser->>GEMMParser: use provided C (bias) tensor
  else node.inputs == 2
    alt bias hoisting disabled (noBiasHoisting == True)
      GEMMParser->>GEMMParser: create C bias tensor (explicit 2-input handling)
    else bias hoisting enabled
      GEMMParser->>BaseParser: delegate hoisting behavior / no synthetic creation here
    end
  end
  GEMMParser-->>Caller: parsed representation (with/without C)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Potential review focus:

  • parseNode and parseNodeCtxt logic paths for 2- vs 3-input nodes to ensure consistent C tensor shaping and batching flags.
  • Interaction and contract between GEMMParser and its base regarding noBiasHoisting handling.
  • Tests or call sites that assumed automatic synthetic C insertion when hoisting was disabled.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "fix bug in Generic GEMM with no bias" directly corresponds to the main objective of the changeset. The raw summary shows that the primary change is addressing a bias hoisting bug in GEMM when there are no bias inputs, along with related refactoring of how bias tensors are handled across GEMMParser and GenericGEMMParser. The title is specific and clearly communicates the fix without being overly broad or generic.
Description Check ✅ Passed The PR description is clearly related to the changeset, providing a specific explanation of the problem (incorrect bias hoisting in Generic GEMM) and the solution (relocating bias hoisting from MatMulParser.parseNodeCtxt to GEMMParser.parseNode, and adjusting the default noBiasHoisting flag). The description also documents the test that was added and the files that were modified, which aligns with the actual changes reflected in the raw summary.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0641fc9 and 14ce3e1.

📒 Files selected for processing (1)
  • Deeploy/Targets/Generic/Parsers.py (3 hunks)
🔇 Additional comments (2)
Deeploy/Targets/Generic/Parsers.py (2)

1766-1768: Constructor delegation LGTM

Passing the flag down to the base via super().init(noBiasHoisting) is correct.


2310-2312: Code change is correct, but test verification requirement cannot be confirmed

The code change at lines 2310-2312 is intentional and correct: GenericGEMMParser uniquely defaults to noBiasHoisting = False, which allows 2-input GEMM operations to auto-hoist a zero bias (see line 1799 logic). This differs from other parsers which default to True.

However, the review requirement to verify test coverage for 2-input GEMM without bias cannot be confirmed: no test named "testFloatGEMMnobias" exists in the codebase, and no noBiasHoisting-related tests were found.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15c4a23 and 0641fc9.

📒 Files selected for processing (1)
  • Deeploy/Targets/Generic/Parsers.py (3 hunks)
🔇 Additional comments (2)
Deeploy/Targets/Generic/Parsers.py (2)

1738-1739: LGTM: Initialization now delegates to base class.

The initialization correctly passes noBiasHoisting to MatMulParser.__init__, which stores it as self.noBiasHoisting. This is cleaner than the previous pattern.


2269-2269: I need to search the codebase more thoroughly to understand the impact of this change.Based on the evidence gathered, I can now generate the rewritten review comment. The key finding is that the test testFloatGEMMnobias mentioned in the PR description does NOT exist in the codebase, and the default parameter change is a BREAKING CHANGE affecting two platforms.


The PR claims to add testFloatGEMMnobias, but this test does not exist in the codebase. Verify test coverage before merging.

The change to noBiasHoisting default from True to False is a breaking behavioral change affecting GEMM operations on two platforms:

  • Deeploy/Targets/Generic/Platform.py:41 (Generic platform)
  • Deeploy/Targets/MemPool/Platform.py:74 (MemPool platform)

Both instantiations rely on the default parameter, so they will now enable bias hoisting by default instead of disabling it.

Required actions:

  1. Confirm whether the test mentioned in the PR description (testFloatGEMMnobias) was intended to be added as part of this PR
  2. Ensure existing GEMM test suite passes with the new default behavior
  3. Document the breaking change or update code to explicitly pass noBiasHoisting=True to maintain backward compatibility

@Xeratec Xeratec added the Bug Something isn't working label Oct 23, 2025
@Xeratec Xeratec added this to Deeploy Oct 23, 2025
@Xeratec Xeratec moved this to Need Reviewer in Deeploy Oct 23, 2025
@Xeratec Xeratec added this to the Release 0.2.1 milestone Oct 23, 2025
@Xeratec Xeratec moved this from Need Reviewer to In review in Deeploy Oct 28, 2025
Copy link
Collaborator

@lukamac lukamac left a comment

Choose a reason for hiding this comment

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

amazing work, beautiful!

Before it gets my stamp of approval, can you please make sure to:

  1. Add your change to the changelog
  2. Make sure your branch is rebased on devel, i.e., that your commits sit directly on top of the devel branch. I pulled locally your branch and you have been doing some merging. Try the command git rebase -i and just pick your commits.

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

Labels

Bug Something isn't working

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants