Skip to content

ggml-openvino: support REPEAT to an empty dim and GET_ROWS on an empty tiled batch - #466

Open
osabnis wants to merge 1 commit into
ravi9:dev_backend_openvinofrom
osabnis:ov-repeat-zero-dims
Open

osabnis wants to merge 1 commit into
ravi9:dev_backend_openvinofrom
osabnis:ov-repeat-zero-dims

Conversation

@osabnis

@osabnis osabnis commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Overview

gemma-4-26B-A4B fails on GPU when processing a ubatch without outputs. The MoE expert scales are repeated (ggml_repeat_4d) to the number of output tokens, which is 0 there. The current REPEAT translation rejects an output dimension of 0, and the batched GET_ROWS takes its data slice from the tiled tensor, whose batch is empty.

This change adds support for both operations in this scenario.

Changes

  • Update REPEAT to accept a destination dimension of size 0.
  • Update GET_ROWS to take the slice from the Tile input, before the tiling, when the data is a Tile that repeats one slice along axis 1 only (get_batch_tile_source()).
  • Add two backend operator test cases:
    • A test_repeat case that repeats to an empty dimension ({1, 1, 0, 1}).
    • test_repeat_empty: REPEAT to an empty dimension followed by CONCAT with a non-empty tensor. It runs the whole graph (run_whole_graph()) instead of comparing node by node, because node by node an empty REPEAT output compares equal even when the backend fails to compute it.

Results

Backend operator tests

Tested on GPU (Intel Arc Pro B70):

Configuration test_repeat_empty -o CONCAT -o REPEAT
Without fix (test file only) FAIL (ERR = 2.18) 96/97 15/15
With fix OK 97/97 15/15

Model validation

Tested with gemma-4-26B-A4B-it using:

llama-bench -fa 1 -p 512,3131 -n 128
  • Without the fix, pp3131 fails with REPEAT input shape ... cannot tile.
  • With all 8 of our PRs (including this one), the model runs successfully, achieving 150.6 t/s for pp3131.

Requirements

  • I have read and agree with the contributing guidelines.
  • AI usage disclosure: YES - AI assistance was used for analysis and running tests.

@osabnis
osabnis force-pushed the ov-repeat-zero-dims branch from 0f88141 to dd82178 Compare November 28, 2026 23:37
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