Skip to content
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
373 commits
Select commit Hold shift + click to select a range
b04cebf
Implement like_empty
caugonnet Aug 28, 2025
9ed5ace
More comprehensive FHE test
caugonnet Aug 28, 2025
e27ef5b
test fhe with stf decorator
caugonnet Aug 28, 2025
d0f915e
Merge branch 'main' into stf_c_api
caugonnet Aug 28, 2025
6963ec0
fix merge error
caugonnet Aug 28, 2025
06fab11
Appropriate checks
caugonnet Aug 29, 2025
2fc802e
Add missing ;
caugonnet Aug 29, 2025
a43db62
- Make it possible to create a borrowed context from a handle
caugonnet Aug 29, 2025
9c07679
invert ctx and exec place in the decorator
caugonnet Aug 29, 2025
947bbcc
fix decorator api
caugonnet Aug 29, 2025
22b2d19
Add ciphertext.like_empty()
caugonnet Aug 29, 2025
66bcde3
Removing prints
caugonnet Aug 29, 2025
84534c8
do not import specific methods
caugonnet Aug 29, 2025
acf0cce
fix decorator api
caugonnet Aug 29, 2025
6a6e84f
Add a pytorch experiment
Aug 29, 2025
297a69b
more pytorch test
Aug 29, 2025
533ca5a
better interop with pytorch
Aug 29, 2025
9aa749f
remove useless pass
Aug 29, 2025
b11aa4b
tensor_arguments
Aug 29, 2025
0af151f
simpler code
Aug 29, 2025
746d308
pre-commit hooks
caugonnet Aug 29, 2025
d9195f5
try to remove dependency on torch and have adapters (WIP)
caugonnet Aug 31, 2025
f5ac828
remove unused code
caugonnet Aug 31, 2025
454a5da
cleanups
caugonnet Aug 31, 2025
ccfbb6b
fix numba adapter
caugonnet Aug 31, 2025
c6e7c07
skip torch test if torch is not available
caugonnet Aug 31, 2025
842a651
add dot vertex even in the low level api
caugonnet Aug 31, 2025
00c649c
fix types
caugonnet Aug 31, 2025
b0fc18d
pre-commit hooks
caugonnet Aug 31, 2025
3b257df
Merge branch 'main' into stf_c_api
caugonnet Aug 31, 2025
04cc07a
dot add_vertex is done in start() now
caugonnet Aug 31, 2025
bce25b8
Start to implement the FDTD example in pytorch
caugonnet Sep 1, 2025
d9c5f11
Start to port in STF version of pytorch
caugonnet Sep 1, 2025
70fa5d8
Adapt the FDTD example to use STF constructs and add methods to initi…
caugonnet Sep 1, 2025
5587a8d
format issue
caugonnet Sep 1, 2025
5ea5243
charset issue
caugonnet Sep 1, 2025
f7fbd34
rank agnostic method to init
caugonnet Sep 1, 2025
aec2d71
use .zero_() to blank fields
caugonnet Sep 1, 2025
eb71880
print values
caugonnet Sep 1, 2025
aaf6ec6
Experiment to display output as an image
caugonnet Sep 1, 2025
ae4c6d6
Use non blocking API
caugonnet Sep 2, 2025
9029fda
remove dead code
caugonnet Sep 2, 2025
ce7a33b
remove dead code
caugonnet Sep 2, 2025
cbde742
minor cleanup
caugonnet Sep 2, 2025
1936db6
Merge branch 'main' into stf_c_api
caugonnet Sep 2, 2025
c91e814
clang-format
caugonnet Sep 2, 2025
3fe6178
Add a C library for CUDASTF (to be used in the python bindings)
caugonnet Sep 2, 2025
666bd07
Merge branch 'main' into stf_c_lib
caugonnet Sep 2, 2025
522b630
remove dead code
caugonnet Sep 2, 2025
4315314
do define and use CCCL_C_EXPERIMENTAL_STF_ENABLE_TESTING
caugonnet Sep 2, 2025
48627aa
Add CUDASTF C lib to tests
caugonnet Sep 2, 2025
410aadd
Merge branch 'main' into stf_c_lib
caugonnet Sep 2, 2025
c87cdaa
Add missing headers
caugonnet Sep 2, 2025
02a9eb6
use snake_case
caugonnet Sep 2, 2025
232133b
Do define CCCL_C_EXPERIMENTAL=1
caugonnet Sep 2, 2025
b60eb6b
Do not do redundant tests
caugonnet Sep 2, 2025
c4c99f0
Add a project to ci/inspect_changes.sh
caugonnet Sep 2, 2025
2f5925b
missing changes in previous commit
caugonnet Sep 2, 2025
3417075
add presets
caugonnet Sep 2, 2025
8c05034
Add override matrix
alliepiper Sep 2, 2025
20faa8f
Properly define structs with a typedef and remove superfluous struct …
caugonnet Sep 3, 2025
d378f5a
Merge branch 'main' into stf_c_lib
caugonnet Sep 3, 2025
8c5e760
fix previous merge
caugonnet Sep 3, 2025
78dc197
Change tensor_arguments to return an element instead of a tuple of on…
caugonnet Sep 3, 2025
2eb2ace
Remove intermediate structures and use opaque pointers instead
caugonnet Sep 3, 2025
6557067
Automatically generated documentation
caugonnet Sep 3, 2025
60266ff
Better implementation of the help to convert C places to the C++ API,…
caugonnet Sep 3, 2025
59f1983
Tell where to find cudax, and remove unnecessary libs
caugonnet Sep 3, 2025
c7fa9e6
Merge branch 'main' into stf_c_lib
caugonnet Sep 3, 2025
97dd6f7
CCCL_ENABLE_C enables c/parallel, CCCL_ENABLE_C_EXPERIMENTAL_STF enab…
caugonnet Sep 3, 2025
1610f0b
Remove unnecessary definitions
caugonnet Sep 3, 2025
4383eaf
Merge branch 'main' into stf_c_lib
caugonnet Sep 3, 2025
101fd0b
Merge branch 'main' into stf_c_lib
caugonnet Sep 4, 2025
4db210b
Merge branch 'main' into stf_c_lib
caugonnet Sep 5, 2025
90a8d20
use more consistent option names
caugonnet Sep 5, 2025
f2d7528
Merge branch 'main' into stf_c_lib
caugonnet Sep 9, 2025
ac667ca
Do not use [[maybe_unused]] for the C lib header because this is only…
caugonnet Sep 9, 2025
5bf62b3
Return an error code in stf_cuda_kernel_add_desc rather than use asse…
caugonnet Sep 9, 2025
c0a54f1
clang-format
caugonnet Sep 9, 2025
4573f9f
Merge branch 'main' into stf_c_lib
caugonnet Sep 9, 2025
abc58d8
Merge branch 'main' into stf_c_api
caugonnet Sep 9, 2025
af43da5
Merge stf_c_lib: Update c/ directory with complete C library implemen…
caugonnet Sep 9, 2025
c00c915
Revert Python linting changes
caugonnet Sep 9, 2025
cdd0d85
Fix Python CMakeLists.txt: Update C library feature flags
caugonnet Sep 9, 2025
afda29f
Fix Python build: Add missing CCCL_ENABLE_C master flag
caugonnet Sep 9, 2025
4f1f079
Complete STF C library configuration: Enable all C library features a…
caugonnet Sep 9, 2025
ccfc41d
Remove obsolete CCCL_ENABLE_C flag
caugonnet Sep 9, 2025
e4b8277
Update CMake configuration to match stf_c_lib structure
caugonnet Sep 9, 2025
6931fa8
Optimize Python build: Remove unnecessary C parallel library
caugonnet Sep 9, 2025
a1a1139
clang-format
caugonnet Sep 9, 2025
a3071f7
Merge branch 'stf_c_lib' into stf_c_api
caugonnet Sep 9, 2025
ecd9f4e
fix pytorch example
caugonnet Sep 9, 2025
4b2ae75
use ascii symbols
caugonnet Sep 9, 2025
5881081
Merge branch 'main' into stf_c_api
caugonnet Sep 9, 2025
4eef870
Merge branch 'main' into stf_c_api
caugonnet Sep 10, 2025
dcb3d39
Cleanup some changes in the infra from a previous merge
caugonnet Sep 10, 2025
1284eb2
Implement logical_data_empty logical_data_zeros, and logical_data_full
caugonnet Sep 10, 2025
0514f29
short names for torch.cuda
caugonnet Sep 10, 2025
5e9b4d5
Introduce pytorch_task
caugonnet Sep 10, 2025
53a4542
clang-format and some minor comment
caugonnet Sep 10, 2025
989f58b
Merge branch 'main' into stf_c_api
caugonnet Sep 17, 2025
93055c0
Merge branch 'main' into stf_c_api
caugonnet Sep 23, 2025
218fda2
make sure stf python tests are wrapped into functions so that pytest …
caugonnet Sep 25, 2025
1f97482
fix the return values of pytests
caugonnet Sep 25, 2025
1e482a4
Merge branch 'main' into stf_c_api
caugonnet Sep 25, 2025
7a58d68
Start to experiment with Warp
caugonnet Sep 25, 2025
9fb1c26
logical_data in python are now initialized with a data place, and the…
caugonnet Sep 25, 2025
5c1d50e
Save WIP: add access modes
caugonnet Sep 25, 2025
9f31b1e
cleanups
caugonnet Sep 25, 2025
c0bb070
Save WIP
caugonnet Sep 25, 2025
7094dd5
Merge branch 'main' into stf_c_api
caugonnet Oct 7, 2025
76d78b4
Adopt to new python hierarchy
caugonnet Oct 8, 2025
e03b062
Merge branch 'main' into stf_c_api
caugonnet Oct 8, 2025
0c11b6a
fix errors in a previous merge
caugonnet Oct 8, 2025
f6c50e1
cuda.cccl.experimental.stf => cuda.stf
caugonnet Oct 8, 2025
efea184
Misc stf python tests improvements
caugonnet Oct 8, 2025
c0d3592
Save WIP on this warp example
caugonnet Oct 8, 2025
eba61eb
Add sanity checks to test the is_void_interface() API
caugonnet Oct 8, 2025
e17c261
support tokens in python
caugonnet Oct 8, 2025
ec9c955
remove debug print
caugonnet Oct 8, 2025
52f4823
python cholesky with cupy
caugonnet Oct 8, 2025
5a32881
improve cholesky example
caugonnet Oct 8, 2025
abd5778
POTRI and Cholesky
caugonnet Oct 9, 2025
80e1085
clang-format
caugonnet Oct 9, 2025
865cf7b
Merge branch 'main' into stf_c_api
caugonnet Oct 9, 2025
4c1551a
how changes to numba-cuda have been merged
caugonnet Oct 9, 2025
77d6af1
Merge branch 'main' into stf_c_api
caugonnet Nov 14, 2025
acc8f49
Merge branch 'main' into stf_c_api
andralex Nov 14, 2025
de333b2
Fix CI precommit
andralex Nov 14, 2025
3834c8f
Merge branch 'main' into stf_c_api
andralex Nov 15, 2025
9a5c265
no need for numba.cuda.config.CUDA_ENABLE_PYNVJITLINK = 1 anymore
caugonnet Nov 24, 2025
9932a24
Merge origin/main into stf_c_api
caugonnet Nov 24, 2025
e7e2adb
Our numba-cuda fix is part of 0.21.0
caugonnet Nov 24, 2025
39040a9
Minor doc fix
caugonnet Nov 25, 2025
8f27fa2
Ensure matplotlib is only used if available
caugonnet Nov 25, 2025
73ac963
Cleanup examples
caugonnet Nov 25, 2025
d90ed64
cmake fix
caugonnet Nov 25, 2025
eb77519
Cmake fixes (need extra cleanup)
caugonnet Nov 25, 2025
b38ff80
Work-around for lazy resource init during graph capture in cuda core
caugonnet Nov 25, 2025
0a3e667
Use a relaxed capture mode
caugonnet Nov 25, 2025
8642fdd
This work-around is not needed anymore with a relaxed capture mode
caugonnet Nov 25, 2025
2a75766
Merge branch 'main' into stf_c_api
caugonnet Nov 25, 2025
0f9865d
cleanup warp example
caugonnet Nov 25, 2025
6466347
Cleanups in the cython code for STF
caugonnet Nov 25, 2025
cfb2930
no need for math.prod for such a simple thing
caugonnet Nov 26, 2025
130ee2a
Simpler code to handle vector types
caugonnet Nov 26, 2025
4bb4d23
fix grid dimension
caugonnet Nov 26, 2025
b8c745e
Use from_dlpack
caugonnet Nov 26, 2025
fb2a3ba
Change the mock-up FHE toy example to have operations that are homomo…
caugonnet Nov 26, 2025
6c2f850
Merge branch 'main' into stf_c_api
caugonnet Nov 26, 2025
da2e1aa
Add some explanation for the use of a relaxed capture mode
caugonnet Nov 26, 2025
852b400
cleaner pytorch adapter
caugonnet Nov 26, 2025
9308af5
Merge branch 'main' into stf_c_api
caugonnet Nov 27, 2025
09913dc
Code simplification
caugonnet Nov 26, 2025
237b2c1
minor fixes
caugonnet Dec 16, 2025
dd6cc26
Merge branch 'main' into stf_c_api
caugonnet Feb 3, 2026
ac148e8
Merge branch 'main' into stf_c_api
caugonnet Feb 8, 2026
5fedcfb
remove a change from main
caugonnet Feb 9, 2026
1fa449f
Merge branch 'main' into stf_c_api
caugonnet Feb 9, 2026
9839495
avoid a pre-commit fail
caugonnet Feb 9, 2026
65155d1
Include STF python bindings in CI
caugonnet Feb 9, 2026
1cce4d4
Make the script executable
caugonnet Feb 9, 2026
1dbfd64
Disable CUFILE in the python build
caugonnet Feb 9, 2026
5545ffb
Attempt to fix compilation on aarch64
caugonnet Feb 9, 2026
291e00c
fix a type conversion issue
caugonnet Feb 9, 2026
3a12081
Merge branch 'main' into stf_c_api
caugonnet Feb 9, 2026
4b54abc
try to fix python packages
caugonnet Feb 9, 2026
97d9b8b
Merge branch 'main' into stf_c_api
caugonnet Feb 9, 2026
5f950c4
gersemi pre-commit hook
caugonnet Feb 10, 2026
8727b24
Conditionally provide the jit decorator if numba-cuda is available
caugonnet Feb 10, 2026
f4c8800
clang-format
caugonnet Feb 10, 2026
ac980ec
Skip STF with MSVC in CI
caugonnet Feb 11, 2026
4821ebd
Merge branch 'main' into stf_c_api
caugonnet Feb 11, 2026
8559e8c
More consistent examples
caugonnet Feb 12, 2026
698739e
pre-commit hooks
caugonnet Feb 12, 2026
4d73287
Add missing copyrights
caugonnet Feb 12, 2026
97ae928
add missing file
caugonnet Feb 12, 2026
6903af7
like_empty -> empty_like
caugonnet Feb 12, 2026
99655d3
Report if the STF bindings cannot be loaded
caugonnet Feb 12, 2026
096ea44
Avoid a global context variable in fhe tests
caugonnet Feb 12, 2026
08fa67d
support an optional name= field in logical_data init methods to have …
caugonnet Feb 12, 2026
5145dff
more consistent aliases in example
caugonnet Feb 12, 2026
cd51231
Fix cmake message
caugonnet Feb 12, 2026
5245067
Remove commented debug leftovers
caugonnet Feb 12, 2026
c055d52
Merge branch 'main' into stf_c_api
caugonnet Feb 12, 2026
79be7ec
fix string format
caugonnet Feb 12, 2026
606896d
Do not tamper HOST_COMPILER
caugonnet Feb 12, 2026
da0487e
Use the existing mechanism to cleanly exclude the test_py_stf job fro…
caugonnet Feb 12, 2026
0fd485a
Merge branch 'main' into stf_c_api
caugonnet Feb 12, 2026
9d8ed4b
Merge branch 'main' into stf_c_api
caugonnet Feb 13, 2026
d9b1ca5
Merge branch 'main' into stf_c_api
caugonnet Feb 13, 2026
f78290a
Merge branch 'main' into stf_c_api
caugonnet Feb 13, 2026
da27328
Restore C in STF's C lib
caugonnet Feb 13, 2026
f22aa6b
Merge branch 'main' into stf_c_api
caugonnet Feb 23, 2026
e4bafa9
Use cuda.core.Buffer.fill (except for 8 bytes values) instead of cupy…
caugonnet Feb 25, 2026
a0c8227
Move fill utilities
caugonnet Feb 25, 2026
2e63918
Make pytorch_task a free function and move it to the test directory
caugonnet Feb 25, 2026
b21d930
wrappers to build pytorch tensors outside of cuda.stf
caugonnet Feb 25, 2026
de6f2f8
Remove dead code
caugonnet Feb 25, 2026
2f89cc1
Move numba utilities outside of the core cuda.stf
caugonnet Feb 25, 2026
1df9b9b
clang-format
caugonnet Feb 25, 2026
97ef675
Move the jit numba decorator in tests too
caugonnet Feb 25, 2026
16e8eec
Add missing file
caugonnet Feb 25, 2026
9fc3250
Merge branch 'main' into stf_c_api
caugonnet Feb 25, 2026
a516a2e
Only keep a cupy fallback to fill 8bytes values, not both cupy and numba
caugonnet Feb 25, 2026
ae43907
Some details about the stf_cai for CAI v3
caugonnet Feb 25, 2026
64cf200
Use relative paths to fix tests in CI
caugonnet Feb 25, 2026
b7abbac
pre-commit hooks
caugonnet Feb 25, 2026
daae555
Add a doc for cuda.stf
caugonnet Feb 25, 2026
0089958
Ensure cuda.stf is usable
caugonnet Feb 26, 2026
201e198
Merge branch 'main' into stf_c_api
caugonnet Feb 26, 2026
96c2421
Try to fix cuda.stf CI
caugonnet Feb 26, 2026
f6d5c2a
Merge branch 'main' into stf_c_api
caugonnet Feb 26, 2026
664f61d
remove __init__.py from test/stf to avoid confusion between libs
caugonnet Feb 26, 2026
5d735d7
Merge branch 'main' into stf_c_api
caugonnet Feb 26, 2026
5f0b044
Merge branch 'main' into stf_c_api
caugonnet Feb 28, 2026
cf7c11e
pre-commit hooks
caugonnet Feb 28, 2026
2570bae
Merge branch 'main' into stf_c_api
caugonnet Mar 2, 2026
62404a6
Merge branch 'main' into stf_c_api
caugonnet Mar 3, 2026
c7b6aab
Merge branch 'main' into stf_c_api
caugonnet Mar 9, 2026
b0df198
Merge branch 'main' into stf_c_api
caugonnet Mar 10, 2026
1f9b89a
There should be no __init__.py file here, otherwise tests becomes a p…
caugonnet Mar 10, 2026
94bdd96
Merge branch 'main' into stf_c_api
caugonnet Mar 10, 2026
832fd76
Disable SASS verification for tests which might generate LDL instruct…
caugonnet Mar 10, 2026
52fb401
Merge branch 'main' into stf_c_api
caugonnet Mar 10, 2026
5156a03
Merge branch 'main' into stf_c_api
caugonnet Mar 10, 2026
7993f55
Merge branch 'main' into stf_c_api
caugonnet Mar 11, 2026
113276c
Merge branch 'main' into stf_c_api
caugonnet Mar 13, 2026
5f12cca
Merge branch 'main' into stf_c_api
caugonnet Mar 13, 2026
961ae8b
Merge branch 'main' into stf_c_api
caugonnet Mar 16, 2026
7bbb57c
Merge branch 'main' into stf_c_api
caugonnet Mar 20, 2026
04f3d6c
Fix STF init helpers with exec_place
caugonnet Mar 22, 2026
3553134
Use CAI v3 for STF task views
caugonnet Mar 22, 2026
dc78d7d
Merge branch 'main' into stf_c_api
caugonnet Mar 25, 2026
779153f
Merge branch 'main' into stf_c_api
caugonnet Mar 25, 2026
6cf5276
Make STF Python bindings opt-in during source builds
caugonnet Mar 25, 2026
4f6d518
pre-commit hooks
caugonnet Mar 25, 2026
223c74d
Merge branch 'main' into stf_c_api
caugonnet Mar 26, 2026
fca46b0
Extract STF into separate cuda-cccl-experimental wheel
caugonnet Mar 26, 2026
a94034a
Merge branch 'main' into stf_c_api
caugonnet Mar 26, 2026
d3baa83
Fix CI workflow build: use single string for `needs` in test_py_stf
caugonnet Mar 26, 2026
c662728
pre-commit hooks
caugonnet Mar 26, 2026
157c772
Update inspect_changes test fixtures for python_experimental project
caugonnet Mar 26, 2026
9b7676a
Rename CI scripts to match project name convention
caugonnet Mar 26, 2026
95af444
Leave python/cuda_cccl/ untouched
caugonnet Mar 26, 2026
f491332
Merge branch 'main' into stf_c_api
caugonnet Mar 26, 2026
03ed80e
fixes for doc
caugonnet Mar 26, 2026
2f4a651
Merge branch 'main' into stf_c_api
caugonnet Mar 27, 2026
a4a001c
Merge branch 'main' into stf_c_api
andralex Mar 28, 2026
443adbc
Merge branch 'main' into stf_c_api
caugonnet Mar 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/actions/workflow-build/build-workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,13 @@ def set_derived_tags(matrix_job):
matrix_job["jobs"].remove(original_job)
matrix_job["jobs"] += expanded_jobs

# Apply project-specific job exclusions (e.g. skip_jobs_on_windows when cxx is MSVC)
skip_on_windows = project.get("skip_jobs_on_windows")
if skip_on_windows and "cxx" in matrix_job and is_windows(matrix_job):
for job in skip_on_windows:
if job in matrix_job["jobs"]:
matrix_job["jobs"].remove(job)


def next_explode_tag(matrix_job):
non_exploded_tags = ["jobs"]
Expand Down
2 changes: 1 addition & 1 deletion c/experimental/stf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.21)

project(CCCL_C_EXPERIMENTAL_STF LANGUAGES CUDA CXX C)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure ?

project(CCCL_C_EXPERIMENTAL_STF LANGUAGES CUDA CXX)

option(
CCCL_C_EXPERIMENTAL_STF_ENABLE_TESTING
Expand Down
67 changes: 59 additions & 8 deletions c/experimental/stf/include/cccl/c/experimental/stf/stf.h
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in the C API were moved to a separate PR (#7567)

Original file line number Diff line number Diff line change
Expand Up @@ -456,36 +456,87 @@ cudaStream_t stf_fence(stf_ctx_handle ctx);
//!
//! \brief Create logical data from existing memory buffer
//!
//! Creates logical data handle from an existing host memory buffer.
//! STF takes ownership of data management during task execution.
//! Creates logical data handle from existing memory buffer, assuming host data place.
//! This is a convenience wrapper around stf_logical_data_with_place() with host placement.
//!
//! \param ctx Context handle
//! \param[out] ld Pointer to receive logical data handle
//! \param addr Pointer to existing data buffer
//! \param addr Pointer to existing data buffer (assumed to be host memory)
//! \param sz Size of data in bytes
//!
//! \pre ctx must be valid context handle
//! \pre ld must not be NULL
//! \pre addr must not be NULL
//! \pre addr must not be NULL and point to host-accessible memory
//! \pre sz must be greater than 0
//! \post *ld contains valid logical data handle
//!
//! \note Original data pointer should not be accessed during task execution
//! \note Data will be written back when logical data is destroyed or context finalized
//! \note This function assumes host memory. For device/managed memory, use stf_logical_data_with_place()
//! \note Equivalent to: stf_logical_data_with_place(ctx, ld, addr, sz, make_host_data_place())
//!
//! \par Example:
//! \code
//! float data[1024];
//! stf_logical_data_handle ld;
//! stf_logical_data(ctx, &ld, data, sizeof(data));
//! stf_logical_data(ctx, &ld, data, sizeof(data)); // Assumes host memory
//! // ... use in tasks ...
//! stf_logical_data_destroy(ld);
//! \endcode
//!
//! \see stf_logical_data_empty(), stf_logical_data_destroy()
//! \see stf_logical_data_with_place(), stf_logical_data_empty(), stf_logical_data_destroy()

void stf_logical_data(stf_ctx_handle ctx, stf_logical_data_handle* ld, void* addr, size_t sz);

//!
//! \brief Create logical data handle from address with data place specification
//!
//! Creates logical data handle from existing memory buffer, explicitly specifying where
//! the memory is located (host, device, managed, etc.). This is the primary and recommended
//! logical data creation function as it provides STF with essential memory location information
//! for optimal data movement and placement strategies.
//!
//! \param ctx Context handle
//! \param[out] ld Pointer to receive logical data handle
//! \param addr Pointer to existing memory buffer
//! \param sz Size of buffer in bytes
//! \param dplace Data place specifying memory location
//!
//! \pre ctx must be valid context handle
//! \pre ld must be valid pointer to logical data handle pointer
//! \pre addr must point to valid memory of at least sz bytes
//! \pre sz must be greater than 0
//! \pre dplace must be valid data place (not invalid)
//!
//! \post *ld contains valid logical data handle on success
//! \post Caller owns returned handle (must call stf_logical_data_destroy())
//!
//! \par Examples:
//! \code
//! // GPU device memory (recommended for CUDA arrays)
//! float* device_ptr;
//! cudaMalloc(&device_ptr, 1000 * sizeof(float));
//! stf_data_place dplace = make_device_data_place(0);
//! stf_logical_data_handle ld;
//! stf_logical_data_with_place(ctx, &ld, device_ptr, 1000 * sizeof(float), dplace);
//!
//! // Host memory
//! float* host_data = new float[1000];
//! stf_data_place host_place = make_host_data_place();
//! stf_logical_data_handle ld_host;
//! stf_logical_data_with_place(ctx, &ld_host, host_data, 1000 * sizeof(float), host_place);
//!
//! // Managed memory
//! float* managed_ptr;
//! cudaMallocManaged(&managed_ptr, 1000 * sizeof(float));
//! stf_data_place managed_place = make_managed_data_place();
//! stf_logical_data_handle ld_managed;
//! stf_logical_data_with_place(ctx, &ld_managed, managed_ptr, 1000 * sizeof(float), managed_place);
//! \endcode
//!
//! \see make_device_data_place(), make_host_data_place(), make_managed_data_place()

void stf_logical_data_with_place(
stf_ctx_handle ctx, stf_logical_data_handle* ld, void* addr, size_t sz, stf_data_place dplace);

//!
//! \brief Set symbolic name for logical data
//!
Expand Down
34 changes: 33 additions & 1 deletion c/experimental/stf/src/stf.cu
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,44 @@ cudaStream_t stf_fence(stf_ctx_handle ctx)
}

void stf_logical_data(stf_ctx_handle ctx, stf_logical_data_handle* ld, void* addr, size_t sz)
{
// Convenience wrapper: assume host memory
stf_logical_data_with_place(ctx, ld, addr, sz, make_host_data_place());
}

void stf_logical_data_with_place(
stf_ctx_handle ctx, stf_logical_data_handle* ld, void* addr, size_t sz, stf_data_place dplace)
{
assert(ctx);
assert(ld);

auto* context_ptr = static_cast<context*>(ctx);
auto ld_typed = context_ptr->logical_data(make_slice((char*) addr, sz));

// Convert C data_place to C++ data_place
cuda::experimental::stf::data_place cpp_dplace;
switch (dplace.kind)
{
case STF_DATA_PLACE_HOST:
cpp_dplace = cuda::experimental::stf::data_place::host();
break;
case STF_DATA_PLACE_DEVICE:
cpp_dplace = cuda::experimental::stf::data_place::device(dplace.u.device.dev_id);
break;
case STF_DATA_PLACE_MANAGED:
cpp_dplace = cuda::experimental::stf::data_place::managed();
break;
case STF_DATA_PLACE_AFFINE:
cpp_dplace = cuda::experimental::stf::data_place::affine();
break;
default:
// Invalid data place - this should not happen with valid input
assert(false && "Invalid data_place kind");
cpp_dplace = cuda::experimental::stf::data_place::host(); // fallback
break;
}

// Create logical data with the specified data place
auto ld_typed = context_ptr->logical_data(make_slice((char*) addr, sz), cpp_dplace);

// Store the logical_data_untyped directly as opaque pointer
*ld = new logical_data_untyped{ld_typed};
Expand Down
3 changes: 2 additions & 1 deletion ci/build_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";

# Script defaults
VERBOSE=${VERBOSE:-}
HOST_COMPILER=${CXX:-g++} # $CXX if set, otherwise `g++`
# Prefer CUDAHOSTCXX when set (e.g. cross-compilation) so -cmake-options and env agree
HOST_COMPILER=${CUDAHOSTCXX:-${CXX:-g++}}
CXX_STANDARD=17
CUDA_COMPILER=${CUDACXX:-nvcc} # $CUDACXX if set, otherwise `nvcc`
CUDA_ARCHS= # Empty, use presets by default.
Expand Down
5 changes: 4 additions & 1 deletion ci/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ jobs:
test_py_coop: { name: "Test cuda.coop", gpu: true, needs: 'build_py_wheel', force_producer_ctk: "pybuild", invoke: { prefix: 'test_cuda_coop'} }
test_py_par: { name: "Test cuda.compute", gpu: true, needs: 'build_py_wheel', force_producer_ctk: "pybuild", invoke: { prefix: 'test_cuda_compute'} }
test_py_examples: { name: "Test cuda.cccl.examples", gpu: true, needs: 'build_py_wheel', force_producer_ctk: "pybuild", invoke: { prefix: 'test_cuda_cccl_examples'} }
test_py_stf: { name: "Test cuda.stf", gpu: true, needs: 'build_py_wheel', force_producer_ctk: "pybuild", invoke: { prefix: 'test_cuda_stf'} }

# Run jobs for 'target' project (ci/util/build_and_test_targets.sh):
run_cpu: { gpu: false }
Expand Down Expand Up @@ -524,7 +525,9 @@ projects:
name: "Python"
job_map:
build: ['build_py_wheel']
test: ['test_py_headers', 'test_py_coop', 'test_py_par', 'test_py_examples']
test: ['test_py_headers', 'test_py_coop', 'test_py_par', 'test_py_examples', 'test_py_stf']
# STF C API and Python bindings are not built for MSVC
skip_jobs_on_windows: ['test_py_stf']
cccl_c_parallel:
name: 'CCCL C Parallel'
stds: [20]
Expand Down
30 changes: 30 additions & 0 deletions ci/test_cuda_stf_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -euo pipefail

ci_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$ci_dir/pyenv_helper.sh"

# Parse common arguments
source "$ci_dir/util/python/common_arg_parser.sh"
parse_python_args "$@"
cuda_major_version=$(nvcc --version | grep release | awk '{print $6}' | tr -d ',' | cut -d '.' -f 1 | cut -d 'V' -f 2)

# Setup Python environment
setup_python_env "${py_version}"

# Fetch or build the cuda_cccl wheel:
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
wheel_artifact_name=$("$ci_dir/util/workflow/get_wheel_artifact_name.sh")
"$ci_dir/util/artifacts/download.sh" ${wheel_artifact_name} /home/coder/cccl/
else
"$ci_dir/build_cuda_cccl_python.sh" -py-version "${py_version}"
fi

# Install cuda_cccl
CUDA_CCCL_WHEEL_PATH="$(ls /home/coder/cccl/wheelhouse/cuda_cccl-*.whl)"
python -m pip install "${CUDA_CCCL_WHEEL_PATH}[test-cu${cuda_major_version}]"

# Run tests for STF module
cd "/home/coder/cccl/python/cuda_cccl/tests/"
python -m pytest -n auto -v stf/
4 changes: 4 additions & 0 deletions cudax/examples/stf/void_data_interface.cu
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved changes to #7972

Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ int main()
return cuda_kernel_desc{dummy_kernel, 16, 128, 0};
};

EXPECT(token.is_void_interface());
EXPECT(token2.is_void_interface());
EXPECT(token3.is_void_interface());

ctx.finalize();
}
3 changes: 2 additions & 1 deletion cudax/test/stf/cpp/task_get_stream.cu
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #7972

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void test_stream()
context ctx;

auto token = ctx.token();
auto t = ctx.task(token.write());
EXPECT(token.is_void_interface());
auto t = ctx.task(token.write());
t.start();
cudaStream_t s = t.get_stream();
EXPECT(s != nullptr);
Expand Down
97 changes: 96 additions & 1 deletion python/cuda_cccl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,34 @@ message(

# Build cccl.c.parallel and add CCCL's install rules
set(_cccl_root ../..)

# Build and install C++ library first
set(CCCL_TOPLEVEL_PROJECT ON) # Enable the developer builds
set(CCCL_ENABLE_C_PARALLEL ON) # Build the cccl.c.parallel library
# STF C interface and Python bindings are not compatible with MSVC; disable on Windows.
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CCCL_ENABLE_C_EXPERIMENTAL_STF OFF)
message(STATUS "STF disabled: not compatible with MSVC")
else()
set(CCCL_ENABLE_C_EXPERIMENTAL_STF ON)
endif()
set(CCCL_ENABLE_UNSTABLE ON) # Enable unstable features

# Disable all testing, examples, and benchmarks - we only want the libraries
set(CCCL_ENABLE_TESTING OFF)
set(CCCL_ENABLE_EXAMPLES OFF)
set(CCCL_ENABLE_BENCHMARKS OFF)
set(CCCL_C_PARALLEL_ENABLE_TESTING OFF)
set(CCCL_C_EXPERIMENTAL_STF_ENABLE_TESTING OFF)
# Note: CCCL_ENABLE_CUDAX must be ON because STF depends on it (via CCCL_ENABLE_UNSTABLE)
# But disable cudax tests, examples, and header testing
set(cudax_ENABLE_TESTING OFF)
set(cudax_ENABLE_EXAMPLES OFF)
set(cudax_ENABLE_HEADER_TESTING OFF)
set(cudax_ENABLE_CUFILE OFF)
set(CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY ${SKBUILD_PROJECT_NAME})
set(CCCL_C_EXPERIMENTAL_STF_LIBRARY_OUTPUT_DIRECTORY ${SKBUILD_PROJECT_NAME})

# Just install the rest:
set(libcudacxx_ENABLE_INSTALL_RULES ON)
set(CUB_ENABLE_INSTALL_RULES ON)
Expand All @@ -34,10 +59,29 @@ add_subdirectory(${_cccl_root} _parent_cccl)
set(CMAKE_INSTALL_LIBDIR "${old_libdir}") # pop
set(CMAKE_INSTALL_INCLUDEDIR "${old_includedir}") # pop

# ensure the destination directory exists
# Create CCCL::cudax alias for STF (normally created by cccl-config.cmake)
if (
CCCL_ENABLE_C_EXPERIMENTAL_STF
AND TARGET cudax::cudax
AND NOT TARGET CCCL::cudax
)
add_library(CCCL::cudax ALIAS cudax::cudax)
endif()

# Ensure the destination directory exists
file(MAKE_DIRECTORY "cuda/compute/${CUDA_VERSION_DIR}/cccl")
if (CCCL_ENABLE_C_EXPERIMENTAL_STF)
file(MAKE_DIRECTORY "cuda/stf/${CUDA_VERSION_DIR}/cccl")
endif()

# Install version-specific binaries
if (CCCL_ENABLE_C_EXPERIMENTAL_STF)
install(
TARGETS cccl.c.experimental.stf
DESTINATION cuda/stf/${CUDA_VERSION_DIR}/cccl
)
endif()

install(
TARGETS cccl.c.parallel
DESTINATION cuda/compute/${CUDA_VERSION_DIR}/cccl
Expand Down Expand Up @@ -116,6 +160,7 @@ python3_add_library(
WITH_SOABI
"${_generated_extension_src}"
)

add_dependencies(_bindings_impl cythonize_bindings_impl)
target_link_libraries(
_bindings_impl
Expand All @@ -126,3 +171,53 @@ target_link_libraries(
set_target_properties(_bindings_impl PROPERTIES INSTALL_RPATH "$ORIGIN/cccl")

install(TARGETS _bindings_impl DESTINATION cuda/compute/${CUDA_VERSION_DIR})

if (CCCL_ENABLE_C_EXPERIMENTAL_STF)
message(STATUS "STF Using Cython ${CYTHON_VERSION}")
set(
stf_pyx_source_file
"${cuda_cccl_SOURCE_DIR}/cuda/stf/_stf_bindings_impl.pyx"
)
set(
_stf_generated_extension_src
"${cuda_cccl_BINARY_DIR}/_stf_bindings_impl.c"
)
set(_stf_depfile "${cuda_cccl_BINARY_DIR}/_stf_bindings_impl.c.dep")
add_custom_command(
OUTPUT "${_stf_generated_extension_src}"
COMMAND "${Python3_EXECUTABLE}" -m cython
ARGS
${CYTHON_FLAGS_LIST} "${stf_pyx_source_file}" --output-file
${_stf_generated_extension_src}
DEPENDS "${stf_pyx_source_file}"
DEPFILE "${_stf_depfile}"
COMMENT "Cythonizing ${stf_pyx_source_file} for CUDA ${CUDA_VERSION_MAJOR}"
)
set_source_files_properties(
"${_stf_generated_extension_src}"
PROPERTIES GENERATED TRUE
)
add_custom_target(
cythonize_stf_bindings_impl
ALL
DEPENDS "${_stf_generated_extension_src}"
)

python3_add_library(
_stf_bindings_impl
MODULE
WITH_SOABI
"${_stf_generated_extension_src}"
)
add_dependencies(_stf_bindings_impl cythonize_stf_bindings_impl)
target_link_libraries(
_stf_bindings_impl
PRIVATE cccl.c.experimental.stf CUDA::cuda_driver
)
set_target_properties(
_stf_bindings_impl
PROPERTIES INSTALL_RPATH "$ORIGIN/cccl"
)

install(TARGETS _stf_bindings_impl DESTINATION cuda/stf/${CUDA_VERSION_DIR})
endif()
Loading
Loading