-
Notifications
You must be signed in to change notification settings - Fork 196
modules/zstd: Add support for decoding compressed blocks #1857
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
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
47ab08c
to
50f6140
Compare
50f6140
to
36bc838
Compare
Can we rebase and consolidate with #1654 ? |
36bc838
to
16cd455
Compare
@@ -0,0 +1,170 @@ | |||
# Copyright 2024 The XLS Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can. you add a docstring about what the module is doing and where it is being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the docstring
xls/modules/zstd/external/BUILD
Outdated
@@ -0,0 +1,33 @@ | |||
# Copyright 2024 The XLS Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can. you add a docstring about what those external are and why they are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the docstring and a License file for the third party sources
xls/modules/rle/rle_common.x
Outdated
@@ -24,6 +26,15 @@ pub struct PlainData<SYMB_WIDTH: u32> { | |||
last: bool, // flush RLE | |||
} | |||
|
|||
// Structure contains multiple uncompressed symbols. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that used by zstd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like it is not used in this version of the ZSTD Decoder. Let's just remove it for now.
xls/modules/zstd/zstd_dec_wrapper.v
Outdated
@@ -0,0 +1,753 @@ | |||
// Copyright 2024 The XLS Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can. you add a docstring about what the module is and why it is needed? (if it's for driving the cocostb test maybe move it there or in a separate rtl folder?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate rtl
directory and added short description
@@ -0,0 +1,193 @@ | |||
// Copyright 2024 The XLS Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move the verilog file in a separate rtl directory w/ a README (or docstring describing the modules)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate rtl
directory and added short description
can you also rebase? |
16cd455
to
cae18b3
Compare
cocotb==1.9.0 | ||
cocotbext-axi==0.1.24 | ||
cocotb_bus==0.2.1 | ||
zstandard==0.23.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: does this need to be in sync w/ the C++ dep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we dropped the C++ tests for the ZSTD Decoder I believe those don't have to be in sync
cae18b3
to
70cbb9d
Compare
Addressed the review comments, apart from that:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing license?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - there's a license header now.
@@ -0,0 +1,418 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has to go in third_party, since it is not authored by a contributor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been moved to third_party/verilog_axi
.
@@ -0,0 +1,391 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has to go in third_party, since it is not authored by a contributor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been moved to third_party/verilog_axi
.
@@ -0,0 +1,21 @@ | |||
pub struct DataArray<BITS_PER_WORD: u32, LENGTH: u32>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing license?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - there's a license header now.
@@ -0,0 +1,21 @@ | |||
pub struct DataArray<BITS_PER_WORD: u32, LENGTH: u32>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing license?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - there's a license header now.
Signed-off-by: Pawel Czarnecki <[email protected]>
Signed-off-by: Pawel Czarnecki <[email protected]>
* Use materialize_internal_fifos when possible * Disable the above option for procs with loopback channels * Add missing module names * Add xls_fifo_wrapper verilog dependency to the synthesis of the procs without materialized internal fifos Signed-off-by: Pawel Czarnecki <[email protected]>
No longer applicable - there are no CC tests in ZSTD module Signed-off-by: Pawel Czarnecki <[email protected]>
Signed-off-by: Wojciech Sipak <[email protected]>
Signed-off-by: Robert Winkler <[email protected]>
Co-authored-by: Szymon Gizler <[email protected]>
1f89c87
to
412eb98
Compare
Signed-off-by: Wojciech Sipak <[email protected]>
de1ee9a
to
d77223d
Compare
d77223d
to
b327068
Compare
@@ -0,0 +1,226 @@ | |||
// Copyright 2024 The XLS Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure to wrap line to 100 characters in that file.
cb9d65d
to
35a215a
Compare
xls/modules/zstd/README.md
Outdated
which did not have the `last` flag set | ||
* DecoderMux | ||
* At the beginning of the simulation or after receiving | ||
`ExtendedBlockDataPacket` with `last` and `last_block` (decoding new ZSTD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
justify to 80 columns?
Signed-off-by: Wojciech Sipak <[email protected]>
35a215a
to
6836389
Compare
@@ -13,6 +13,11 @@ pyyaml==6.0.1 | |||
# We build most of z3 ourselves but building python is really complicated. Just | |||
# use pypi version | |||
z3-solver==4.14.0.0 | |||
pytest==8.2.2 | |||
cocotb==1.9.0 | |||
cocotbext-axi==0.1.24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is available in our internal repository, so it would be better to untie this dependency for now and remove the associated script from the PR and import them separately.
@@ -13,6 +13,11 @@ pyyaml==6.0.1 | |||
# We build most of z3 ourselves but building python is really complicated. Just | |||
# use pypi version | |||
z3-solver==4.14.0.0 | |||
pytest==8.2.2 | |||
cocotb==1.9.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, internally we are on v1.7.1
, so if there is anything that's specific to 1.9.0, will need to upgrade the internal copy of cocotb first; as I commented elsewhere it might be better to untie this and the associated python tests from this PR and import this separately.
pytest==8.2.2 | ||
cocotb==1.9.0 | ||
cocotbext-axi==0.1.24 | ||
cocotb_bus==0.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this is not available yet internally and will need to be imported separately.
cocotb==1.9.0 | ||
cocotbext-axi==0.1.24 | ||
cocotb_bus==0.2.1 | ||
zstandard==0.23.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, internally this is on 0.19.0
@@ -13,6 +13,11 @@ pyyaml==6.0.1 | |||
# We build most of z3 ourselves but building python is really complicated. Just | |||
# use pypi version | |||
z3-solver==4.14.0.0 | |||
pytest==8.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally this is on 8.0.2
@@ -17,11 +17,11 @@ | |||
load("@rules_hdl//place_and_route:build_defs.bzl", "place_and_route") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider adding https://google.github.io/xls/bazel_rules_macros/#xls_dslx_fmt_test to enforce DSLX formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also want to consider running https://google.github.io/xls/bazel_rules_macros/#xls_dslx_fmt_test to enforce DSLX formatting as part of the CI.
super seeded by #2230 |
This PR extends the
ZstdDecoder
with support for decoding compressed blocks.It supersedes PRs:
The decoder is capable of decoding RAW and RLE literals as well as sequences with predefined FSE tables.
A suite of DSLX tests comprising unit tests of all underlying procs and an integration test was prepared.
The integration test, similarly as in #1654, first generates a random valid ZSTD frame with compressed blocks and expected decoded output. Test data is then converted to a DSLX file (example) that is imported by the integration tests file.
At the beginning of the test, the default FSE decoding tables are filled with default distributions taken from RFC 8878 section 3.1.1.3.2.2. Default Distributions . Next, the encoded frame is loaded to the system memory and the decoder is configured through a set of CSRs to start the decoding process. The decoder starts the operation and writes the decoded frame back into the output buffer in the system memory. Once it finishes, it sends a pulse on the
notify
channel signaling the end of the decoding. The output of the decoder is compared against the decoding result from the reference library.The PR introduces among others:
CompressedBlockDecoder
- manages bothSequenceDecoder
andLiteralsDecoder
to enable compress block decoding. Integrated with the top-levelZstdDecoder
SequenceDecoder
- responsible for decoding sequence sections of the compressed blocksFseDecoder
- introduced as the core part of theSequenceDecoder
RefillingShiftBuffer
- used for storing and outputting in forward and backward fashion an arbitrary amount of bits required by the FSE decoderLiteralsDecoder
- capable of decoding RAW, RLE and Huffman-coded literalsHuffmanDecoder
- used in decoding huffman-coded literals. Decoded Huffman trees are then used to decode one or four Huffman-coded streams.CommandConstructor
- this proc is responsible for sending packets with decoded sequences and literals to theSequenceExecutor
procRamMux
andRamDemux
- procs used for handling requests/responses to multiple memory models. The procs interface with 3 separate memory buffers for FSE decoding tables.