Skip to content

Commit e65da62

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into fix/lookup
2 parents 15c6e38 + e486c03 commit e65da62

File tree

107 files changed

+2395
-957
lines changed

Some content is hidden

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

107 files changed

+2395
-957
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
@@ -126,6 +132,9 @@ RUN pip install tokenize-rt==4.2.1
126132
# pyverilator
127133
RUN pip install tclwrapper==0.0.1
128134

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

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

docker/jenkins/Jenkinsfile

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pipeline {
9393
cleanPreviousBuildFiles(env.FINN_HOST_BUILD_DIR)
9494

9595
// Pass in the marker to run with pytest and the XML test results filename
96-
runDockerPytestWithMarker("fpgadataflow", "${env.TEST_NAME}", "--cov --cov-report=html:coverage_fpgadataflow")
96+
runDockerPytestWithMarker("fpgadataflow", "${env.TEST_NAME}", "--cov --cov-report=html:coverage_fpgadataflow -n ${env.NUM_PYTEST_WORKERS} --dist worksteal")
9797

9898
// Stash the test results file(s)
9999
stash name: env.TEST_NAME, includes: "${env.TEST_NAME}.xml,${env.TEST_NAME}.html"
@@ -324,21 +324,17 @@ void runDockerPytestWithMarker(String marker, String testResultsFilename, String
324324
sh """./run-docker.sh python -m pytest -m ${marker} --junitxml=${testResultsFilename}.xml --html=${testResultsFilename}.html --self-contained-html ${additionalOptions}"""
325325
}
326326

327-
def findBoardBuildFiles(String searchDir, String dirToFind) {
328-
def result = sh(script: "find $searchDir -type d -name \"$dirToFind*\"", returnStdout: true).trim()
329-
if (result.empty) {
330-
error "Directory containing '$dirToFind' not found."
331-
}
332-
return result
333-
}
334-
335327
void findCopyZip(String board, String findDir, String copyDir) {
336-
def buildDir = findBoardBuildFiles(findDir, "hw_deployment_${board}")
337-
sh "cp -r ${buildDir}/${board} ${copyDir}/"
338-
dir(copyDir) {
339-
sh "zip -r ${board}.zip ${board}/"
340-
sh "mkdir -p ${env.ARTIFACT_DIR}/${copyDir}/"
341-
sh "cp ${board}.zip ${env.ARTIFACT_DIR}/${copyDir}/"
328+
sh "mkdir -p ${copyDir}"
329+
try {
330+
sh "cp -r ${findDir}/hw_deployment_*/${board} ${copyDir}/"
331+
dir(copyDir) {
332+
sh "zip -r ${board}.zip ${board}/"
333+
sh "mkdir -p ${env.ARTIFACT_DIR}/${copyDir}/"
334+
sh "cp ${board}.zip ${env.ARTIFACT_DIR}/${copyDir}/"
335+
}
336+
} catch (err) {
337+
error "No ${board} hw_deployment_* build artifacts found in ${findDir}"
342338
}
343339
}
344340

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="7a587b2ccc8fbd4daaec946f3bc66c273f85451b"
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: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -184,58 +184,58 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
184184
end // always @ (posedge clock or negedge reset)
185185

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

194194
state_empty: begin // - (empty, will not produce)
195195
if (i_v) begin // - empty & i_v => consume
196-
srlo_ <= i_d;
197-
shift_en_o_ <= 1;
198-
shift_en_ <= 1'bx;
199-
addr_ <= 0;
200-
state_ <= state_one;
196+
srlo_ = i_d;
197+
shift_en_o_ = 1;
198+
shift_en_ = 1'bx;
199+
addr_ = 0;
200+
state_ = state_one;
201201
end
202202
else begin // - empty & !i_v => idle
203-
srlo_ <= 'bx;
204-
shift_en_o_ <= 0;
205-
shift_en_ <= 1'bx;
206-
addr_ <= 0;
207-
state_ <= state_empty;
203+
srlo_ = 'bx;
204+
shift_en_o_ = 0;
205+
shift_en_ = 1'bx;
206+
addr_ = 0;
207+
state_ = state_empty;
208208
end
209209
end
210210

211211
state_one: begin // - (contains one)
212212
if (i_v && o_b) begin // - one & i_v & o_b => consume
213-
srlo_ <= 'bx;
214-
shift_en_o_ <= 0;
215-
shift_en_ <= 1;
216-
addr_ <= 0;
217-
state_ <= state_more;
213+
srlo_ = 'bx;
214+
shift_en_o_ = 0;
215+
shift_en_ = 1;
216+
addr_ = 0;
217+
state_ = state_more;
218218
end
219219
else if (i_v && !o_b) begin // - one & i_v & !o_b => cons+prod
220-
srlo_ <= i_d;
221-
shift_en_o_ <= 1;
222-
shift_en_ <= 1;
223-
addr_ <= 0;
224-
state_ <= state_one;
220+
srlo_ = i_d;
221+
shift_en_o_ = 1;
222+
shift_en_ = 1;
223+
addr_ = 0;
224+
state_ = state_one;
225225
end
226226
else if (!i_v && o_b) begin // - one & !i_v & o_b => idle
227-
srlo_ <= 'bx;
228-
shift_en_o_ <= 0;
229-
shift_en_ <= 1'bx;
230-
addr_ <= 0;
231-
state_ <= state_one;
227+
srlo_ = 'bx;
228+
shift_en_o_ = 0;
229+
shift_en_ = 1'bx;
230+
addr_ = 0;
231+
state_ = state_one;
232232
end
233233
else if (!i_v && !o_b) begin // - one & !i_v & !o_b => produce
234-
srlo_ <= 'bx;
235-
shift_en_o_ <= 0;
236-
shift_en_ <= 1'bx;
237-
addr_ <= 0;
238-
state_ <= state_empty;
234+
srlo_ = 'bx;
235+
shift_en_o_ = 0;
236+
shift_en_ = 1'bx;
237+
addr_ = 0;
238+
state_ = state_empty;
239239
end
240240
end // case: state_one
241241

@@ -244,60 +244,60 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
244244
// - (full, will not consume)
245245
// - (full here if depth==2)
246246
if (o_b) begin // - full & o_b => idle
247-
srlo_ <= 'bx;
248-
shift_en_o_ <= 0;
249-
shift_en_ <= 0;
250-
addr_ <= addr;
251-
state_ <= state_more;
247+
srlo_ = 'bx;
248+
shift_en_o_ = 0;
249+
shift_en_ = 0;
250+
addr_ = addr;
251+
state_ = state_more;
252252
end
253253
else begin // - full & !o_b => produce
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;
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;
261261
end
262262
end
263263
else begin // - (mid: neither empty nor full)
264264
if (i_v && o_b) begin // - mid & i_v & o_b => consume
265-
srlo_ <= 'bx;
266-
shift_en_o_ <= 0;
267-
shift_en_ <= 1;
268-
addr_ <= addr+1;
269-
state_ <= state_more;
265+
srlo_ = 'bx;
266+
shift_en_o_ = 0;
267+
shift_en_ = 1;
268+
addr_ = addr+1;
269+
state_ = state_more;
270270
end
271271
else if (i_v && !o_b) begin // - mid & i_v & !o_b => cons+prod
272-
srlo_ <= srl[addr];
273-
shift_en_o_ <= 1;
274-
shift_en_ <= 1;
275-
addr_ <= addr;
276-
state_ <= state_more;
272+
srlo_ = srl[addr];
273+
shift_en_o_ = 1;
274+
shift_en_ = 1;
275+
addr_ = addr;
276+
state_ = state_more;
277277
end
278278
else if (!i_v && o_b) begin // - mid & !i_v & o_b => idle
279-
srlo_ <= 'bx;
280-
shift_en_o_ <= 0;
281-
shift_en_ <= 0;
282-
addr_ <= addr;
283-
state_ <= state_more;
279+
srlo_ = 'bx;
280+
shift_en_o_ = 0;
281+
shift_en_ = 0;
282+
addr_ = addr;
283+
state_ = state_more;
284284
end
285285
else if (!i_v && !o_b) begin // - mid & !i_v & !o_b => produce
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;
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;
291291
end
292292
end // else: !if(addr_full)
293293
end // case: state_more
294294

295295
default: begin
296-
srlo_ <= 'bx;
297-
shift_en_o_ <= 1'bx;
298-
shift_en_ <= 1'bx;
299-
addr_ <= 'bx;
300-
state_ <= 2'bx;
296+
srlo_ = 'bx;
297+
shift_en_o_ = 1'bx;
298+
shift_en_ = 1'bx;
299+
addr_ = 'bx;
300+
state_ = 2'bx;
301301
end // case: default
302302

303303
endcase // case(state)

0 commit comments

Comments
 (0)