Skip to content

StableHLO preprocessing inserts an invalid reshape for dynamic-row dot_general #25317

Open

Description

@BJMCox

What happened?

IREE rejects a matrix–vector product with a runtime row count via dot_general.

iree-stablehlo-to-stablehlo-preprocessing emits a stablehlo.reshape whose result has an unbounded dimension. The verifier rejects it. The failed pass dump shows the dot result already has the requested shape.

%0 = "stablehlo.dot"(%arg0, %arg1) : (tensor<?x2xf32>, tensor<2xf32>) -> tensor<?xf32>
%1 = "stablehlo.reshape"(%0) : (tensor<?xf32>) -> tensor<?x1xf32>
repro.mlir:2:13: error: 'stablehlo.reshape' op result #0 must be statically shaped or single bounded dimension tensor of 4/6/8/16/32/64-bit float or bool or 2/4/8/16/32/64-bit integer or complex type with 32/64-bit float elements or per-tensor integer quantized or per-axis integer quantized values, but got 'tensor<?x1xf32>'

Steps to reproduce your issue

Save as repro.mlir.

func.func @matvec(%matrix: tensor<?x2xf32>, %vector: tensor<2xf32>) -> tensor<?xf32> {
  %result = stablehlo.dot_general %matrix, %vector, contracting_dims = [1] x [0]
    : (tensor<?x2xf32>, tensor<2xf32>) -> tensor<?xf32>
  return %result : tensor<?xf32>
}
iree-compile repro.mlir --iree-input-type=stablehlo \
  --iree-hal-target-device=local --iree-hal-local-target-device-backends=llvm-cpu \
  --mlir-print-ir-after-failure -o repro.vmfb

What component(s) does this issue relate to?

Compiler, MLIR.

Version information

Reproduced on macOS arm64 with

  • IREE 3.14.0 (iree-compile --version reports 3.14.0rc20261115, 5332c68297a68fafd596277d7686f91009ebf1cb).

Additional context

  • Replacing ? with 4 throughout the reproducer compiles.
  • Replacing dot_general with dot and removing contracting_dims = [1] x [0] also compiles with the row count still dynamic.
  • The direct matrix–vector rewrite in GeneralDotConvert requires both operands to have static shapes. see

Activity

  1. github-actions commented on Nov 21, 2026

    @github-actions

    Hello @BJMCox 👋

    Thank you for submitting an issue to IREE! It looks like it's your first one.

    The volume of issues is huge, and triage times may vary. If you need quicker assistance on the issue, consider posting it on IREE Discord and providing short context there.
    Feel free to identify the most frequent contributors to the corresponding part of the codebase via Git history/CODEOWNERS and (gently!) tag them below.


    Action required: acknowledge IREE project policies

    IREE is a Linux Foundation project. All participants are expected to follow the LF Projects Code of Conduct.

    Please note that all contributions to IREE, including GitHub issues, must follow our IREE AI Tool Use Policy. This means:

    • Issue reporters must fully understand the primary issue and the impact of the problem.
      For bug reports, specifics of the use-case, workflow and/or crash scenario usually suffice.
      For improvement suggestions, this usually implies deeper understanding of suboptimal code, IR design choices, assumed performance tradeoffs, etc.
    • Contributors must write the summary of the issue themselves, so that the exact impact and scenario is clear to other participants.
    • Issue authors are expected to review and understand all LLM/AI-assisted segments of the report, if any. E.g.: CLI commands and IR reproducers, model/framework details, lowering pipeline details, assumptions about problematic behaviors of IREE components.
    • Substantial use of LLM/generative AI tools must be disclaimed in the header or footer of the issue description.

    Before the issue can be triaged, we kindly ask you to reply to this message and confirm that you understand and accept the proposed policy. As required, please adjust your initial issue description.


    If you have any questions, feel free to leave a comment here, or ask away on IREE Discord.

    Thank you,
    The IREE Community

  2. BJMCox commented on Nov 21, 2026

    @BJMCox
    Author

    I understand and accept the proposed policy.

  3. StarOne01 commented on Nov 26, 2026

    @StarOne01

    hello, i would like to work on fixing this issue!

  4. jschuhmacher commented on Dec 1, 2026

    @jschuhmacher
    Contributor

    It should be fixed in here: #25236, but it takes a while to get this PR in.

  5. StarOne01 commented on Dec 1, 2026

    @StarOne01

    thanks for the heads up!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions