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
41 changes: 19 additions & 22 deletions docs/advanced/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ These two templates determine how to populate the config template based on the l
return self.template.format(**params)

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 the HLS implementation source code with the particular backend.
In this case, the HLS code is valid for both the Vivado and Quartus backends.
We also need to register the parser (a.k.a. the layer handler), the
template passes, and the HLS implementation source code with the particular backend.
In this case, the HLS code is valid for the Vivado backend.

.. code-block:: Python

Expand All @@ -171,16 +172,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 +197,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)
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 @@ -39,7 +39,6 @@
backend/altera
backend/vitis_unified
backend/catapult
backend/quartus
backend/sr
backend/xls

Expand Down
5 changes: 0 additions & 5 deletions docs/intro/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ To run FPGA synthesis, installation of the 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 synthesis for Intel/Altera FPGAs using the ``Quartus`` backend.

* Altera HLS IP Gen (version 2026.1.0 tested) and recent Intel/Altera Quartus for Intel/Altera FPGAs using the ``Altera`` backend.

Catapult HLS 2024.1_1 or 2024.2 can be used to synthesize both for ASICs and FPGAs.
Expand Down Expand Up @@ -204,9 +202,6 @@ Optional Dependencies
# For QKeras-v3 frontend
pip install hls4ml[qkeras-v3]

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

# For snnTorch frontend
pip install hls4ml[snn]

Expand Down
Loading
Loading