huggingface / huggingface/candle
How to Implement New Operators Using CUDA Host Functions Along with Thrust and CUB Libraries
- Dominant language
- Rust
- Stars
- 21.1k
- Forks
- 1.8k
- Avg merge
- 16h 42m
- Merged PRs (30d)
- 25
Description
As stated, the CUDA code in the candle-kernels repository seems to only contain kernel functions. When I want to implement new operators (such as nonzero), it seems I'm only able to use Rust for higher-level functionality, which means I cannot utilize the device_vector from Thrust or the flagged APIs from CUB. This poses a significant challenge for implementing my algorithms. For example, to implement nonzero, it seems I would have to reimplement algorithms like exclusive_scan and scatter using the current approach?
I am hoping for a better way to utilize the CUDA ecosystem!
Specifically, I'm interested in how to:
1. Incorporate host functions in CUDA code to facilitate the use of libraries like Thrust and CUB.
2. Effectively leverage these libraries to implement algorithms and operators that are not natively supported in the current codebase.
Any guidance or best practices for achieving this would be greatly appreciated.
(Translate from Chinese using LLM, Might be a little bit.. formal^_^)
Contributor guide
No contributing guide indexed for this repository
Research direction
No specific file, test, or entry point is named. Review the CUDA code in candle-kernels and the Rust higher-level operator path, then investigate how host functions could expose Thrust and CUB for operators such as nonzero. Done means documenting or implementing a concrete, supported integration approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100