Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
f88faa0
init: xls backend (not working), implemented xls specific layer infor…
Girjoaba Jul 16, 2025
4496252
test
Girjoaba Jul 16, 2025
d8b2415
feat: loading weights and creating infrastructure added to writer
Girjoaba Jul 17, 2025
fbe2e82
feat: init writer complete
Girjoaba Jul 17, 2025
f9b2863
feat: first end2end working test
Girjoaba Jul 18, 2025
0952f1b
fix: vector input support, change back to current directory
Girjoaba Jul 18, 2025
b32405b
refactoring: predict function call
Girjoaba Jul 24, 2025
6d91666
feat: solo relu activation test pass
Girjoaba Jul 24, 2025
86dd94a
debt cleanup: split dslx templates in multiple files
Girjoaba Jul 26, 2025
0b9ad57
refactoring: simplified writer -> attribute factory written as an opt…
Girjoaba Jul 28, 2025
a78bd1b
feat: softmax xls implementation of table lookup
Girjoaba Jul 31, 2025
b24e581
integrated strategies for the softmax implementation
Girjoaba Jul 31, 2025
039c514
bugfix: softmax latency implementation
Girjoaba Aug 1, 2025
dc8f5a9
cleanup: removed junk file
Girjoaba Aug 1, 2025
248c0f0
feat: stable softmax 1 specific precision working
Girjoaba Aug 1, 2025
4ff3f94
cleanup: removed junk
Girjoaba Aug 1, 2025
9a73968
feat: integrated stable softmax with all layers
Girjoaba Aug 1, 2025
5684d26
feat: softmax stable and argmax working any bit precision combination
Girjoaba Aug 3, 2025
ff02a02
feat: xls utilization report parsing with vivado
Girjoaba Aug 12, 2025
c6a9ccd
wip: cnn
Girjoaba Aug 19, 2025
81af6b6
feat: prepared writer weights for CNNs
Girjoaba Aug 21, 2025
5c42f5c
feat: conv2d_latency is now code generated
Girjoaba Aug 22, 2025
092a809
reverted look_up tables
Girjoaba Aug 28, 2025
90c3231
feat: timing report when building the project
Girjoaba Aug 31, 2025
a7fbae3
Fix input type for top function in DSLX
vasdommes Feb 13, 2026
9e7afe0
Add fix_softmax_table_size to XLS optimization passes
vasdommes Feb 14, 2026
912e6cc
Merge remote-tracking branch 'refs/remotes/origin/main' into xls_backend
vasdommes Feb 16, 2026
a5cccbe
Fix after merge: remove get_shape() and dim names from XLS.
vasdommes Feb 18, 2026
b689c7b
Fix test_softmax.py: replace 'strategy' with 'implementation'
vasdommes Feb 19, 2026
75d5d40
XLS: fix softmax_latency parametric types, refactor func_call generation
vasdommes Feb 16, 2026
c1f0bea
XLS: major refactoring, implement rounding and overflow modes.
vasdommes Mar 16, 2026
7c16b59
Support multidimensional input/output.
vasdommes Mar 18, 2026
ebbb162
Fix XLSFixedPointType.precision()
vasdommes Mar 19, 2026
b820617
XLSBackend.predict(): execute IR code via libxls.so calls instead of …
vasdommes Mar 20, 2026
4afbb9f
Get rid of fxpmath, use xls_types.float_to_significand() instead
vasdommes Mar 23, 2026
b2fc8a5
XLS: add SkipSoftmax pass
vasdommes Mar 23, 2026
a52e3d5
Fix weights and bias precision for XLS
vasdommes Mar 25, 2026
fd9c4ce
Fix XLS conv2d, support strides, padding and data_format.
vasdommes Mar 28, 2026
d8ad048
Merge remote-tracking branch 'refs/remotes/origin/main' into xls_backend
vasdommes Mar 30, 2026
52da2ee
Revert unrelated cosmetic changes
vasdommes Mar 30, 2026
127856d
xls_writer: Remove obsolete code for weights
vasdommes Mar 30, 2026
3301bba
XLS: make top-level function accept bits instead of FixedPoint.
vasdommes Mar 30, 2026
92b578c
Append layer name to DSLX module name, e.g.: layer_4_softmax.
vasdommes Mar 30, 2026
8fce6ba
Use pyxls to convert DSLX -> IR and optimize IR.
vasdommes Apr 1, 2026
63918f5
replace open(Path).read() with Path.read_text()
vasdommes Apr 1, 2026
0d8320b
XLS: add activation functions, rewrite lookup table generation.
vasdommes Apr 8, 2026
4624c7f
Fix XLS conv2d for channels_first case
vasdommes Apr 8, 2026
ddd187c
XLS: cosmetic changes for dense layer
vasdommes Apr 8, 2026
1646cb8
XLS: add Conv1D layer
vasdommes Apr 8, 2026
16081c5
XLS: build lookup tables for antisymmetric functions (softsign and ta…
vasdommes Apr 9, 2026
c63e39a
XLS: fix overflow in fixed_point_util::resize()
vasdommes Apr 10, 2026
4fd978f
remove commented code
vasdommes Apr 15, 2026
2742ece
XLS: Use pyxls API for codegen stage, add config['XLSCodegenFlags'].
vasdommes Apr 1, 2026
7b7c0b0
Remove unused arguments from XLSBackend.create_initial_config(), impl…
vasdommes Apr 20, 2026
bc044be
XLS: fix step size underflow in build_tables()
vasdommes Apr 20, 2026
f4e82aa
test_softmax: reduce input data range for implementation=latency
vasdommes Apr 20, 2026
987961e
test_activations.py: increase softsign table size for XLS backend to …
vasdommes Apr 20, 2026
9b4dc12
Add xls-python to pyproject.toml dependencies, remove dslx_stdlib_pat…
vasdommes Apr 22, 2026
da7e71d
XLS: implement Pooling layers
vasdommes Apr 23, 2026
c4098c8
XLS: fix padding in conv1d/conv2d
vasdommes Apr 23, 2026
70c7b7b
test_activations, test_keras_api, test_softmax.py: enable XLS only fo…
vasdommes Apr 24, 2026
7f42695
Add XLS to test_keras_v3_api.py
vasdommes Apr 24, 2026
355e2fb
XLS templates refactoring: extract DataFormat from conv and pooling l…
vasdommes Apr 27, 2026
6e0af55
Delete conda env file added by mistake
vasdommes Apr 27, 2026
0c629ed
XLS: Implement DepthwiseConv1D and DepthwiseConv2D
vasdommes Apr 27, 2026
c844823
XLS: fix WARNING: Optimizer "{opt}" is not part of any flow and will …
vasdommes Apr 29, 2026
00cda40
XLS: fix vivado report generation and parsing
vasdommes Apr 29, 2026
b64a009
XLS: implement Transpose layer
vasdommes Apr 30, 2026
58730da
XLS: Implement Reshape layer
vasdommes May 1, 2026
8e05f9c
Add XLS to test_pytorch_api.py. TODO: many tests still fail.
vasdommes May 1, 2026
2ec9ef3
Remove custom XLSBackend.predict(), patch XLSBackend.get_top_function…
vasdommes May 1, 2026
17e0a7e
XLS: Allow custom weights and bias precision in dense layer
vasdommes May 1, 2026
19f5416
XLS: fix softmax table precision
vasdommes May 1, 2026
8551cdf
XLS: support multiple layer inputs and outputs
vasdommes May 5, 2026
5351699
XLS: implement Merge layer (Add, Average, Maximum, Minimum, Multiply,…
vasdommes May 7, 2026
3fd9243
XLS: implement Dot layer
vasdommes May 7, 2026
460039d
XLS: implement Concatenate layer (1d, 2d, 3d)
vasdommes May 7, 2026
eb41b4b
XLS: fixed thresholded_relu/relu compilation error when output width/…
vasdommes May 7, 2026
8f14f5f
XLS: implement BatchNormalization layer.
vasdommes May 8, 2026
1af1021
Add more XLS tests
vasdommes May 8, 2026
74fa4a3
Disable XLS in test_pytorch_api.py/test_squeeze, add TODO about shape…
vasdommes May 8, 2026
a1a13cd
XLS: fix binary_tanh and ternary_tanh, allow different threshold prec…
vasdommes May 8, 2026
5743912
XLS: convert XnorPrecisionType and ExponentPrecisionType to FixedPrec…
vasdommes May 8, 2026
d4cf878
XLS: support multiple layer inputs and outputs
vasdommes May 12, 2026
0e57ca3
XLS: custom weights and bias name
vasdommes May 12, 2026
92de294
XLS: fix XnorPrecisionType handling.
vasdommes May 12, 2026
2b9f104
XLS BuildAttr.transform(): use raise ... from to show original except…
vasdommes May 12, 2026
22861fc
XLSBackend.predict(): fix output conversion for bit_count > 64
vasdommes May 12, 2026
7ead10e
Do not throw ModuleNotFoundError for xls when XLSBackend is not actua…
vasdommes May 12, 2026
103bc18
XLSBackend: get rid of os.chdir() calls
vasdommes May 12, 2026
91156f6
XLSBackend: save top function to model._xls_top_function, clear on co…
vasdommes May 12, 2026
479032e
Merge branch 'refs/heads/main' into xls_backend
vasdommes May 13, 2026
137c988
Revert unrelated cosmetic changes
vasdommes May 13, 2026
8c6ecf8
Add .idea to .gitignore
vasdommes May 13, 2026
efe2aca
XLS: fix description in build_prj.tcl
vasdommes May 13, 2026
08a32bf
Add XLS to docs
vasdommes May 13, 2026
2425a5f
pre-commit
vasdommes May 13, 2026
878df24
Update docs/ir/attributes.rst
vasdommes May 13, 2026
e60a23d
setup.rst: add example pip install hls4ml[xls]
vasdommes May 13, 2026
4c41b3a
Add xls to EXTRA_DEPS in pytest/ci-template.yml
vasdommes May 13, 2026
c94b146
cosmetics: inline variable
vasdommes May 14, 2026
fbe97e0
XLS docs: add xls_codegen_flags example
vasdommes May 14, 2026
12b32a7
pre-commit
vasdommes May 14, 2026
8578a62
Reduce XLS dimensions in test_pointwiseconv.py and test_pooling.py to…
vasdommes May 20, 2026
6fff642
Fix test_softmax.py: skip argmax implementation for Catapult backend
vasdommes May 27, 2026
75a04fb
Reduce XLS dimensions in various tests to make them faster.
vasdommes May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sdist/
*.egg-info/
vivado_prj
.vscode
.idea
my-hls-test
*.tar.gz
docs/_build
Expand Down
47 changes: 47 additions & 0 deletions docs/backend/xls.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
============
XLS
============

The XLS backend can convert hls4ml models into SystemVerilog via `Google XLS <https://google.github.io/xls/>`_, which can be converted to IP via **Vivado**.

To enable XLS:
.. code-block:: bash

pip install hls4ml[xls]

hls4ml uses `pyxls <https://calad0i.github.io/pyxls/>`_ package to access XLS API.
pyxls comes with batteries included, and a separate XLS installation is not required.

Workflow
=========================

XLS backend preforms the following transformations:
.. code-block::

hls4ml representation -> DSLX (<ProjectName>.x) -> XLS IR (<ProjectName>.ir) -> Optimized XLS IR (<ProjectName>.opt.ir) -> SystemVerilog (<ProjectName>.sv) -> IP

`DSLX <https://google.github.io/xls/dslx_reference/>`_ is a DSL with Rust-like syntax.
DSLX project generated by hls4ml in ``<OutputDir>/firmware`` contains the main module ``<ProjectName>.x``, layer modules ``layer_<LayerName>.x``, and helper modules in ``ap_types/`` and ``nnet_utils/``.
You may work with this project either through hls4ml or using your own XLS toolchain.

hls4ml calls XLS compiler to convert DSLX into `XLS IR <https://google.github.io/xls/ir_overview/>`_ format (``<ProjectName>.ir``) and then runs IR optimization passes (``<ProjectName>.opt.ir``).

Then, hls4ml uses `XLS Codegen <https://google.github.io/xls/codegen_options/>`_ to generate SystemVerilog (``<ProjectName>.sv``) from IR, and calls **Vivado** for ``<OutputDir>/build_prj.tcl`` to generate IP.

You can override default codegen options:
.. code-block:: python

config = hls4ml.utils.config_from_keras_model(model)
# This sets hls_model.config['XLSCodegenFlags']
hls_model = hls4ml.converters.convert_from_keras_model(
model, hls_config=config, backend='XLS',
xls_codegen_flags={'delay_model': 'asap7', 'generator': 'pipeline', 'use_system_verilog': False}
)

I/O Types and Strategy
=========================

Currently, only ``io_parallel`` is supported. ``Strategy`` is ignored.
All operations are fully unrolled.

XLS supports only signed ``FixedPoint`` type (similar to ``ap_fixed``).
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
backend/catapult
backend/quartus
backend/sr
backend/xls

.. toctree::
:hidden:
Expand Down
3 changes: 3 additions & 0 deletions docs/intro/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ Optional Dependencies
# For symbolic regression
pip install hls4ml[sr]

# For XLS backend
pip install hls4ml[xls]

# For documentation building (developers)
pip install hls4ml[doc]

Expand Down
3 changes: 3 additions & 0 deletions docs/intro/status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ HLS backends:
* Vitis HLS
* Catapult HLS
* oneAPI (experimental)
* XLS (experimental)

A summary of the on-going status of the ``hls4ml`` tool is in the table below.

Expand Down Expand Up @@ -79,6 +80,8 @@ A summary of the on-going status of the ``hls4ml`` tool is in the table below.
+-----------------------+-----+-----+--------------+--------+--------+-----+
| oneAPI (experimental) | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
+-----------------------+-----+-----+--------------+--------+--------+-----+
| XLS (experimental) | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
+-----------------------+-----+-----+--------------+--------+--------+-----+

Other feature notes:

Expand Down
722 changes: 618 additions & 104 deletions docs/ir/attributes.rst

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions hls4ml/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from hls4ml.backends.catapult.catapult_backend import CatapultBackend # isort: skip

from hls4ml.backends.vitis.vitis_backend import VitisBackend # isort: skip
from hls4ml.backends.xls.xls_backend import XLSBackend


def _register_builtin_backends():
Expand All @@ -23,6 +24,7 @@ def _register_builtin_backends():
register_backend('SymbolicExpression', SymbolicExpressionBackend)
register_backend('oneAPI', OneAPIBackend)
register_backend('Libero', LiberoBackend)
register_backend('XLS', XLSBackend)


_register_builtin_backends()
Expand Down
Empty file added hls4ml/backends/xls/__init__.py
Empty file.
Loading
Loading