Commit: 5ef665c
Parent: aeaa6e4

Enable OpenVINO dynamic-shape resolution to fix LightGlue matmul crash

Mårten Åsberg committed on 2026-08-03 at 12:53
OpenVINO EP compiles subgraphs ahead-of-time by default. LightGlue's
keypoint-count axis is dynamic (it pairs with any extractor/keypoint
count), and ahead-of-time compilation was mis-propagating that axis
through the attention stack, baking in a wrong placeholder dimension
that then mismatched the real runtime shape on every inference call.
with_dynamic_shapes(true) defers shape resolution to each request's
actual input shape instead. No effect on ALIKED, whose I/O is static.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
src/models.rs +8 -1
diff --git a/src/models.rs b/src/models.rs
index ac17b92..fae63ba 100644
@@ -24,7 +24,14 @@ impl Device {
/// Registration failures (e.g. no Arc GPU present) are logged and the session
/// silently falls back to the CPU execution provider, per `ort`'s default behavior.
pub fn load_session(model_path: &Path, device: Device) -> Result<Session> {
let openvino = ep::OpenVINO::default().with_device_type(device.openvino_device_type());
let openvino = ep::OpenVINO::default()
.with_device_type(device.openvino_device_type())
// LightGlue's keypoint-count axis is dynamic (paired with any extractor/keypoint
// count). OpenVINO EP compiles subgraphs ahead-of-time by default, which can
// mis-propagate that dynamic axis through the attention stack and bake in a wrong
// placeholder shape; this defers shape resolution to each request's actual input
// shape instead. Harmless for ALIKED, whose shapes are all static anyway.
.with_dynamic_shapes(true);
match openvino.is_available() {
Ok(true) => {}