[STF] Revamp STF C API: opaque handles for exec_place and data_place#8266
Open
caugonnet wants to merge 11 commits intoNVIDIA:mainfrom
Open
[STF] Revamp STF C API: opaque handles for exec_place and data_place#8266caugonnet wants to merge 11 commits intoNVIDIA:mainfrom
caugonnet wants to merge 11 commits intoNVIDIA:mainfrom
Conversation
Replace tagged-union types (stf_exec_place, stf_data_place with enums and sub-structs) with opaque pointer handles (stf_exec_place_handle, stf_data_place_handle) backed by heap-allocated C++ objects. - Add factory functions: stf_exec_place_host(), stf_data_place_device(), etc. - Add lifecycle management: stf_exec_place_destroy(), stf_data_place_destroy() - Add property queries: stf_exec_place_is_host(), stf_data_place_to_string(), etc. - Add grid construction: stf_exec_place_grid_from_devices(), stf_exec_place_grid_create() - Add composite placement: stf_data_place_composite() - Update all STF functions to accept opaque handles directly - Update test_places.cpp and test_logical_data_with_place.cu for new API Made-with: Cursor
Contributor
Contributor
Author
|
/ok to test aa65f5e |
This comment has been minimized.
This comment has been minimized.
The C header declared the host_launch API but the implementations were missing, causing linker errors. Made-with: Cursor
Contributor
Author
|
/ok to test 5042e93 |
This comment has been minimized.
This comment has been minimized.
The static_asserts already verify layout compatibility between dim4 and stf_dim4, making the field-by-field copy unnecessary. Made-with: Cursor
Contributor
Author
|
/ok to test ede3885 |
This comment has been minimized.
This comment has been minimized.
NaderAlAwar
reviewed
Apr 2, 2026
| stf_task_add_dep_with_dplace(t4, lZ, STF_RW, &d_place_dev0); | ||
| stf_data_place_handle d_place_dev0 = stf_data_place_device(0); | ||
| stf_task_add_dep_with_dplace(t4, lZ, STF_RW, d_place_dev0); | ||
| stf_data_place_destroy(d_place_dev0); |
Contributor
There was a problem hiding this comment.
Suggestion: tasks t1-t4 are never destroyed. It would make sense to add stf_task_destroy. This may apply to other tests as well
Resolve stf.cu host_launch conflicts: use host_launch_type alias and main's host_launch_deps accessors (extent(0), fully qualified types); keep null-safe stf_host_launch_destroy. Made-with: Cursor
…nch test Made-with: Cursor
Contributor
|
/ok to test 9c720d3 |
andralex
reviewed
Apr 2, 2026
Contributor
🥳 CI Workflow Results🟩 Finished in 24m 12s: Pass: 100%/7 | Total: 38m 28s | Max: 24m 11s | Hits: 96%/720See results here. |
- Add to_opaque (Pointee* -> C handle) and from_opaque (handle -> Pointee*) with static_cast via void* and static_assert that handle pointees stay incomplete. - Wrap cross-extern-C heap allocations in stf_try_allocate (try/catch, log, nullptr), matching the spirit of cccl.c parallel error containment (null handles here). - Return data_place/exec_place by reference from deref_*; use const Pointee in from_opaque where read-only. - Use double static_cast for private kernel/host_launch scope types; keep reinterpret_cast only for the C partition function pointer. Build: cccl-c-stf / cccl.c.experimental.stf Made-with: Cursor
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace tagged-union types (stf_exec_place, stf_data_place with enums and sub-structs) with opaque pointer handles (stf_exec_place_handle, stf_data_place_handle) backed by heap-allocated C++ objects.
Made-with: Cursor
Description
closes
Checklist