Robert Rusch
Robert Rusch
My advice is probably checking out some of the other CUDA wrapper implementations for other languages. PyCUDA seems to be the most popular non C/C++ binding set, and I'm sure...
I'll take a stab at this.
My current plan is to add the trait `AsyncCopyDestination` which would have `async_copy_from` and `async_copy_to`. My other thought was implementing a version of `CopyDestination` that is async, but that precludes...
Additionally, `device.rs` is getting rather large (~1200 lines), so I'd like your thoughts on splitting it into `sync.rs` for synchronous memory transfer functions and tests, `async.rs` for asynchronous functions and...
Actually, spinning off `DeviceBox`, `DeviceSlice`, `DeviceChunks`, and `DeviceBuffer` into their own files, if possible, would probably be cleaner.
Hmmm, I forgot how tricky async safety is. To make sure the arguments stay valid, maybe returning a promise bound to the lifetime of the passed references is the way...
My current thought is something similar to [this code](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=57e7105eeaa4abbffd76d087862916bd). . This would also require bookkeeping in the buffers themselves to panic if the promise is dropped and then buffers used....
Yeah, I didn't really explain the ideas for bookkeeping around if the promise is dropped at all. My bad on that. Anyways, this scope approach looks very promising!
Ah, I think I understand what your saying now and think that should work.
Cool, it works. [Link.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b94c039d9cc2b08d8d4b012a3f01872d) Will need to sprinkle in some unsafe black magic, so that the data can be copied back from the mutable buffer by future async_memcpy calls.