Skip to content

feat(kernels): scaffold TVM FFI bidirectional interop test#202

Open
peter941221 wants to merge 2 commits into
openinfer-project:mainfrom
peter941221:feat/tvm-ffi-interop-scaffold
Open

feat(kernels): scaffold TVM FFI bidirectional interop test#202
peter941221 wants to merge 2 commits into
openinfer-project:mainfrom
peter941221:feat/tvm-ffi-interop-scaffold

Conversation

@peter941221

@peter941221 peter941221 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor
  1. Summary

This adds the first validation slice for #191 inside pegainfer-kernels.

The patch keeps TVM FFI behind a default-off tvm-ffi-interop feature, adds a small C++ fixture, and adds one ignored integration test that proves both call directions before any production FFI path changes.

  1. Invariants
  • The default build still does not pull in TVM FFI.
  • Existing handwritten CUDA / cuBLAS / FlashInfer / Triton AOT boundaries stay unchanged.
  • This PR does not change runtime behavior, scheduler behavior, or model code.
  • The first milestone stays CPU-only on the fixture side.
  1. Changes
  • Add optional tvm-ffi = "0.1.0-alpha.0" to pegainfer-kernels and gate it behind tvm-ffi-interop.
  • Add tests/fixtures/tvm_ffi_fixture.cc with four exported functions that cover:
    • direct Rust -> TVM FFI scalar call
    • Rust callback passed into TVM FFI
    • TVM FFI callback into a Rust global function
    • callback error propagation back into Rust
  • Add tests/tvm_ffi_bidirectional.rs as an ignored integration test that builds the fixture at test runtime and verifies both call directions plus missing-symbol diagnostics.
  1. Validation

cargo fmt --all --check

cargo check --release -p pegainfer-kernels --features tvm-ffi-interop --tests -j 1

cargo test --release -p pegainfer-kernels --features tvm-ffi-interop tvm_ffi_bidirectional -- --ignored --nocapture

  1. Related

Related to #191.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces TVM FFI bidirectional interoperability support to the pegainfer-kernels crate, adding the tvm-ffi dependency, a new tvm-ffi-interop feature, a C++ test fixture, and a comprehensive integration test. Feedback suggests removing the unnecessary cargo:rerun-if-changed directive for the test fixture in build.rs to prevent slow, redundant library rebuilds. Additionally, it is recommended to replace the login shell invocation (sh -lc) with a standard shell (sh -c) in the integration test to improve reliability and performance in CI/CD environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pegainfer-kernels/build.rs Outdated
Comment thread pegainfer-kernels/tests/tvm_ffi_bidirectional.rs
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

Successfully merging this pull request may close these issues.

1 participant