Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Branch to Incorporate Changes from dev #124

Open
wants to merge 56 commits into
base: feature/anom_det
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
bffc0aa
Fix to ensure pipeline pragma and functional behavior are the same ac…
mmrahorovic Sep 26, 2022
b9001f4
Untangle max norm implementation.
preusser Oct 6, 2022
86501ee
Merge pull request #114 from Xilinx/feature/fmpadding
preusser Oct 7, 2022
419e9c0
Merge pull request #113 from mmrahorovic/fix/swu_kernel1
preusser Oct 7, 2022
d6dbc27
Add node label to Jenkinsfile
Nov 14, 2022
a77a746
Rework independent SIMD support
fpjentzsch Nov 25, 2022
2b478b2
Bump certifi from 2019.3.9 to 2022.12.7
dependabot[bot] Dec 8, 2022
b95aa02
Merge pull request #117 from Xilinx/dependabot/pip/certifi-2022.12.7
preusser Dec 14, 2022
1279be4
Merge pull request #115 from johnnoel-xlnx/master
preusser Dec 14, 2022
f28960c
Merge branch 'master' into dev
preusser Dec 14, 2022
743bb59
Consolidating into a single requirements.txt.
preusser Dec 14, 2022
5164d78
Merge pull request #118 from Xilinx/feature/requirements
preusser Dec 14, 2022
5faa750
Set conv_dws testbench to use new SIMD parallelism
fpjentzsch Jan 4, 2023
04e44f0
Merge branch 'dev' into vvau_simd
fpjentzsch Jan 4, 2023
8968711
[VVAU] SIMD support for streamed weights
fpjentzsch Jan 18, 2023
3cdbe83
Bump future from 0.17.1 to 0.18.3 in /docs
dependabot[bot] Feb 2, 2023
9710c90
Merge pull request #120 from Xilinx/dependabot/pip/docs/future-0.18.3
preusser Feb 2, 2023
4ddfa00
Merge pull request #121 from Xilinx/dev
preusser Feb 10, 2023
5c0cd6d
Merge pull request #119 from fpjentzsch/vvau_simd
preusser Feb 24, 2023
eb4a004
Use constexpr for compile-time parameters.
preusser Feb 24, 2023
c17aa47
Merge branch 'feature/vvau_simd' into dev
preusser Feb 24, 2023
1fe77e4
Adding FMPadding_Pixel_Nonsquare to streamtools
i-colbert Mar 17, 2023
574e568
Create fmpp_config.h
i-colbert Mar 17, 2023
e2413b9
Create fm_pixel_padding_tb.cpp
i-colbert Mar 17, 2023
44724fe
Create fm_pixel_padding_top.cpp
i-colbert Mar 17, 2023
3464a1b
Create test_fm_pixel_padding.tcl
i-colbert Mar 17, 2023
8e986ea
Update fm_pixel_padding_tb.cpp
i-colbert Apr 2, 2023
843aeb5
Updating fm pixel padding top-level function
i-colbert Apr 2, 2023
bc897f1
Adding deconv2d weight generator
i-colbert Apr 2, 2023
683fcc4
Create deconv.hpp
i-colbert Apr 2, 2023
5106b46
Adding top and testbench
i-colbert Apr 2, 2023
22e52ee
Update gen_weights_deconv2d.py
i-colbert Apr 3, 2023
6c5e296
Loading deconv weights from memdata with transposition
i-colbert Apr 3, 2023
d81f950
Adding feature map padding hyperparams
i-colbert Apr 3, 2023
661fcd0
Adding fmpadding and convlayer batch
i-colbert Apr 3, 2023
8364738
Adding checks for functional verification
i-colbert Apr 3, 2023
1a5be9d
Adding generated config/memdata
i-colbert Apr 3, 2023
d9ffa3b
Adding square version of fm pixel padding
i-colbert Apr 7, 2023
61ab264
Updating gen_weights for deconv2d
i-colbert Apr 7, 2023
5a979a2
Updating deconv2d testbench
i-colbert Apr 7, 2023
e96d7b1
Focusing on single-channel test cases
i-colbert Apr 7, 2023
c1f5130
Fixing indexing errors
i-colbert Apr 7, 2023
b666bf8
Fixing typo
i-colbert Apr 7, 2023
a68da3f
Minor changes
i-colbert Apr 7, 2023
f3ee9a2
Create test_deconv2d.tcl
i-colbert Apr 7, 2023
ac3d9e1
Relaxing timing target
i-colbert Apr 7, 2023
22ab78f
Updating paths in files
i-colbert Apr 7, 2023
9377c62
Adding new tcl scripts to Jenkinsfile
i-colbert Apr 14, 2023
401b357
Adopt a deterministic PRNG to make cosim use identical reference.
preusser Apr 14, 2023
a9d5e08
Adding ifdef guards to tb/deconv.hpp
i-colbert Apr 14, 2023
ac8d693
Adding if/def guards to tb/data/config_deconv2d.h
i-colbert Apr 14, 2023
c18872c
Adding if/def guards for fmpp config
i-colbert Apr 14, 2023
1e4564c
Removing ConvPadding from generate weights scripts
i-colbert Apr 14, 2023
6479551
Removing redundant ConvPadding from testbench
i-colbert Apr 14, 2023
32e01c8
Merge pull request #122 from i-colbert/feature/fm_pixel_pad
preusser Apr 17, 2023
1e3ec91
Merge branch 'dev' into feature/anom_det_update
preusser Apr 21, 2023
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
9 changes: 8 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
******************************************************************************/

node {
node('finn-build || built-in') {
def app
stage('Clone repository') {
/* Let's make sure we have the repository cloned to our workspace */
Expand Down Expand Up @@ -142,6 +142,13 @@ node {
stage('TMR CHECK') {
sh("source ${env.HLS_ENV_SRC}; cd tb; vitis_hls -f test_tmrc_stmr.tcl")
}
}, thirteenthBranch: {
stage('FM_PIX_PAD') {
sh("source ${env.HLS_ENV_SRC}; cd tb; vitis_hls -f test_fm_pixel_padding.tcl")
}
stage('DECONV_2D') {
sh("source ${env.HLS_ENV_SRC}; cd tb; vitis_hls -f test_deconv2d.tcl")
}
}
}
}
33 changes: 31 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
# Copyright (c) 2019, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

alabaster==0.7.12
Babel==2.9.1
breathe==4.13.0.post0
certifi==2019.3.9
certifi==2022.12.7
chardet==3.0.4
commonmark==0.9.0
docutils==0.14
future==0.17.1
future==0.18.3
idna==2.8
imagesize==1.1.0
Jinja2==2.11.3
Expand Down
59 changes: 0 additions & 59 deletions requirements.txt

This file was deleted.

6 changes: 4 additions & 2 deletions slidingwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -1186,17 +1186,19 @@ void ConvolutionInputGenerator_2D_kernel1(
static_assert(IFMChannels % SIMD == 0, "");
constexpr unsigned COUNTER_WIDTH = clog2(Stride-1) + 1;
constexpr unsigned COUNTER_RESET = Stride - 2;
constexpr unsigned MULTIPLYING_FACTOR = IFMChannels/SIMD;
for (unsigned int im=0; im<numReps; im++) {
#pragma HLS performance target_ti=IFMDim*IFMDim*IFMChannels/SIMD
ap_int<COUNTER_WIDTH> counter_y = -1;
for (unsigned int y = 0; y < IFMDim; y++) {
const bool keep_y = counter_y < 0;
counter_y = keep_y ? ap_int<COUNTER_WIDTH>(COUNTER_RESET) : ap_int<COUNTER_WIDTH>(counter_y - 1);
ap_int<COUNTER_WIDTH> counter_x = -1;
for (unsigned int x = 0; x < IFMDim; x++) {
#pragma HLS pipeline style=flp II=IFMChannels/SIMD
const bool keep_x = counter_x < 0;
counter_x = keep_x ? ap_int<COUNTER_WIDTH>(COUNTER_RESET) : ap_int<COUNTER_WIDTH>(counter_x - 1);
for (unsigned int count_simd = 0; count_simd < IFMChannels/SIMD; count_simd++) {
#pragma HLS pipeline style=flp II=1
for (unsigned int count_simd = 0; count_simd < MULTIPLYING_FACTOR; count_simd++) {
ap_uint<SIMD*Input_precision> inElem = in.read();
if (keep_y && keep_x) {
out.write(inElem);
Expand Down
76 changes: 76 additions & 0 deletions streamtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,82 @@ void FMPadding_Batch(
}
}

/**
* \brief Feature map pixel padding - Pads each pixel in the input feature
* map with zeros. Used as a pre-processing step for the transposed
* convolution operation. Expects data in NHWC format, where N=1.
*
* \tparam OutputDim_x Padded width of the output feature map
* \tparam OutputDim_y Padded height of the output feature map
* \tparam Stride_x Stride for each pixel along the width dimension
* \tparam Stride_y Stride for each pixel along the height dimension
* \tparam NumChannels Number of channels of the input feature map
* \tparam SIMD Input parallelism
* \tparam In_t Input datatype
*
* @param src Input stream
* @param dst Output stream
*/
template<
unsigned OutputDim_x,
unsigned OutputDim_y,
unsigned Stride_x,
unsigned Stride_y,
unsigned NumChannels,
unsigned SIMD,
typename In_t
>
void FMPadding_Pixel_Nonsquare(
hls::stream<ap_uint<SIMD*In_t::width>> &src,
hls::stream<ap_uint<SIMD*In_t::width>> &dst
) {
static_assert(NumChannels % SIMD == 0, "SIMD must divide channel count.");
constexpr unsigned Folding = NumChannels/SIMD;

int unsigned ytrig = 0;
for(int unsigned y = 0; y < OutputDim_y; y++) {
int unsigned xtrig = 0;
for(int unsigned x = 0; x < OutputDim_x; x++) {
for(int unsigned sf = 0; sf < Folding; sf++) {
#pragma HLS pipeline II=1 style=flp
ap_uint<SIMD*In_t::width> value = 0;
if((ytrig == 0) && (xtrig == 0)) value = src.read();
dst.write(value);
}
if(++xtrig == Stride_x) xtrig = 0;
}
if(++ytrig == Stride_y) ytrig = 0;
}
}

/**
* \brief Feature map pixel padding - Pads each pixel in the input feature
* map with zeros. Used as a pre-processing step for the transposed
* convolution operation. Expects data in NHWC format, where N=1.
*
* \tparam OutputDim Padded width of the output feature map
* \tparam Stride Stride for each pixel along the width dimension
* \tparam NumChannels Number of channels of the input feature map
* \tparam SIMD Input parallelism
* \tparam In_t Input datatype
*
* @param src Input stream
* @param dst Output stream
*/
template<
unsigned OutputDim,
unsigned Stride,
unsigned NumChannels,
unsigned SIMD,
typename In_t
>
void FMPadding_Pixel(
hls::stream<ap_uint<SIMD*In_t::width>> &src,
hls::stream<ap_uint<SIMD*In_t::width>> &dst
) {
FMPadding_Pixel_Nonsquare<OutputDim, OutputDim, Stride, Stride, NumChannels, SIMD, In_t>(src, dst);
}

/**
* \brief Stream Data Width Converter - Converts the width of the input stream in the output stream
*
Expand Down
2 changes: 1 addition & 1 deletion tb/conv_dws_tb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int main()
for (unsigned int oy = 0; oy < TY; oy++) {
for (unsigned int ox = 0; ox <TX; ox++) {
for(int pe=0;pe <PE1;pe++){
ap_int<4> quantized_weight = (ap_int<4>) PARAM::weights.weights(kx*KERNEL_DIM + ky)[out_chan_count][0];
ap_int<4> quantized_weight = (ap_int<4>) PARAM::weights.weights(0)[out_chan_count][TX-1 - (kx*KERNEL_DIM + ky)];
W1[out_chan_count][kx][ky] = quantized_weight;
kx++;
if (kx==KERNEL_DIM){
Expand Down
4 changes: 3 additions & 1 deletion tb/conv_dws_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ void Testbench_conv_dws(stream<ap_uint<FM_Channels1*INPUT_PRECISION> > & in, str
hls::stream<ap_uint<FM_Channels1*ap_uint<INPUT_PRECISION>::width> > resized_stream("resized_stream");
hls::stream<ap_uint<PE1*ap_uint<INPUT_PRECISION>::width> > resized_stream_pe("resized_stream_pe");
hls::stream<ap_uint<PE1*ap_uint<INPUT_PRECISION>::width> > swg_out("swg_out");
hls::stream<ap_uint<PE1*SIMD1*ap_uint<INPUT_PRECISION>::width> > resized_stream_simd("resized_stream_simd");
SameResize_Batch<IFMDim1, KERNEL_DIM, STRIDE, FM_Channels1, ap_uint<INPUT_PRECISION> >(in, resized_stream, numReps);
StreamingDataWidthConverter_Batch<FM_Channels1*INPUT_PRECISION, PE1*INPUT_PRECISION, (IFMDim1+2)*(IFMDim1+2)>(resized_stream, resized_stream_pe, numReps);
ConvolutionInputGenerator_dws<KERNEL_DIM, FM_Channels1, ap_uint<INPUT_PRECISION>::width, IFMDim1+2, OFMDim1, PE1,1>(resized_stream_pe, swg_out, numReps, ap_resource_dflt());
Vector_Vector_Activate_Batch<FM_Channels1, KERNEL_DIM*KERNEL_DIM, SIMD1, PE1, MMV1, Slice<ap_uint<INPUT_PRECISION> >, Slice<ap_int<16> >, Identity>(swg_out, out, PARAM::weights, PassThroughActivation<ap_int<16>>(), numReps*OFMDim1*OFMDim1, ap_resource_dsp());
StreamingDataWidthConverter_Batch<PE1*INPUT_PRECISION, PE1*SIMD1*INPUT_PRECISION, SIMD1*OFMDim1*OFMDim1>(swg_out, resized_stream_simd, numReps);
Vector_Vector_Activate_Batch<FM_Channels1, KERNEL_DIM*KERNEL_DIM, SIMD1, PE1, MMV1, Slice<ap_uint<INPUT_PRECISION> >, Slice<ap_int<16> >, Identity>(resized_stream_simd, out, PARAM::weights, PassThroughActivation<ap_int<16>>(), numReps*OFMDim1*OFMDim1, ap_resource_dsp());

}
2 changes: 1 addition & 1 deletion tb/data/config-conv-dws.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define KERNEL_DIM 3
#define SIMD1 1
#define SIMD1 9
#define PE1 8
#define MMV1 1
#define WIDTH 4
Expand Down
61 changes: 61 additions & 0 deletions tb/data/config_deconv2d.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/******************************************************************************
* Copyright (c) 2023, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/

#ifndef DECONV_CONF_H
#define DECONV_CONF_H

constexpr unsigned IFDim1 = 4;
constexpr unsigned IFMCh1 = 1;
constexpr unsigned OFDim1 = 7;
constexpr unsigned OFMCh1 = 1;
constexpr unsigned Kernel1 = 4;
constexpr unsigned Stride1 = 3;
constexpr unsigned Padding1 = 3;

constexpr unsigned FMPadODim1 = 10;
constexpr unsigned FMPadStride1 = 3;
constexpr unsigned FMPadSIMD1 = 1;

constexpr unsigned ConvKernel1 = 4;
constexpr unsigned ConvIFMCh1 = 1;
constexpr unsigned ConvIFMDim1 = 10;
constexpr unsigned ConvOFMCh1 = 1;
constexpr unsigned ConvOFMDim1 = 7;
constexpr unsigned ConvStride1 = 1;
constexpr unsigned ConvSIMD1 = 1;
constexpr unsigned ConvPE1 = 1;

constexpr unsigned IPrecision = 6;
constexpr unsigned OPrecision = 16;
constexpr unsigned WPrecision = 5;

#endif
46 changes: 46 additions & 0 deletions tb/data/config_fmpp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/******************************************************************************
* Copyright (c) 2023, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#ifndef FMPP_CONFIG_H
#define FMPP_CONFIG_H

constexpr unsigned SIMD1 = 1;
constexpr unsigned INPUT_WIDTH = 8;
constexpr unsigned INPUT_DIM_X = 30;
constexpr unsigned INPUT_DIM_Y = 40;
constexpr unsigned CHANNELS = 3;
constexpr unsigned XSTRIDE = 5;
constexpr unsigned YSTRIDE = 3;

constexpr unsigned OUTPUT_DIM_X = INPUT_DIM_X + (INPUT_DIM_X - 1) * (XSTRIDE - 1);
constexpr unsigned OUTPUT_DIM_Y = INPUT_DIM_Y + (INPUT_DIM_Y - 1) * (YSTRIDE - 1);

#endif
Loading