Skip to content

Post-#674: conv1d/gather/pooling output-spec + reduce_window emission still block iree-compile #675

Description

@michalharakal

Follow-up to #673 / #674. #674 fixed reshape/matmul/concat output-spec inference; verified end-to-end against an unsigned 0.28.1-SNAPSHOT published to mavenLocal and run through the skainet-iree-conformance harness:

  • op micro-suite: 23/27 iree-compile to a vmfb (was 20/27 on 0.28.0; reshape/matmul/concat now pass)
  • models: 6/7 compile (grayscale, tiny-mlp, whisper, yolo, leaf-embed, gemma3-260m)

Still failing — this issue: conv1d, gather, maxpool2d, avgpool2d (and the mnist-cnn model, via maxpool).

Repro test (committed, RED)

Branch test/dag-conv-gather-pool-shape-673bDagConvGatherPoolExportTest (real dag{} DSL path). 4 tests, all RED on develop after #674.

Two root causes

1. inferDagOutputSpecs has no rule for conv1d / gather / pooling

Same gap #674 closed for matmul/concat — these still fall back to echoing operand-0's shape, so the declared result/return type contradicts the value iree-compile infers:

op_conv1d  (x:1x3x8, w:4x3x3, stride 1 pad 0)  declared 1x3x8, true 1x4x6
  error: inferred shape '[1, 4, 6]' is incompatible with return type 'tensor<1x3x8xf32>'

op_gather  (table:8x4, idx:3, axis 0)          declared 8x4, true 3x4
  error: 'stablehlo.gather' op inferred type(s) 'tensor<3x4xf32>' are incompatible with return type(s) 'tensor<8x4xf32>'

op_maxpool2d / op_avgpool2d (1x3x8x8, 2x2 s2)  declared 1x3x8x8, true 1x3x4x4

Note: conv2d already passes — only conv1d is wrong. Extend inferDagOutputSpecs with conv (out = floor((in + 2·pad − dilation·(k−1) − 1)/stride)+1, channels = weight[0]), gather (indices.shape ⊕ table.shape without the gathered axis), and pooling (same windowed formula as conv).

2. reduce_window is emitted in a form IREE rejects

op_maxpool2d:5:11: error: custom op 'stablehlo.reduce_window' has no custom assembly form

The converter emits the pretty stablehlo.reduce_window(%a, %init) applies stablehlo.maximum over window dimensions = … form. IREE's parser needs the generic region-based form ("stablehlo.reduce_window"(%a, %init) ({ ^bb0(...): stablehlo.return ... }) {window_dimensions = …, …}). This blocks both pooling ops and the mnist-cnn model. (Same class as the gather/slice emission fixes in 0.27.0.)

Acceptance

  • DagConvGatherPoolExportTest (4) green.
  • Harness op micro-suite reaches 27/27 compile and mnist-cnn compiles to a vmfb on llvm-cpu.

Verified via mavenLocal 0.28.1-SNAPSHOT + skainet-iree-conformance.

Activity

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