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.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (382.9 kB view details)

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

da4ml-0.5.2-cp312-abi3-macosx_15_0_arm64.whl (505.1 kB view details)

Uploaded CPython 3.12+macOS 15.0+ ARM64

da4ml-0.5.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (385.5 kB view details)

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

da4ml-0.5.2-cp311-cp311-macosx_15_0_arm64.whl (506.9 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

da4ml-0.5.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (385.7 kB view details)

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

da4ml-0.5.2-cp310-cp310-macosx_15_0_arm64.whl (506.9 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file da4ml-0.5.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4f75025ac4f07db0265933da6ed2ee24b0cc70b6fe65636a77ab900a5f514b44
MD5 0780a5ec783a0688097deff26bc0abd7
BLAKE2b-256 fedf274c0789548a2ad5a233314505833a50d87b0408ff4ced894d2286fdfc61

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.2-cp312-abi3-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.2-cp312-abi3-macosx_15_0_arm64.whl.

File metadata

  • Download URL: da4ml-0.5.2-cp312-abi3-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 505.1 kB
  • Tags: CPython 3.12+, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for da4ml-0.5.2-cp312-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b1ea4995cf6200d5d3a545d04009b46b13c37d2b5dd63d5db92bf4236e760d92
MD5 a2f0e9a3e7936fcc25884629ed04a030
BLAKE2b-256 33efa8f3fd5227c34ec833e2f5d34ee85e278ccf527b240f8b034d2ebb0c0366

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.2-cp312-abi3-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.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 74234dc3f14653a64f1fc126e255e94fff5a703a2a3ef57ff8f7fbb793f8fdc1
MD5 bee6b76a01bbfef138ed91827b05369d
BLAKE2b-256 c74b93d074e2e6be216d1f609769f4e05f8501ff4ef2a617ab879a56150450ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.2-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.2-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 a535c593e6d29bc303aac17091f9267b9ce7117e53079b034ae9e7de5f602fef
MD5 e498a69fc9752dc2dbcb72bb1d34969d
BLAKE2b-256 0516f56ef10672fa157d50df9faa1e9d5b38be5cb4dc5953c17fc6872c563df6

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.2-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.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 abb1ef549e1d9d8538de310277b4024e4d7772537d8f6755f5e7e7b25ca38c51
MD5 d033383ab04e2b3ad3a91208c832a76a
BLAKE2b-256 bc8a89afd39a4dc3146e2817d82eb260504465aba9388285efb890ef58b8aeb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.2-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.2-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for da4ml-0.5.2-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6536cbd703779eb58f4098f0f3efab67cb4a8b02b1ee74f96064547b3f1e688c
MD5 04af97922e549f984e144a238a394066
BLAKE2b-256 c67a62c7d95617c1eec398b77cb13eb3660c979108430c97eca15acb19cde8c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for da4ml-0.5.2-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