Files
tfhe-rs/backends/tfhe-hpu-backend/python/bin/demo.py
Baptiste Roux 9ee8259002 feat(hpu): Add Hpu backend implementation
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`
2025-05-16 16:30:23 +02:00

29 lines
685 B
Python
Executable File

#!/usr/bin/env python3
from pandas import DataFrame
from isctrace.analysis import Refilled, Retired, Trace
freq_mhz = 300
iops = Trace.from_hw("data/trace.json")
def analyze_iop(iop):
retired = Retired(iop)
# Print the retired instructions as a table
print(retired.to_df().to_string())
# Print a batch latency table
latency_table = retired.pbs_latency_table(freq_mhz=freq_mhz).drop(columns='data')
print(latency_table)
# And the runtime
runtime = retired.runtime_us(freq_mhz=freq_mhz)
print(f"batches: {latency_table['count'].sum()}")
print(f"Runtime: {runtime}us")
if __name__ == "__main__":
analyze_iop(iops[0])
# vim: fdm=marker