Conversation
|
Oh so the version in your PR, to which version does it correspond in CUDA exactly? EDIT: @micahcc And could you also add the padding to it? I think technically without it the struct may be incompatible due to alignment. Also a static check on the size of the struct would be nice :) |
|
@gerwin3 I think without codegen this might get pretty ugly. I think we would want to make a C version of the cudaDeviceProperties with our own layout and then manually copy each field. That way we can guarantee the memory layout in rust. The cuda versions are listed in the diff view I posted (10, 11.8, 12.8). I'm fine doing the grunt work of doing the manual copy if you're ok with the long term maintenance burden of it (I don't think its high, but some people might balk) Honestly though the memcpy I have right now will handle any lengthening or shortening of the struct, the only risk is if they add something in the middle, but nothing should result in buffer overruns, at worst it would lead to corrupt data. |
|
Actually as shown in your diff the CUDA team has already taken this into account. They added padding to the end of the struct to ensure it is the same size across versions (it is basically a promise they will never go bigger than that). You can just embed the padding on the Rust-side. As long as the struct has |
|
Also, could you split this PR in 2:
That way I can review and accept them separately. |
|
Sorry yeah, shouldn't have merged main, let me make branches |
|
@gerwin3 ok, updated.
|
Different versions of cudaDeviceProps struct:
