Skip to content

Commit 4bd1005

Browse files
SDA USRsdausr
authored andcommitted
Squashed 'data_compression' changes from 662a84b..013f3d7 (#494)
013f3d7 Deleting old decompression kernels f98128b adding gzip multicore decompress design 94e8c13 latestUpdate description.json for vivado impl c656ec7 Adding pass-phrase bb65325 Adding pass-phrase b51f610 create master branch from next branch 9d1709a Failed GUI cases fix 8d4b7ab Jenkins fix 4b0591a return value in host code 921bdb1 failing GUI cases fix 7fd33e4 missed case a4756e4 missed case Co-authored-by: sdausr <sdausr@xilinx.com>
1 parent d712c02 commit 4bd1005

38 files changed

+1170
-882
lines changed

data_compression/Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@Library('pipeline-library')_
22

3-
VitisLibPipeline (branch: 'next', libname: 'xf_compression', run_sw_in_pr: 'true',
3+
VitisLibPipeline (branch: 'master', libname: 'xf_compression', run_sw_in_pr: 'true',
44
TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu',
5-
upstream_dependencies: 'xf_security,next,../security', email: 'heeran@xilinx.com', devtest: 'RunDeploy.sh', TOOLVERSION: '2021.2_stable_latest')
5+
upstream_dependencies: 'xf_security,master,../security', email: 'heeran@xilinx.com', devtest: 'RunDeploy.sh', TOOLVERSION: '2021.2_released')

data_compression/L1/include/hw/inflate.hpp

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,76 @@ void kStreamReadZlibDecomp(hls::stream<ap_axiu<STREAM_WIDTH, 0, 0, 0> >& in,
423423
outEos << 1; // Terminate condition
424424
}
425425

426+
template <int NUM_CORE>
427+
void axi2HlsDistributor(hls::stream<ap_axiu<64, 0, 0, 0> >& in, hls::stream<ap_uint<72> > out[NUM_CORE]) {
428+
for (auto i = 0; i < NUM_CORE; i++) {
429+
bool last = false;
430+
ap_axiu<64, 0, 0, 0> tmp;
431+
ap_uint<8> kp = 0;
432+
ap_uint<8> cntr = 0;
433+
ap_uint<72> tmpVal = 0;
434+
while (last == false) {
435+
#pragma HLS PIPELINE II = 1
436+
tmp = in.read();
437+
tmpVal.range(71, 8) = tmp.data;
438+
kp = tmp.keep;
439+
tmpVal.range(7, 0) = tmp.keep;
440+
if (kp == 0xFF)
441+
tmpVal.range(7, 0) = 8;
442+
else
443+
break;
444+
out[i] << tmpVal;
445+
last = tmp.last;
446+
}
447+
if (kp != 0xFF) {
448+
while (kp) {
449+
cntr += (kp & 0x1);
450+
kp >>= 1;
451+
}
452+
tmpVal.range(7, 0) = cntr;
453+
out[i] << tmpVal;
454+
}
455+
out[i] << 0; // Terminate condition
456+
}
457+
}
458+
459+
template <int STREAM_WIDTH, int NUM_CORE>
460+
void hls2AxiMerger(hls::stream<ap_axiu<64, 0, 0, 0> >& outKStream, hls::stream<ap_uint<72> > outDataStream[NUM_CORE]) {
461+
for (auto i = 0; i < NUM_CORE; i++) {
462+
ap_uint<8> strb = 0;
463+
ap_uint<64> data;
464+
ap_uint<72> tmp;
465+
ap_axiu<64, 0, 0, 0> t1;
466+
467+
tmp = outDataStream[i].read();
468+
469+
strb = tmp.range(7, 0);
470+
t1.data = tmp.range(71, 8);
471+
t1.strb = strb;
472+
t1.keep = strb;
473+
t1.last = 0;
474+
if (strb == 0) {
475+
t1.last = 1;
476+
outKStream << t1;
477+
}
478+
while (strb != 0) {
479+
#pragma HLS PIPELINE II = 1
480+
tmp = outDataStream[i].read();
481+
482+
strb = tmp.range(7, 0);
483+
if (strb == 0) {
484+
t1.last = 1;
485+
}
486+
outKStream << t1;
487+
488+
t1.data = tmp.range(71, 8);
489+
t1.strb = strb;
490+
t1.keep = strb;
491+
t1.last = 0;
492+
}
493+
}
494+
}
495+
426496
template <int STREAM_WIDTH>
427497
void kStreamWriteZlibDecomp(hls::stream<ap_axiu<STREAM_WIDTH, 0, 0, 0> >& outKStream,
428498
hls::stream<ap_uint<STREAM_WIDTH + (STREAM_WIDTH / 8)> >& outDataStream) {
@@ -701,6 +771,42 @@ void inflateWithChkSum(hls::stream<ap_uint<16> >& inStream,
701771

702772
} // namespace details
703773

774+
template <int NUM_CORE,
775+
int DECODER,
776+
int PARALLEL_BYTES,
777+
int FILE_FORMAT,
778+
bool LOW_LATENCY = false,
779+
int HISTORY_SIZE = (32 * 1024)>
780+
void inflateMultiCores(hls::stream<ap_axiu<64, 0, 0, 0> >& inaxistream,
781+
hls::stream<ap_axiu<64, 0, 0, 0> >& outaxistream) {
782+
constexpr int c_parallelBit = PARALLEL_BYTES * 8;
783+
784+
hls::stream<ap_uint<72> > axi2HlsStrm[NUM_CORE];
785+
hls::stream<ap_uint<72> > inflateOut[NUM_CORE];
786+
hls::stream<ap_uint<16> > hlsDownStrm[NUM_CORE];
787+
hls::stream<bool> hlsEos[NUM_CORE];
788+
789+
#pragma HLS STREAM variable = axi2HlsStrm depth = 4096
790+
#pragma HLS STREAM variable = inflateOut depth = 4096
791+
#pragma HLS STREAM variable = hlsDownStrm depth = 32
792+
#pragma HLS STREAM variable = hlsEos depth = 32
793+
794+
#pragma HLS BIND_STORAGE variable = axi2HlsStrm type = FIFO impl = URAM
795+
#pragma HLS BIND_STORAGE variable = inflateOut type = fifo impl = URAM
796+
797+
#pragma HLS dataflow disable_start_propagation
798+
details::axi2HlsDistributor<NUM_CORE>(inaxistream, axi2HlsStrm);
799+
800+
for (auto i = 0; i < NUM_CORE; i++) {
801+
#pragma HLS UNROLL
802+
details::bufferDownsizer<NUM_CORE, PARALLEL_BYTES>(axi2HlsStrm[i], hlsDownStrm[i], hlsEos[i]);
803+
details::inflateMultiByteCore<DECODER, PARALLEL_BYTES, FILE_FORMAT, LOW_LATENCY, HISTORY_SIZE>(
804+
hlsDownStrm[i], hlsEos[i], inflateOut[i]);
805+
}
806+
807+
details::hls2AxiMerger<c_parallelBit, NUM_CORE>(outaxistream, inflateOut);
808+
}
809+
704810
template <int DECODER, int PARALLEL_BYTES, int FILE_FORMAT, bool LOW_LATENCY = false, int HISTORY_SIZE = (32 * 1024)>
705811
void inflateMultiByte(hls::stream<ap_axiu<16, 0, 0, 0> >& inaxistream,
706812
hls::stream<ap_axiu<PARALLEL_BYTES * 8, 0, 0, 0> >& outaxistream) {
@@ -714,7 +820,6 @@ void inflateMultiByte(hls::stream<ap_axiu<16, 0, 0, 0> >& inaxistream,
714820
#pragma HLS STREAM variable = axi2HlsStrm depth = 32
715821
#pragma HLS STREAM variable = axi2HlsEos depth = 32
716822
#pragma HLS STREAM variable = inflateOut depth = 32
717-
//#pragma HLS STREAM variable = inflateOut depth = 4096
718823

719824
#pragma HLS BIND_STORAGE variable = axi2HlsStrm type = FIFO impl = SRL
720825
#pragma HLS BIND_STORAGE variable = axi2HlsEos type = FIFO impl = SRL

data_compression/L1/include/hw/stream_downsizer.hpp

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,43 @@ void bufferDownsizer(hls::stream<ap_uint<IN_DATAWIDTH> >& inStream,
9999
outStream << outVal;
100100
}
101101

102+
template <int NUM_CORE, int SWIDTH>
103+
void bufferDownsizer(hls::stream<ap_uint<72> >& inStream,
104+
hls::stream<ap_uint<16> >& outStream,
105+
hls::stream<bool>& outEos) {
106+
constexpr int16_t c_factor = 4; // = 64 / 16
107+
constexpr int16_t c_outWord = 2; // = 16 / 2
108+
ap_uint<16> outVal;
109+
110+
ap_uint<SWIDTH> dsize = 0;
111+
ap_uint<SWIDTH> cntr = 0;
112+
auto inVal = inStream.read();
113+
// proceed further if valid size
114+
ap_uint<SWIDTH> inSize = inVal.range(7, 0);
115+
// if (inSize == 0) break;
116+
auto outSizeV = ((inSize - 1) / c_outWord) + 1;
117+
downsizer_assign:
118+
while (inSize > 0) {
119+
#pragma HLS PIPELINE II = 1
120+
outVal = inVal.range(23, 8);
121+
inVal >>= 16;
122+
outStream << outVal;
123+
124+
outEos << 0;
125+
dsize++;
126+
if (dsize == outSizeV) {
127+
inVal = inStream.read();
128+
inSize = inVal.range(7, 0);
129+
130+
dsize = 0;
131+
outSizeV = ((inSize - 1) / c_outWord) + 1;
132+
}
133+
}
134+
// Block end Condition
135+
outEos << 1;
136+
outStream << 0;
137+
}
138+
102139
template <int IN_DATAWIDTH, int OUT_DATAWIDTH, int SIZE_DWIDTH = 4>
103140
void bufferDownsizer(hls::stream<ap_uint<IN_DATAWIDTH + SIZE_DWIDTH> >& inStream,
104141
hls::stream<IntVectorStream_dt<OUT_DATAWIDTH, 1> >& outStream) {
@@ -380,8 +417,6 @@ void streamDownSizerP2PComp(hls::stream<ap_uint<IN_WIDTH> >& inStream,
380417
// Send ouputSize of the module
381418
outStreamSize << size;
382419

383-
// printf("[ %s ] sizeOutputV %d input_size %d size_4m_mm2s %d \n", __FUNCTION__, sizeOutputV, input_size, size);
384-
385420
conv512toV:
386421
for (int i = 0; i < sizeOutputV; i++) {
387422
#pragma HLS PIPELINE II = 1

data_compression/L1/tests/gzipc_16KB/description.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"hls_vivado_syn": 16384,
5353
"hls_csim": 10240,
5454
"hls_cosim": 16384,
55-
"hls_vivado_impl": 16384,
55+
"hls_vivado_impl": 32768,
5656
"hls_csynth": 10240
5757
},
5858
"max_time_min": 300

data_compression/L2/demos/gzip/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ endif
109109
ifneq (,$(shell echo $(XPLATFORM) | awk '/vck190/'))
110110
HOST_SRCS += $(CUR_DIR)/src/host.cpp $(XFLIB_DIR)/common/libs/compress/gzipOCLHost.cpp $(XFLIB_DIR)/common/libs/compress/gzipBase.cpp $(XFLIB_DIR)/common/libs/compress/gzipApp.cpp $(XFLIB_DIR)/common/libs/compress/compressApp.cpp $(XFLIB_DIR)/common/libs/xcl2/xcl2.cpp $(XFLIB_DIR)/common/libs/cmdparser/cmdlineparser.cpp $(XFLIB_DIR)/common/libs/logger/logger.cpp $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7/crc32.c $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7/adler32.c
111111
CXXFLAGS += -D GZIP_MULTICORE_COMPRESS -D PARALLEL_BLOCK=1 -D GZIP_MODE=1
112-
CXXFLAGS += -I $(SYSROOT)/usr/include -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7 -I $(XFLIB_DIR)/common/libs/compress/ -I $(XFLIB_DIR)/common/libs/xcl2 -I $(XFLIB_DIR)/common/libs/cmdparser -I $(XFLIB_DIR)/common/libs/logger
112+
CXXFLAGS += -I $(SYSROOT)/usr/include -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7 -I $(XFLIB_DIR)/common/libs/compress/ -I $(XFLIB_DIR)/L2/tests/src -I $(XFLIB_DIR)/common/libs/xcl2 -I $(XFLIB_DIR)/common/libs/cmdparser -I $(XFLIB_DIR)/common/libs/logger
113113
CXXFLAGS += --sysroot=$(SYSROOT)
114114
LDFLAGS += -L $(SYSROOT)/usr/lib -L ${SYSROOT}/opt/xilinx/xrt/lib
115115

116116
else
117117
HOST_SRCS += $(CUR_DIR)/src/host.cpp $(XFLIB_DIR)/common/libs/compress/gzipOCLHost.cpp $(XFLIB_DIR)/common/libs/compress/gzipBase.cpp $(XFLIB_DIR)/common/libs/compress/gzipApp.cpp $(XFLIB_DIR)/common/libs/compress/compressApp.cpp $(XFLIB_DIR)/common/libs/xcl2/xcl2.cpp $(XFLIB_DIR)/common/libs/cmdparser/cmdlineparser.cpp $(XFLIB_DIR)/common/libs/logger/logger.cpp $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7/crc32.c $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7/adler32.c
118118
CXXFLAGS += -D GZIP_MULTICORE_COMPRESS -D PARALLEL_BLOCK=1 -D GZIP_MODE=1
119-
CXXFLAGS += -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7 -I $(XFLIB_DIR)/common/libs/compress/ -I $(XFLIB_DIR)/common/libs/xcl2 -I $(XFLIB_DIR)/common/libs/cmdparser -I $(XFLIB_DIR)/common/libs/logger
119+
CXXFLAGS += -I $(XFLIB_DIR)/L1/include/hw -I $(XFLIB_DIR)/common/thirdParty/zlib-1.2.7 -I $(XFLIB_DIR)/common/libs/compress/ -I $(XFLIB_DIR)/L2/tests/src -I $(XFLIB_DIR)/common/libs/xcl2 -I $(XFLIB_DIR)/common/libs/cmdparser -I $(XFLIB_DIR)/common/libs/logger
120120

121121
endif
122122
EXE_NAME := xil_gzip

data_compression/L2/demos/gzip/description.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"includepaths": [
5151
"LIB_DIR/L1/include/hw",
5252
"LIB_DIR/common/thirdParty/zlib-1.2.7",
53-
"LIB_DIR/common/libs/compress/"
53+
"LIB_DIR/common/libs/compress/",
54+
"LIB_DIR/L2/tests/src"
5455
],
5556
"symbols": [
5657
"GZIP_MULTICORE_COMPRESS",
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* (c) Copyright 2019-2021 Xilinx, Inc. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#ifndef _XFCOMPRESSION_ZLIB_DECOMPRESS_QUAD_HPP_
19+
#define _XFCOMPRESSION_ZLIB_DECOMPRESS_QUAD_HPP_
20+
21+
#include <stdio.h>
22+
#include <stdint.h>
23+
#include <assert.h>
24+
#include <ap_int.h>
25+
#include "hls_stream.h"
26+
#include "huffman_decoder.hpp"
27+
#include "zlib_specs.hpp"
28+
#include "lz_decompress.hpp"
29+
#include "inflate.hpp"
30+
#include "stream_downsizer.hpp"
31+
#include "ap_axi_sdata.h"
32+
33+
// use dynamic decoder by default
34+
#ifndef DECODER_TYPE
35+
#define DECODER_TYPE c_fullDecoder
36+
#endif
37+
38+
// by default disable low latency model
39+
#ifndef LL_MODEL
40+
#define LL_MODEL true
41+
#endif
42+
43+
#ifndef NUM_CORE
44+
#define NUM_CORE 4
45+
#endif
46+
47+
#ifndef MULTIPLE_BYTES
48+
#define MULTIPLE_BYTES 8
49+
#endif
50+
51+
#define LZ_MAX_OFFSET_LIMIT 32768
52+
#define LOW_OFFSET 10
53+
54+
extern "C" {
55+
void xilDecompress(hls::stream<ap_axiu<64, 0, 0, 0> >& inaxistreamd, hls::stream<ap_axiu<64, 0, 0, 0> >& outaxistreamd);
56+
}
57+
#endif // _XFCOMPRESSION_ZLIB_DECOMPRESS_QUAD_HPP_

data_compression/L2/include/lz4_p2p_decompress_kernel.hpp

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)