NVIDIA / NVIDIA/cccl

[FEA]: Research stateful operators for cuda.parallel

Open
#2,538 1 comment 0 reactions 1 assignee Claimed by @gevtushenko View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Area

Not sure

### Is your feature request related to a problem? Please describe.

At the moment, stateful operators lead to a lot of boilerplate code:

https://github.com/NVIDIA/cccl/blob/87ef1d54b9041fd824fa3ce5480756662dd675be/python/cuda_cooperative/tests/test_block_scan.py#L64-L112

### Describe the solution you'd like

Ideally, I want users to write something along the lines of:

```python
d_input = cp.array([8, 6, 7, 5, 3, 0, 9], dtype=dtype)
cudax.bulk(3, lambda i,d_input=d_input: print(d_input[i]))
```

That'd involve packing as if capture list was passed to a Numba kernel. Numba is already doing that on kernel launches, we just need a state pointer to be passed to C++ foreign function call instead of `cuLaunchKernel`

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.