mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
This backend abstract communication with Hpu Fpga hardware.
It define it's proper entities to prevent circular dependencies with
tfhe-rs.
Object lifetime is handle through Arc<Mutex<T>> wrapper, and enforce
that all objects currently alive in Hpu Hw are also kept valid on the
host side.
It contains the second version of HPU instruction set (HIS_V2.0):
* DOp have following properties:
+ Template as first class citizen
+ Support of Immediate template
+ Direct parser and conversion between Asm/Hex
+ Replace deku (and it's associated endianess limitation) by
+ bitfield_struct and manual parsing
* IOp have following properties:
+ Support various number of Destination
+ Support various number of Sources
+ Support various number of Immediat values
+ Support of multiple bitwidth (Not implemented yet in the Fpga
firmware)
Details could be view in `backends/tfhe-hpu-backend/Readme.md`
27 lines
1.1 KiB
Rust
27 lines
1.1 KiB
Rust
fn main() {
|
|
if cfg!(feature = "hw-xrt") {
|
|
println!("cargo:rustc-link-search=/opt/xilinx/xrt/lib");
|
|
println!("cargo:rustc-link-lib=dylib=stdc++");
|
|
println!("cargo:rustc-link-lib=dl");
|
|
println!("cargo:rustc-link-lib=rt");
|
|
println!("cargo:rustc-link-lib=uuid");
|
|
println!("cargo:rustc-link-lib=dylib=xrt_coreutil");
|
|
|
|
cxx_build::bridge("src/ffi/xrt/mod.rs")
|
|
.file("src/ffi/xrt/cxx/hpu_hw.cc")
|
|
.file("src/ffi/xrt/cxx/mem_zone.cc")
|
|
.flag_if_supported("-std=c++23")
|
|
.include("/opt/xilinx/xrt/include") // Enhance: support parsing bash env instead of hard path
|
|
.flag("-fmessage-length=0")
|
|
.compile("hpu-hw-ffi");
|
|
|
|
println!("cargo:rerun-if-changed=src/ffi/xrt/mod.rs");
|
|
println!("cargo:rerun-if-changed=src/ffi/xrt/cxx/hpu_hw.cc");
|
|
println!("cargo:rerun-if-changed=src/ffi/xrt/cxx/hpu_hw.h");
|
|
println!("cargo:rerun-if-changed=src/ffi/xrt/cxx/mem_zone.cc");
|
|
println!("cargo:rerun-if-changed=src/ffi/xrt/cxx/mem_zone.h");
|
|
} else {
|
|
// Simulation ffi -> nothing to do
|
|
}
|
|
}
|