Skip to main content

Distributed Arithmetic for Machine Learning

Project description

da4ml: Distributed Arithmetic for Machine Learning

LGPLv3 Documentation PyPI version ArXiv

da4ml is a static computation graph to RTL/HLS design compiler targeting ultra-low latency applications on FPGAs. It as two major components:

  • A fast and performant constant-matrix-vector multiplications (CMVM) optimizer to implement them as efficient adder trees. Common sub-expressions elimination (CSE) with graph-based pre-optimization are performed to reduce the firmware footprint and improve the performance.
  • Low-level symbolic tracing frameworks for generating combinational/fully pipelined logics in HDL or HLS code. da4ml can generate the firmware for almost all fully pipelined networks standalone. Alternatively, da4ml also be used as a plugin in hls4ml to optimize the CMVM operations in the network.

Key Features

  • Optimized Algorithms: Comparing to hls4ml's latency strategy, da4ml's CMVM implementation uses no DSO and consumes up to 50% less LUT usage.
  • Fast code generation: da4ml can generate HDL for a fully pipelined network in seconds. For the same models, high-level synthesis tools like Vivado/Vitis HLS can take up to days to generate the HDL code.
  • Low-level symbolic tracing: As long as the operation can be expressed by a combination of the low-level operations supported, adding new operations is straightforward by "replaying" the operation on the symbolic tensor provided. In most cases, adding support for a new operation/layer takes just a few lines of code in numpy flavor.
  • Automatic model conversion: da4ml can automatically convert models trained in HGQ2 <https://github.com/calad0i/hgq2>_.
  • Bit-accurate Emulation: All operation in da4ml is bit-accurate, meaning the generated HDL code will produce the same output as the original model. da4ml's computation is converted to a RISC-like, instruction set level intermediate representation, distributed arithmetic instruction set (DAIS), which can be easily simulated in multiple ways. da4ml also provides a fast C++ based DAIS interpreter to run bit-exact inference on the traced models for verification and benchmarking.
  • hls4ml integration: da4ml can be used as a plugin in hls4ml to optimize the CMVM operations in the network by setting strategy='distributed_arithmetic' for the strategy of the Dense, EinsumDense, or Conv1/2D layers.

Installation

pip install da4ml

Getting Started

Citation

If you use da4ml in a publication, please cite our TRETS'25 paper with the following bibtex entry:

@article{sun2025da4ml,
    author = {Sun, Chang and Que, Zhiqiang and Loncar, Vladimir and Luk, Wayne and Spiropulu, Maria},
    title = {da4ml: Distributed Arithmetic for Real-time Neural Networks on FPGAs},
    year = {2025},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    issn = {1936-7406},
    url = {https://doi.org/10.1145/3777387},
    doi = {10.1145/3777387},
    journal = {ACM Trans. Reconfigurable Technol. Syst.},
    month = nov,
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

da4ml-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (380.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

da4ml-0.5.1-cp312-cp312-macosx_15_0_arm64.whl (503.1 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

da4ml-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (383.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

da4ml-0.5.1-cp311-cp311-macosx_15_0_arm64.whl (504.9 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

da4ml-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (383.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

da4ml-0.5.1-cp310-cp310-macosx_15_0_arm64.whl (504.9 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file da4ml-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dba18b838d4377caa38ce011598c8b555d27c088dadad08f27eaa7338215cbbd
MD5 68dd52cc0e69bd243007b4f9ec629b93
BLAKE2b-256 cea525a163cd976ebb546557d6b64d0a7faf23303329109f05a4a5d2135617a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on calad0i/da4ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file da4ml-0.5.1-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.1-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d8cb3f5f43cb2092fa5a73c32bd839dd4b5604feef8d33c016337003a8b87b26
MD5 51f0a4b8887e50806ebfed737f7fb8c0
BLAKE2b-256 525fe3c6b28530ce253b6cf093b5ead583b18fb6933c1716a525b8f577daceb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.1-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: python-publish.yml on calad0i/da4ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file da4ml-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c34f43dd1634456d2299d0a973e761625694e1895198d9aa8e5442ec32bc74a
MD5 e5ee4118e98c4e63c0ed4a456951aa09
BLAKE2b-256 b0874605620994314ec4b23051b842c5920d11684faa5de662c15d0b52036779

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on calad0i/da4ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file da4ml-0.5.1-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.1-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3e4de0b5ee0e6ed532096eca4bbdd797b35a1ccce0258bb7b37279ef012a3d0d
MD5 b3ad1655c49c4291d56638f7f3269703
BLAKE2b-256 ebe96d0d94afcde4203f5efe081a1773ea4c959eb27afd27895c259f8775e1b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.1-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: python-publish.yml on calad0i/da4ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file da4ml-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 40b32296f659903d7cda3dd98dc511d6052286bd0f06a0c1e50c9c555999cf01
MD5 7f0613a3791eaf612ad51ad519647539
BLAKE2b-256 a23dd3ff35059a3788e00290283ee665e3b2f8233e1a33b91941430882f8738a

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on calad0i/da4ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file da4ml-0.5.1-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.1-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 da6299eca523e57566e71546f024fe5bf5b63b2c4d1eea63e0e061d7ac76feda
MD5 4f6e439b2f400d84cab3ce229292bef5
BLAKE2b-256 f684d8373cd7ece9a571da4ccc8703bb0b9a6447d397b95690f8d7c533519381

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.1-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: python-publish.yml on calad0i/da4ml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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