﻿# ONNX sparse attention state_status: a safely rejected update still needs caller visibility

The v0.4.0 sparse-indexer status output exposes rejected updates after replay; execution completion is not proof that every request advanced state.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-sparse-indexer-state-status-replay/
Language: en

CUDA Plugin EP v0.4.0 adds optional per-request state_status reporting for PackedSparseAttentionIndexer. The linked analysis explains that a rejected update can leave state unchanged and selection empty without the caller knowing. For a graph-replayed loop, a device status result makes that outcome observable after replay rather than requiring synchronization inside the operator.

## A no-op can be intentional

Not every completed operator call commits state. The PR describes rejection for inconsistent metadata or capacity conditions while preserving existing state safely. A proposed test checks three things together: status, output selection and state before versus after. Looking only at the absence of a crash cannot distinguish successful progress from intentional rejection. Conversely, an empty selection alone may not explain why the state was held.

## Status is per request, not one global success

A batch can contain requests with different metadata validity and remaining capacity. A proposed regression mixes accepted and rejected entries and verifies that status positions match the corresponding request identities. One global boolean would hide partial progress. Keep state distinct across entries so an accidental status permutation is visible, and confirm that a rejected entry does not modify a neighbouring accepted request’s state.

## Replay requires a post-execution observation point

A captured graph should not need a host synchronization inside each operator merely to report a rejected update. The status tensor offers another communication boundary. A local test captures and replays the intended loop, then reads status at a deliberate completion point before deciding the next host action. Reading too early would create an observation race, while never reading the optional output would leave the original visibility problem unresolved.

## Do not infer support from schema alone

The linked work describes provider-specific implementation details, while the release records the broader shipped feature. Verify the actual provider and requested output on the installed build. This article reports the observability contract and proposed mixed-batch replay test without claiming independent execution results. The useful guarantee being tested is visibility of acceptance, not that every state update must be accepted regardless of capacity or metadata.

## Sources

- [ONNX Runtime plugin-ep-cuda/v0.4.0 release](https://github.com/microsoft/onnxruntime/releases/tag/plugin-ep-cuda/v0.4.0)
- [ONNX Runtime pull request #33383](https://github.com/microsoft/onnxruntime/pull/33383)

## Related reading

- [CUDA event dependencies: connecting producer and consumer streams](/journal/learn-cross-stream-event-dependency/)
- [ONNX Runtime I/O binding: a device pointer needs an owner and a valid lifetime](/journal/fg2-onnxruntime-io-binding-device-buffer-lifetime/)
