Skip to content

Commit 6d691a3

Browse files
committed
Merge remote-tracking branch 'xilinx/dev' into deps/pyyaml
2 parents e5f65cf + 88e207e commit 6d691a3

File tree

115 files changed

+3358
-1513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3358
-1513
lines changed

.github/workflows/quicktest-dev-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ jobs:
2222
export FINN_ROOT=$(pwd)
2323
export FINN_BUILD_DIR=/tmp/finn_gha
2424
export FINN_INST_NAME=finn_gha
25+
export FINN_SKIP_XRT_DOWNLOAD=1
2526
./run-docker.sh quicktest

.readthedocs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ sphinx:
4444
python:
4545
install:
4646
- requirements: docs/requirements.txt
47+
48+
formats:
49+
- pdf

AUTHORS.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ Contributors
3434
* Shashwat Khandelwal (@shashwat1198)
3535
* Ian Colbert (@i-colbert)
3636
* Rachit Garg (@rstar900)
37+
* Christoph Berganski (@iksnagreb)
38+
* Jonas Kuehle (@vopade)
39+
* Aditya S (@Adityasrinivas24)

docker/Dockerfile.finn

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ FROM ubuntu:jammy-20230126
3131
LABEL maintainer="Jakoba Petri-Koenig <[email protected]>, Yaman Umuroglu <[email protected]>"
3232

3333
ARG XRT_DEB_VERSION="xrt_202220.2.14.354_22.04-amd64-xrt"
34+
ARG SKIP_XRT
35+
ARG LOCAL_XRT
3436

3537
WORKDIR /workspace
3638

@@ -78,15 +80,19 @@ RUN cd verilator && \
7880
make install
7981

8082
# install XRT
81-
RUN wget https://www.xilinx.com/bin/public/openDownload?filename=$XRT_DEB_VERSION.deb -O /tmp/$XRT_DEB_VERSION.deb
82-
RUN apt install -y /tmp/$XRT_DEB_VERSION.deb
83-
RUN rm /tmp/$XRT_DEB_VERSION.deb
83+
RUN if [ -z "$LOCAL_XRT" ] && [ -z "$SKIP_XRT" ];then \
84+
wget -U 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17' "https://www.xilinx.com/bin/public/openDownload?filename=$XRT_DEB_VERSION.deb" -O /tmp/$XRT_DEB_VERSION.deb; fi
85+
86+
COPY requirements.txt $XRT_DEB_VERSION.* /tmp/
87+
88+
RUN if [ -z "$SKIP_XRT" ];then \
89+
apt install -y /tmp/$XRT_DEB_VERSION.deb && \
90+
rm /tmp/$XRT_DEB_VERSION.deb; fi
8491

8592
# versioned Python package requirements for FINN compiler
8693
# these are given in requirements.txt
87-
COPY requirements.txt .
88-
RUN pip install -r requirements.txt
89-
RUN rm requirements.txt
94+
RUN pip install -r /tmp/requirements.txt
95+
RUN rm /tmp/requirements.txt
9096

9197
# install PyTorch
9298
RUN pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
@@ -127,6 +133,9 @@ RUN pip install tokenize-rt==4.2.1
127133
# pyverilator
128134
RUN pip install tclwrapper==0.0.1
129135

136+
# assure that we have the right setuptools version
137+
RUN pip install setuptools==68.2.2
138+
130139
# extra environment variables for FINN compiler
131140
ENV VIVADO_IP_CACHE "/tmp/vivado_ip_cache"
132141

docker/finn_entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if [ -f "$VITIS_PATH/settings64.sh" ];then
8686
source $XILINX_XRT/setup.sh
8787
gecho "Found XRT at $XILINX_XRT"
8888
else
89-
recho "XRT not found on $XILINX_XRT, did the installation fail?"
89+
recho "XRT not found on $XILINX_XRT, did you skip the download or did the installation fail?"
9090
exit -1
9191
fi
9292
else

docs/finn/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Which data layout do FINN-generated accelerators use? Big-endian? Little-endian?
8181
If you need to do this manually, first examine how the `FINN PYNQ Python drivers <https://github.com/Xilinx/finn-examples/blob/main/finn_examples/driver.py#L379>`_ do this – notice how the input data is
8282
first reshaped to create the “folded input shape” that reflects the word size of the first layer based on how much it
8383
was parallelized, then data packing is applied to obtain a raw byte array (with some reversals going on) that can be
84-
fed directly to the hardware. Another example of this is the `npy_to_rtlsim_input <https://github.com/Xilinx/finn-base/blob/dev/src/finn/util/data_packing.py#L289>`_ function, which converts npy arrays to lists of Python arbitrary-precision integers that we feed into pyverilator for rtl simulation.
84+
fed directly to the hardware. Another example of this is the `npy_to_rtlsim_input <https://github.com/Xilinx/finn/blob/dev/src/finn/util/data_packing.py#L284>`_ function, which converts npy arrays to lists of Python arbitrary-precision integers that we feed into pyverilator for rtl simulation.
8585

8686
Why does FIFO sizing take so long for my network? Is something wrong?
8787
The automatic FIFO sizing in FINN can take quite long. It unfortunately doesn’t really parallelize on multiple cores since

fetch-repos.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

30-
QONNX_COMMIT="fd61cfeebbdaba351abf7e9d54cd785d7776fa4f"
31-
FINN_EXP_COMMIT="de99347e936d51715f5356a1b6c64e37b91c23c2"
32-
BREVITAS_COMMIT="84f42259ec869eb151af4cb8a8b23ad925f493db"
30+
QONNX_COMMIT="2281a777d84aa5cbd7469085c2e534fb4a03ccf9"
31+
FINN_EXP_COMMIT="0724be21111a21f0d81a072fccc1c446e053f851"
32+
BREVITAS_COMMIT="d4834bd2a0fad3c1fbc0ff7e1346d5dcb3797ea4"
3333
PYVERILATOR_COMMIT="ce0a08c20cb8c1d1e84181d6f392390f846adbd1"
3434
CNPY_COMMIT="4e8810b1a8637695171ed346ce68f6984e585ef4"
3535
HLSLIB_COMMIT="16e5847a5e3ef76cffe84c8fad2f010d593457d3"

finn-rtllib/fifo/hdl/Q_srl.v

Lines changed: 77 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
7474
parameter depth = 16; // - greatest #items in queue (2 <= depth <= 256)
7575
parameter width = 16; // - width of data (i_d, o_d)
7676

77-
parameter addrwidth = $clog2(depth);
77+
localparam countwidth = $clog2(depth + 1);
78+
localparam addrwidth = $clog2(depth);
7879

7980
input clock;
8081
input reset;
@@ -89,10 +90,10 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
8990
input o_r; // - output stream ready
9091
wire o_b; // - output stream back-pressure
9192

92-
output [addrwidth:0] count; // - output number of elems in queue
93-
output [addrwidth:0] maxcount; // - maximum observed count since reset
93+
output [countwidth-1:0] count; // - output number of elems in queue
94+
output [countwidth-1:0] maxcount; // - maximum observed count since reset
9495

95-
reg [addrwidth:0] maxcount_reg; // - maximum count seen until now
96+
reg [countwidth-1:0] maxcount_reg; // - maximum count seen until now
9697
reg [addrwidth-1:0] addr, addr_, a_; // - SRL16 address
9798
// for data output
9899
reg shift_en_; // - SRL16 shift enable
@@ -183,58 +184,58 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
183184
end // always @ (posedge clock or negedge reset)
184185

185186
always @* begin // - combi always
186-
srlo_ <= 'bx;
187-
shift_en_o_ <= 1'bx;
188-
shift_en_ <= 1'bx;
189-
addr_ <= 'bx;
190-
state_ <= 2'bx;
187+
srlo_ = 'bx;
188+
shift_en_o_ = 1'bx;
189+
shift_en_ = 1'bx;
190+
addr_ = 'bx;
191+
state_ = 2'bx;
191192
case (state)
192193

193194
state_empty: begin // - (empty, will not produce)
194195
if (i_v) begin // - empty & i_v => consume
195-
srlo_ <= i_d;
196-
shift_en_o_ <= 1;
197-
shift_en_ <= 1'bx;
198-
addr_ <= 0;
199-
state_ <= state_one;
196+
srlo_ = i_d;
197+
shift_en_o_ = 1;
198+
shift_en_ = 1'bx;
199+
addr_ = 0;
200+
state_ = state_one;
200201
end
201202
else begin // - empty & !i_v => idle
202-
srlo_ <= 'bx;
203-
shift_en_o_ <= 0;
204-
shift_en_ <= 1'bx;
205-
addr_ <= 0;
206-
state_ <= state_empty;
203+
srlo_ = 'bx;
204+
shift_en_o_ = 0;
205+
shift_en_ = 1'bx;
206+
addr_ = 0;
207+
state_ = state_empty;
207208
end
208209
end
209210

210211
state_one: begin // - (contains one)
211212
if (i_v && o_b) begin // - one & i_v & o_b => consume
212-
srlo_ <= 'bx;
213-
shift_en_o_ <= 0;
214-
shift_en_ <= 1;
215-
addr_ <= 0;
216-
state_ <= state_more;
213+
srlo_ = 'bx;
214+
shift_en_o_ = 0;
215+
shift_en_ = 1;
216+
addr_ = 0;
217+
state_ = state_more;
217218
end
218219
else if (i_v && !o_b) begin // - one & i_v & !o_b => cons+prod
219-
srlo_ <= i_d;
220-
shift_en_o_ <= 1;
221-
shift_en_ <= 1;
222-
addr_ <= 0;
223-
state_ <= state_one;
220+
srlo_ = i_d;
221+
shift_en_o_ = 1;
222+
shift_en_ = 1;
223+
addr_ = 0;
224+
state_ = state_one;
224225
end
225226
else if (!i_v && o_b) begin // - one & !i_v & o_b => idle
226-
srlo_ <= 'bx;
227-
shift_en_o_ <= 0;
228-
shift_en_ <= 1'bx;
229-
addr_ <= 0;
230-
state_ <= state_one;
227+
srlo_ = 'bx;
228+
shift_en_o_ = 0;
229+
shift_en_ = 1'bx;
230+
addr_ = 0;
231+
state_ = state_one;
231232
end
232233
else if (!i_v && !o_b) begin // - one & !i_v & !o_b => produce
233-
srlo_ <= 'bx;
234-
shift_en_o_ <= 0;
235-
shift_en_ <= 1'bx;
236-
addr_ <= 0;
237-
state_ <= state_empty;
234+
srlo_ = 'bx;
235+
shift_en_o_ = 0;
236+
shift_en_ = 1'bx;
237+
addr_ = 0;
238+
state_ = state_empty;
238239
end
239240
end // case: state_one
240241

@@ -243,60 +244,60 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
243244
// - (full, will not consume)
244245
// - (full here if depth==2)
245246
if (o_b) begin // - full & o_b => idle
246-
srlo_ <= 'bx;
247-
shift_en_o_ <= 0;
248-
shift_en_ <= 0;
249-
addr_ <= addr;
250-
state_ <= state_more;
247+
srlo_ = 'bx;
248+
shift_en_o_ = 0;
249+
shift_en_ = 0;
250+
addr_ = addr;
251+
state_ = state_more;
251252
end
252253
else begin // - full & !o_b => produce
253-
srlo_ <= srl[addr];
254-
shift_en_o_ <= 1;
255-
shift_en_ <= 0;
256-
// addr_ <= addr-1;
257-
// state_ <= state_more;
258-
addr_ <= addr_zero_ ? 0 : addr-1;
259-
state_ <= addr_zero_ ? state_one : state_more;
254+
srlo_ = srl[addr];
255+
shift_en_o_ = 1;
256+
shift_en_ = 0;
257+
// addr_ = addr-1;
258+
// state_ = state_more;
259+
addr_ = addr_zero_ ? 0 : addr-1;
260+
state_ = addr_zero_ ? state_one : state_more;
260261
end
261262
end
262263
else begin // - (mid: neither empty nor full)
263264
if (i_v && o_b) begin // - mid & i_v & o_b => consume
264-
srlo_ <= 'bx;
265-
shift_en_o_ <= 0;
266-
shift_en_ <= 1;
267-
addr_ <= addr+1;
268-
state_ <= state_more;
265+
srlo_ = 'bx;
266+
shift_en_o_ = 0;
267+
shift_en_ = 1;
268+
addr_ = addr+1;
269+
state_ = state_more;
269270
end
270271
else if (i_v && !o_b) begin // - mid & i_v & !o_b => cons+prod
271-
srlo_ <= srl[addr];
272-
shift_en_o_ <= 1;
273-
shift_en_ <= 1;
274-
addr_ <= addr;
275-
state_ <= state_more;
272+
srlo_ = srl[addr];
273+
shift_en_o_ = 1;
274+
shift_en_ = 1;
275+
addr_ = addr;
276+
state_ = state_more;
276277
end
277278
else if (!i_v && o_b) begin // - mid & !i_v & o_b => idle
278-
srlo_ <= 'bx;
279-
shift_en_o_ <= 0;
280-
shift_en_ <= 0;
281-
addr_ <= addr;
282-
state_ <= state_more;
279+
srlo_ = 'bx;
280+
shift_en_o_ = 0;
281+
shift_en_ = 0;
282+
addr_ = addr;
283+
state_ = state_more;
283284
end
284285
else if (!i_v && !o_b) begin // - mid & !i_v & !o_b => produce
285-
srlo_ <= srl[addr];
286-
shift_en_o_ <= 1;
287-
shift_en_ <= 0;
288-
addr_ <= addr_zero_ ? 0 : addr-1;
289-
state_ <= addr_zero_ ? state_one : state_more;
286+
srlo_ = srl[addr];
287+
shift_en_o_ = 1;
288+
shift_en_ = 0;
289+
addr_ = addr_zero_ ? 0 : addr-1;
290+
state_ = addr_zero_ ? state_one : state_more;
290291
end
291292
end // else: !if(addr_full)
292293
end // case: state_more
293294

294295
default: begin
295-
srlo_ <= 'bx;
296-
shift_en_o_ <= 1'bx;
297-
shift_en_ <= 1'bx;
298-
addr_ <= 'bx;
299-
state_ <= 2'bx;
296+
srlo_ = 'bx;
297+
shift_en_o_ = 1'bx;
298+
shift_en_ = 1'bx;
299+
addr_ = 'bx;
300+
state_ = 2'bx;
300301
end // case: default
301302

302303
endcase // case(state)

0 commit comments

Comments
 (0)