Skip to main content

BDT Inference for FPGAs

Project description

conifer

Conifer translates trained Boosted Decision Trees to FPGA firmware for extreme low latency inference.

Installation

Conifer is on the Python Package Index, so install it like:

pip install conifer

About

Conifer converts from popular BDT training frameworks, and can emit code projects in different FPGA languages. Available converters:

  • scikit-learn
  • xgboost
  • ONNX - giving access to other training libraries such as lightGBM and CatBoost with ONNXMLTools
  • TMVA

Available backends:

  • Xilinx HLS - for best results use latest Vitis HLS, but Vivado HLS is also supported (conifer uses whichever is on your $PATH)
  • VHDL - a direct-to-VHDL implementation, deeply pipelined for high clock frequencies
  • C++ - intended for bit-accurate emulation on CPU with a single include header file

See our paper in JINST: "Fast inference of Boosted Decision Trees in FPGAs for particle physics".

Conifer originated as a development for hls4ml, and borrows heavily from the code and ideas developed for it.

Usage

from sklearn.ensemble import GradientBoostingClassifier
# Train a BDT
clf = GradientBoostingClassifier().fit(X_train, y_train)

# Create a conifer config dictionary
cfg = conifer.backends.xilinxhls.auto_config()
# Change the bit precision (print the config to see everything modifiable)
cfg['Precision'] = 'ap_fixed<12,4>' 

# Create the conifer model
model = conifer.model(clf, conifer.converters.sklearn,
                      conifer.backends.xilinxhls, cfg)
# Write the HLS project and compile the C++-Python bridge                      
model.compile()

# Run bit-accurate prediction on the CPU
y_hls = model.decision_function(X)
y_skl = clf.decision_function(X)

# Synthesize the model for the target FPGA
model.build()

Check the examples directory for examples to get started with, and the BDT part of the hls4ml tutorial.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conifer-0.4.tar.gz (68.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conifer-0.4-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file conifer-0.4.tar.gz.

File metadata

  • Download URL: conifer-0.4.tar.gz
  • Upload date:
  • Size: 68.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for conifer-0.4.tar.gz
Algorithm Hash digest
SHA256 d5f4a28160ee45cc759d91bd0834761b94079e1eb6e6b1333b39566ddcc8b0b6
MD5 058a5baffcd5fc3b4bcf17113daedfef
BLAKE2b-256 a051be0364dff88cbd31a815e28bab3e7ae13e71fb985ea98c1d7e199db2bb12

See more details on using hashes here.

File details

Details for the file conifer-0.4-py3-none-any.whl.

File metadata

  • Download URL: conifer-0.4-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for conifer-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d2b1bcdb25cf5783ae2069ed16954b4e3da305e0084f70c17fea5b2090686f9
MD5 f0241c09939be85df3fa628b01fd2d55
BLAKE2b-256 36681a00db082d0f37aead097663feec3b9584b563f2e4c5ebc26b64c9dbb434

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page