Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: (^hls4ml\/templates\/(vivado|quartus)\/(ap_types|ac_types)\/|^test/pytest/test_report/)
exclude: (^hls4ml\/templates\/vivado\/ap_types\/|^test/pytest/test_report/)

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
38 changes: 17 additions & 21 deletions docs/advanced/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ These two templates determine how to populate the config template based on the l

Now, we need to tell hls4ml about the existence of this new layer by registering it.
We also need to register the parser (a.k.a. the layer handler), the template passes, and HLS implementation source code with the particular backend.
In this case, the HLS code is valid for both the Vivado and Quartus backends.
In this case, the HLS code is valid for the Vivado backend.

.. code-block:: Python

Expand All @@ -171,16 +171,14 @@ In this case, the HLS code is valid for both the Vivado and Quartus backends.
# Register the hls4ml's IR layer
hls4ml.model.layers.register_layer('KReverse', HReverse)

for backend_id in ['Vivado', 'Quartus']:
# Register the optimization passes (if any)
backend = hls4ml.backends.get_backend(backend_id)
backend = hls4ml.backends.get_backend('Vivado')

# Register template passes for the given backend
backend.register_template(HReverseConfigTemplate)
backend.register_template(HReverseFunctionTemplate)
# Register template passes for the backend
backend.register_template(HReverseConfigTemplate)
backend.register_template(HReverseFunctionTemplate)

# Register HLS implementation
backend.register_source('/path/to/your/nnet_reverse.h')
# Register HLS implementation
backend.register_source('/path/to/your/nnet_reverse.h')

Finally, we can actually test the ``hls4ml`` custom layer compared to the Keras one.

Expand All @@ -198,17 +196,15 @@ Finally, we can actually test the ``hls4ml`` custom layer compared to the Keras
x = np.random.randint(-5, 5, (8,), dtype='int32')
kres = kmodel(x)

for backend_id in ['Vivado', 'Quartus']:

hmodel = hls4ml.converters.convert_from_keras_model(
kmodel,
output_dir=str(f'hls4mlprj_extensions_{backend_id}'),
backend=backend_id,
io_type='io_parallel',
hls_config={'Model': {'Precision': 'ap_int<6>', 'ReuseFactor': 1}},
)
hmodel = hls4ml.converters.convert_from_keras_model(
kmodel,
output_dir='hls4mlprj_extensions_Vivado',
backend='Vivado',
io_type='io_parallel',
hls_config={'Model': {'Precision': 'ap_int<6>', 'ReuseFactor': 1}},
)

hmodel.compile()
hres = hmodel.predict(x.astype('float32'))
hmodel.compile()
hres = hmodel.predict(x.astype('float32'))

np.testing.assert_array_equal(kres, hres)
np.testing.assert_array_equal(kres, hres)
11 changes: 5 additions & 6 deletions docs/backend/oneapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
oneAPI
======

The **oneAPI** backend of hls4ml is designed for deploying NNs on Intel/Altera FPGAs. It will eventually
replace the **Quartus** backend, which targeted Intel HLS. (Quartus continues to be used with IP produced by the
**oneAPI** backend.) This section discusses details of the **oneAPI** backend.
The **oneAPI** backend of hls4ml is designed for deploying NNs on Intel/Altera FPGAs. Quartus continues to be used
with IP produced by the **oneAPI** backend. This section discusses details of the **oneAPI** backend.

The **oneAPI** code uses SYCL kernels to implement the logic that is deployed on FPGAs. It naturally leads to the
accelerator style of programming. In the SYCL HLS (IP Component) flow, which is currently the only flow supported, the
Expand All @@ -18,8 +17,8 @@ produces the library used for calling the ``predict`` function from hls4ml. The
in hls4ml interact with the cmake system, so one does not need to manually use the build system, but it there
if desired.

The **oneAPI** backend, like the **Quartus** backend, only implements the ``Resource`` strategy for the layers. There
is no ``Latency`` implementation of any of the layers.
The **oneAPI** backend only implements the ``Resource`` strategy for the layers. There is no ``Latency``
implementation of any of the layers.

Note: currently tracing and external weights (i.e. setting BramFactor) are not supported.

Expand All @@ -30,6 +29,6 @@ As mentioned in the :ref:`I/O Types` section, ``io_parallel`` is for small model
larger models. In ``oneAPI``, there is an additional difference: ``io_stream`` implements each layer on its
own ``task_sequence``. Thus, the layers run in parallel, with pipes connecting the inputs and outputs. This
is similar in style to the `dataflow` implementation on Vitis HLS, but more explicit. It is also a change
relative to the Intel HLS-based ``Quartus`` backend. On the other hand, ``io_parallel`` always uses a single task,
relative to the former Intel HLS-based implementation. On the other hand, ``io_parallel`` always uses a single task,
relying on pipelining within the task for good performance. In contrast, the Vitis backend sometimes uses dataflow
with ``io_parallel``.
12 changes: 0 additions & 12 deletions docs/backend/quartus.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
backend/accelerator
backend/oneapi
backend/catapult
backend/quartus
backend/sr
backend/xls

Expand Down
7 changes: 1 addition & 6 deletions docs/intro/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ To run FPGA synthesis, installation of following tools is required:

* Vitis HLS 2023.1 or newer is required for synthesis for Xilinx FPGAs using the ``Vitis`` backend.

* Intel Quartus 20.1 to 21.4 for the synthesis for Intel/Altera FPGAs using the ``Quartus`` backend.

* oneAPI 2024.1 to 2025.0 with the FPGA compiler and recent Intel/Altera Quartus for Intel/Altera FPGAs using the ``oneAPI`` backend. Newer versions of ``OneAPI`` removed FPGA support and **will to work** with ``hls4ml``.
* oneAPI 2024.1 to 2025.0 with the FPGA compiler and recent Intel/Altera Quartus for Intel/Altera FPGAs using the ``oneAPI`` backend. Newer versions of ``oneAPI`` removed FPGA support and **will not work** with ``hls4ml``.

Catapult HLS 2024.1_1 or 2024.2 can be used to synthesize both for ASICs and FPGAs.

Expand Down Expand Up @@ -201,9 +199,6 @@ Optional Dependencies
# For QKeras-v3 frontend
pip install hls4ml[qkeras-v3]

# For Quartus report parsing
pip install hls4ml[quartus-report]

# For symbolic regression
pip install hls4ml[sr]

Expand Down
Loading
Loading