[STF] Add extended C context creation API#9162
Conversation
Expose stream/backend/resource options for C STF contexts so callers can reuse async resources and bind user streams explicitly.
|
/ok to test 05cc825 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 Walkthroughimportant: WalkthroughAdds a C API and implementation to create STF contexts with selectable backend, optional caller-stream binding, and a shareable async-resources handle; adds tests for stream-chaining and handle reuse and updates docs for non-blocking finalize semantics. ChangesSTF context creation with backend selection and async resource sharing
Possibly related PRs
Suggested reviewers
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
c/experimental/stf/src/stf.cu (1)
447-448: 💤 Low valuesuggestion: The variable
ahis declared non-const but never modified after initialization. Per coding guidelines, unmodified variables should beconst.- const bool has_stream = (o.has_stream != 0); - async_resources_handle ah = o.handle ? *async_resources_from_opaque(o.handle) : async_resources_handle{nullptr}; + const bool has_stream = (o.has_stream != 0); + const async_resources_handle ah = o.handle ? *async_resources_from_opaque(o.handle) : async_resources_handle{nullptr};
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 33bd160d-b0b8-4343-a324-41bc60a17de2
📒 Files selected for processing (3)
c/experimental/stf/include/cccl/c/experimental/stf/stf.hc/experimental/stf/src/stf.cuc/experimental/stf/test/test_stream_ctx_override.cu
Address review feedback by keeping the derived C context creation resource handle immutable after initialization.
|
/ok to test 5bac735 |
This comment has been minimized.
This comment has been minimized.
…time stf_ctx_finalize() is non-blocking when a context is created with a caller-provided CUDA stream, but the C API docs claimed it always blocked. Clarify the conditional behavior in stf.h, document the matching contract on async_resources_handle / stream_ctx / graph_ctx in cudax, fix the stf_ctx_create_ex() example to cudaStreamSynchronize() the caller stream before stf_async_resources_destroy(), and add a focused C API test covering stf_ctx_create_ex() with an explicit shared async resources handle on the stream and graph backends.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
c/experimental/stf/test/test_async_resources_handle.cu (1)
47-47: 💤 Low valuesuggestion: The
(acc & 0)trick to defeat dead-code elimination is fine but opaque. A one-line comment clarifying intent would help future readers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f12fcef3-a702-4b55-acda-5d89f49d2ba3
📒 Files selected for processing (5)
c/experimental/stf/include/cccl/c/experimental/stf/stf.hc/experimental/stf/test/test_async_resources_handle.cucudax/include/cuda/experimental/__stf/graph/graph_ctx.cuhcudax/include/cuda/experimental/__stf/internal/async_resources_handle.cuhcudax/include/cuda/experimental/__stf/stream/stream_ctx.cuh
✅ Files skipped from review due to trivial changes (3)
- cudax/include/cuda/experimental/__stf/internal/async_resources_handle.cuh
- cudax/include/cuda/experimental/__stf/graph/graph_ctx.cuh
- cudax/include/cuda/experimental/__stf/stream/stream_ctx.cuh
🚧 Files skipped from review as they are similar to previous changes (1)
- c/experimental/stf/include/cccl/c/experimental/stf/stf.h
Clarify in the C API (stf.h) and cudax docs (async_resources_handle, stream_ctx, graph_ctx) that stf_ctx_finalize() is non-blocking for contexts created with a caller-provided stream, and that a shared async resources handle must outlive the work those caller streams complete. Fix the stf_ctx_create_ex() example to synchronize the caller stream before stf_async_resources_destroy(), add a focused C API test for stf_ctx_create_ex() with an explicit shared handle, and fix the slow_set_kernel busy loop (acc & 0 was always 0, letting the compiler elide the loop) to publish via an atomic sink with well-defined unsigned arithmetic.
|
/ok to test bfdad44 |
|
Actionable comments posted: 0 |
|
/ok to test ba04eb8 |
|
Actionable comments posted: 0 |
This comment has been minimized.
This comment has been minimized.
|
/ok to test f301863 |
🥳 CI Workflow Results🟩 Finished in 45m 53s: Pass: 100%/59 | Total: 12h 23m | Max: 45m 53s | Hits: 91%/166735See results here. |
Expose stream/backend/resource options for C STF contexts so callers can reuse async resources and bind user streams explicitly.
Description
closes
Checklist