mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -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`
51 lines
1.9 KiB
Makefile
51 lines
1.9 KiB
Makefile
set fallback := true
|
|
|
|
_targets:
|
|
@just --list --unsorted --list-heading $'Available targets:\n' --list-prefix " "
|
|
|
|
# Default values ---------------------------------------------------------------
|
|
DEFAULT_RUST_LOG := "info"
|
|
DEFAULT_MOCKUP_PARAMS := "gaussian_64b_fast.toml"
|
|
DEFAULT_TEST_ITER := "5"
|
|
CARGO_HOME := "$(pwd)/../.."
|
|
BUILD_PROFILE := "release"
|
|
|
|
### Build target ---------------------------------------------------------------
|
|
# NB: Build mockup and user software all at once to reduce build time
|
|
build_all:
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
cd {{CARGO_HOME}}
|
|
cargo build --profile {{BUILD_PROFILE}} --features="hpu" \
|
|
--bin hpu_mockup \
|
|
--example hpu_bench\
|
|
--example hpu_hlapi
|
|
|
|
### Mockup related target ------------------------------------------------------
|
|
mockup MOCKUP_PARAMS=DEFAULT_MOCKUP_PARAMS RUST_LOG=DEFAULT_RUST_LOG: build_all
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
RUST_LOG={{RUST_LOG}} {{CARGO_HOME}}/target/{{BUILD_PROFILE}}/hpu_mockup \
|
|
--params $HPU_MOCKUP_DIR/params/{{MOCKUP_PARAMS}} \
|
|
--report-out mockup_rpt --report-trace
|
|
|
|
# UserApp related target -------------------------------------------------------
|
|
# Run Hpu benchmark
|
|
hpu_bench ARGS="" RUST_LOG=DEFAULT_RUST_LOG: build_all
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
RUST_LOG={{RUST_LOG}} {{CARGO_HOME}}/target/{{BUILD_PROFILE}}/examples/hpu_bench {{ARGS}}
|
|
|
|
# Run Hpu HlApi showcase
|
|
hpu_hlapi ARGS="" RUST_LOG=DEFAULT_RUST_LOG: build_all
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
RUST_LOG={{RUST_LOG}} {{CARGO_HOME}}/target/{{BUILD_PROFILE}}/examples/hpu_hlapi {{ARGS}}
|
|
|
|
# Run Hpu testsuite
|
|
hpu_test ARGS="u8" TEST_ITER=DEFAULT_TEST_ITER RUST_LOG=DEFAULT_RUST_LOG: build_all
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
cd {{CARGO_HOME}}
|
|
RUST_LOG={{RUST_LOG}} HPU_TEST_ITER={{TEST_ITER}} cargo test --profile {{BUILD_PROFILE}} --test hpu -- {{ARGS}}
|