Skip to content

test(cuda-core): gate stream_query on observed state instead of elapsed time - #1729

Open
vyncint wants to merge 1 commit into
NVIDIA:mainfrom
vyncint:test/cuda-core-stream-query-gate
Open

vyncint wants to merge 1 commit into
NVIDIA:mainfrom
vyncint:test/cuda-core-stream-query-gate

Conversation

@vyncint

@vyncint vyncint commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Part of #1680: the cuda-core/tests/stream_query.rs row. The shared_allocation.rs row is on hold for the reason in my #1680 comment.

What was wrong

query_reports_in_flight_work_and_never_blocks held the stream with a host callback that slept 500 ms, then asserted two timings:

  • query() returned in under 250 ms;
  • the callback was still running when it answered.

On a loaded runner, the first query can land after the sleep, or query() can be descheduled for longer than 250 ms. Either way the test fails while query() is correct.

How

callback:  started ──► wait on gate (watchdog 30 s; expiry is recorded)
test:      wait for "started" ──► query() ──► assert ──► open gate ──► synchronize

The gate opens only after query() has answered. A query() that waited for the work, for example by falling back to synchronize(), would deadlock against the closed gate. It could return only after the watchdog gave up, so the test asserts first that the watchdog did not expire. The watchdog only stops a hang, and expiring is a failure, not a way to let the test continue.

Checked

On an NVIDIA A10G (CC 8.6, driver 595.71.05), with the host crates rebuilt:

case result
this change, 30 consecutive runs 30 passed
Stream::query that synchronizes first fails: query() waited for the gated work until the watchdog expired
Stream::query that always reports complete fails: a stream whose host callback is still gated must report incomplete

cargo fmt -p cuda-core -- --check and cargo clippy -p cuda-core --tests -- -D warnings pass.

…ed time

`query_reports_in_flight_work_and_never_blocks` held the stream with a host
callback that slept 500 ms, and required `query()` to answer in under
250 ms. A loaded runner could miss either bound.

The callback now signals that it has started and waits on a gate that the
test opens only after `query()` has answered. A `query()` that waited for
the work would deadlock against the closed gate until the 30 s watchdog
opened it, so the watchdog records its expiry and the test fails on that
state. The watchdog only stops a hang.

Checked on an A10G: 30 consecutive passes, and the test fails against a
`Stream::query` that synchronizes first ("query() waited for the gated
work until the watchdog expired") and against one that always reports
complete.

Part of NVIDIA#1680.

Signed-off-by: Vyncint Ng <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@elibol elibol added the cutile-rs Tile programming model: cutile crates, compiler, macros, IR, kernels, and book label Nov 12, 2026

This branch has not been deployed

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

Labels

cutile-rs Tile programming model: cutile crates, compiler, macros, IR, kernels, and book

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants