Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial transpile of dav1d #1

Closed
randomPoison opened this issue Feb 22, 2023 · 3 comments
Closed

Initial transpile of dav1d #1

randomPoison opened this issue Feb 22, 2023 · 3 comments
Assignees

Comments

@randomPoison
Copy link
Collaborator

Transpile libdav1d and the dav1d CLI tool to Rust using c2rust. This initial version can disable features like assembly as needed to get an initial Rust translation of the library that builds.

@randomPoison randomPoison self-assigned this Feb 22, 2023
@randomPoison
Copy link
Collaborator Author

randomPoison commented Feb 22, 2023

I've pushed an initial fork of dav1d that includes transpiled Rust sources alongside their original C equivalents in 099f2b2. To get it to work, I needed to do a few things:

  • Build and install c2rust from WIP: Support C11 atomics required by dav1d immunant/c2rust#814 to work around a bug that was causing the transpile to fail.
  • Configure meson with the build options enable_asm=false and bitdepths=['16'].
  • Specifically build the tools/dav1d ninja target when generating compile_commands.json to avoid transpiling the files in tests/checkasm because c2rust cannot currently translate those files.

The full process for doing the transpile is:

mkdir build && cd build
meson setup ..
meson configure -Denable_asm=false "-Dbitdepths=['16']"
cd ..
bear -- ninja -C build tools/dav1d
c2rust transpile compile_commands.json -b dav1d --overwrite-existing

This was referenced Feb 22, 2023
@kkysen
Copy link
Collaborator

kkysen commented Feb 22, 2023

Btw, meson configure should generate a compile_commands.json on its own, so we wouldn't have to use bear and compile. Though if we want to skip compile commands that don't generate dav1d (e.x. tests/checkasm), we might have to do it this way anyways. Does this way still transpile any other non-checkasm tests?

Also, there's already a Rust port of checkasm, rust-av/checkasm-rs, so we should try to use that.

@randomPoison
Copy link
Collaborator Author

Doing bear -- ninja -C build tools/dav1d doesn't compile any of the tests, so currently none of the tests have been transpiled. That was the main reason for using bear instead of the compile_commands.json generated by meson configure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants