immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.91k stars 229 forks source link

Update Vector Operations #940

Open novafacing opened 1 year ago

novafacing commented 1 year ago

I discovered several issues when trying to transpile ggml.c (Attached along with a compile_commands.json) and decided to learn a little bit about c2rust and try and tackle them. I'm submitting as a draft PR for reference, I'm interested in tackling some of this myself but I'm not a member of the project so I wanted to start a discussion before putting in that effort. The issues I spotted are:

There is one problem I didn't address which is that implicit casting between vector types doesn't seem to be supported anywhere. I couldn't figure out where I could access the "destination type" of these casts, but in general vector type cast builtins like _mm256_castps_pd can be emitted (these calls are free, they're just casts) to explicitly convert these types whenever an implicit cast is found.