Skip to content

Commit 3a26ffa

Browse files
committed
Merge 5.0 release branch into amd-main
2 parents 8744f7d + 4f08a11 commit 3a26ffa

File tree

186 files changed

+72211
-11333
lines changed

Some content is hidden

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

186 files changed

+72211
-11333
lines changed

.github/psdb-jenkins-trigger.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
jenkinsURLs:
2+
- https://swjenkins.amd.com/job/automations/job/entrypoints/job/github-psdb-entrypoint/
3+
help:
4+
doc: https://confluence.amd.com/display/SI/PSDB+Jenkins+Trigger+-+GitHub+Guide
5+
enabled: false
6+
includeTriggers: false
7+
verbose: false
8+
message: This branch is configured to trigger PSDB. Comment __!help__ to get additional details
9+
triggerExclusions:
10+
all:
11+
- "psdb-jenkins-trigger-dev[bot]"
12+
- "psdb-jenkins-trigger[bot]"
13+
onEdit:
14+
- "swjenci"
15+
branches:
16+
- branchName: "amd-main"
17+
triggers:
18+
- triggerName: "!ai-review"
19+
description: Runs the AI Review job
20+
onOpen: false
21+
onSynchronize: false
22+
jobs:
23+
- "[jenkins-psdb, AI-Code-review/ai-code-review-psdb, queryFiles:summary-issues-clarity-aocl_compression]"
24+
- branchName: "amd/dev/sraut/ai-code-review-test"
25+
triggers:
26+
- triggerName: "!ai-review"
27+
description: Runs the AI Review job
28+
onOpen: true
29+
onSynchronize: true
30+
jobs:
31+
- "[jenkins-psdb, AI-Code-review/ai-code-review-psdb, queryFiles:summary-issues-clarity-aocl_compression]"

CMakeLists.txt

Lines changed: 237 additions & 165 deletions
Large diffs are not rendered by default.

LICENSE.txt

Lines changed: 232 additions & 24 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 107 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Building on Linux
5454
```
5555
The library is generated in "lib" directory. <br>
5656
The test bench executable is generated in "build". <br>
57-
The additional option `--target install` will install the library, binary, and <br>
57+
The additional option `--target install` will install the library, and <br>
5858
interface header files in the installation path as specified with <br>
5959
`-DCMAKE_INSTALL_PREFIX` option or in the local system path. <br>
6060
The option `-j` will run the compilation process using multiple cores.
@@ -69,10 +69,6 @@ Building on Linux
6969
The option `-v` will print verbose build logs on the console.
7070
4. To clear or delete the build folder or files, manually remove the build directory or its files.
7171

72-
__Note:__ When using cmake version older than 3.15, `-B` option is not supported. <br>
73-
So the build folder must be created manually. <br>
74-
The option `-v` is also not supported in cmake version older than 3.15.
75-
7672

7773
Building on Windows
7874
-------------------
@@ -92,17 +88,13 @@ Building with Visual Studio IDE (GUI)
9288
Microsoft Visual Studio project is generated.
9389
6. Click __Open Project__.
9490
Microsoft Visual Studio project for the source package __is launched__.
95-
7. For building multi-threaded library based on AOCL_ENABLE_THREADS, set the
96-
LLVM openMP library path in the Linker->General option and openMP library name
97-
in the Linker->Input under the project properties. Set /openmp as the additional
98-
compilation option.
99-
8. Build the entire solution or the required projects.
91+
7. Build the entire solution or the required projects.
10092

10193
Building with Visual Studio IDE (command line)
10294
----------------------------------------------
10395
1. Go to AOCL-Compression source package and create a folder named build.
10496
2. Go to the build folder.
105-
3. Use the following command to configure and build the library to test bench executable.
97+
3. Use the following command to configure and build the library and test bench executable.
10698
```
10799
cmake .. -T ClangCl -G <installed Visual Studio version> && cmake --build . --config Release --target INSTALL
108100
```
@@ -115,23 +107,23 @@ Use the following additional options to configure your build:
115107
Option | Description
116108
------------------------------------|----------------------------------------------------------------------------------------
117109
AOCL_LZ4_OPT_PREFETCH_BACKWARDS | Enable LZ4 optimizations related to backward prefetching of data (Disabled by default)
118-
SNAPPY_MATCH_SKIP_OPT | Enable Snappy match skipping optimization (Disabled by default)
110+
SNAPPY_MATCH_SKIP_OPT | Enable Snappy match skipping optimization (Enabled by default)
119111
LZ4_FRAME_FORMAT_SUPPORT | Enable building LZ4 with Frame format and API support (Enabled by default)
120112
AOCL_LZ4HC_DISABLE_PATTERN_ANALYSIS | Disable Pattern Analysis in LZ4HC for level 9 (Enabled by default)
121-
AOCL_ZSTD_SEARCH_SKIP_OPT_DFAST_FAST| Enable ZSTD match skipping optimization, and reduce search strength/tolerance for levels 1-4 (Disabled by default)
122-
AOCL_ZSTD_WILDCOPY_LONG | Faster wildcopy when match lengths are long in ZSTD decompression (Disabled by default)
123-
AOCL_TEST_COVERAGE | Enable GTest and AOCL test bench based CTest suite (Disabled by default)
113+
AOCL_ZSTD_SEARCH_SKIP_OPT_DFAST_FAST| Enable ZSTD match skipping optimization, and reduce search strength/tolerance for levels 1-4 (Enabled by default)
114+
AOCL_DECOMPRESS_FAST | Enable fast decompression modes that might compromise on compression speed / ratio to produce streams that decompress faster. Supported values 1, 2 for ZSTD. (Disabled by default)
115+
AOCL_TEST_COVERAGE | Enable GTest, AOCL test bench and third party test bench based CTest suite (Disabled by default)
124116
AOCL_ENABLE_LOG_FEATURE | Enables logging through environment variable `AOCL_ENABLE_LOG` (Disabled by default)
125117
CODE_COVERAGE | Enable source code coverage. Only supported on Linux with the GCC compiler (Disabled by default)
126118
ASAN | Enable Address Sanitizer checks. Only supported on Linux/Debug build (Disabled by default)
127119
VALGRIND | Enable Valgrind checks. Only supported on Linux/Debug and incompatible with ASAN=ON (Disabled by default)
128120
BUILD_DOC | Build documentation for this library (Disabled by default)
129-
ZLIB_DEFLATE_FAST_MODE | Enable ZLIB deflate quick strategy (Disabled by default)
121+
BUILD_EXAMPLE | Build examples for aocl-compression (Disabled by default)
130122
AOCL_LZ4_MATCH_SKIP_OPT_LDS_STRAT1 | Enable LZ4 match skipping optimization strategy-1 based on a larger base step size applied for long distance search (Disabled by default)
131123
AOCL_LZ4_MATCH_SKIP_OPT_LDS_STRAT2 | Enable LZ4 match skipping optimization strategy-2 by aggressively setting search distance on top of strategy-1. Preferred to be used with Silesia corpus (Disabled by default)
132124
AOCL_LZ4_NEW_PRIME_NUMBER | Enable the usage of a new prime number for LZ4 hashing function. Preferred to be used with Silesia corpus (Disabled by default)
133125
AOCL_LZ4_EXTRA_HASH_TABLE_UPDATES | Enable storing of additional potential matches to improve compression ratio. Recommended for higher compressibility use cases (Disabled by default)
134-
AOCL_LZ4_HASH_BITS_USED | Control the number of bits used for LZ4 hashing, allowed values are LOW (low perf gain and less CR regression) and HIGH (high perf gain and high CR regression) (Disabled by default)
126+
AOCL_LZ4_HASH_BITS_USED | Control the number of bits used for LZ4 hashing, allowed values are OFF, LOW (low perf gain and less CR regression) and HIGH (high perf gain and high CR regression) (LOW by default)
135127
AOCL_EXCLUDE_BZIP2 | Exclude BZIP2 compression method from the library build (Disabled by default)
136128
AOCL_EXCLUDE_LZ4 | Exclude LZ4 compression method from the library build. LZ4HC also gets excluded (Disabled by default)
137129
AOCL_EXCLUDE_LZ4HC | Exclude LZ4HC compression method from the library build (Disabled by default)
@@ -141,10 +133,23 @@ AOCL_EXCLUDE_ZLIB | Exclude ZLIB compression method from the
141133
AOCL_EXCLUDE_ZSTD | Exclude ZSTD compression method from the library build (Disabled by default)
142134
AOCL_XZ_UTILS_LZMA_API_EXPERIMENTAL | Build with xz utils lzma APIs. Experimental feature with limited API support (Disabled by default)
143135
AOCL_ENABLE_THREADS | Enable multi-threaded compression and decompression using SMP based openMP threads (Disabled by default)
136+
TEST_COVERAGE_THIRD_PARTY | Enable third party test bench based CTest suite (Disabled by default)
137+
NATIVE_ENABLE_THREADS | Enable native multi-threaded compression for supported methods (Disabled by default)
138+
AOCL_TEST_FUZZER | Enable fuzz test along with GTest. Only supported on Linux with the Clang compiler (Disabled by default)
139+
AOCL_TEST_FUZZER_WITH_CORPUS | Run fuzz tests with corpus. Only supported on Linux with the Clang compiler (Disabled by default)
140+
ENABLE_FAST_MATH | Enable fast-math optimizations (Disabled by default)
141+
142+
* NOTE: <br>
143+
1. ZLIB supports quicker compression strategy for Level 1 by trading off compression ratio. Enable it by <br>
144+
setting environment variable AOCL_ZLIB_QUICK_MODE. It also improves performance for levels 2, 3 and 5 <br>
145+
while trading off compression ratio. <br>
144146

145147
Running AOCL-Compression Test Bench On Linux
146148
--------------------------------------------
147149

150+
* CAUTION: <br>
151+
Before running the test bench, check whether it points to the right library dependency. <br>
152+
148153
Test bench supports several options to validate, benchmark or debug the supported
149154
compression methods.
150155
It uses the unified API set to invoke the compression methods supported by AOCL-Compression.
@@ -185,7 +190,7 @@ Here, 5 is the level and 0 is the additional parameter passed to ZSTD method.
185190
* `AOCL_ENABLE_LOG=INFO` for Error, Info logs.
186191
* `AOCL_ENABLE_LOG=DEBUG` for Error, Info, Debug logs.
187192
* `AOCL_ENABLE_LOG=TRACE` for Error, Info, Debug, Trace logs.<br>
188-
Note: When building the library for highest performance, do not enable `DAOCL_ENABLE_LOG_FEATURE`.
193+
Note: When building the library for highest performance, do not enable `AOCL_ENABLE_LOG_FEATURE`.
189194

190195

191196
* To run the test bench but only compression or decompression <br>
@@ -206,6 +211,18 @@ Here, 5 is the level and 0 is the additional parameter passed to ZSTD method.
206211
Method name and level must be specified using -e for default and -rcompress modes. <br>
207212
Method name must be specified using -e for -rdecompress mode. <br>
208213

214+
* To run the test bench and test native APIs, use the command: <br>
215+
`aocl_compression_bench -n -p <input filename>` <br>
216+
Other options -e, -i, -t, -r are supported when running with -n <br>
217+
218+
* To run the test bench and test multi-threaded native APIs, <br>
219+
for supported methods, use the command: <br>
220+
`aocl_compression_bench -e<method>:<level>:<num-of-workers> -n -p <input filename>` <br>
221+
222+
* To run the test bench and test native APIs with an external dictionary file <br>
223+
for supported methods, use the command: <br>
224+
`aocl_compression_bench -e<method> -n -p -y<dictionary filename> <input filename>` <br>
225+
209226
* NOTE: <br>
210227
1. Compression and decompression of large files (>1GB) are supported in the test bench. <br>
211228
2. Decompression of compressed files (> 1GB) that are not generated by aocl-compression <br>
@@ -242,13 +259,35 @@ Check the following details for the exact steps:
242259
Running AOCL-Compression Test Bench On Windows
243260
----------------------------------------------
244261

262+
* CAUTION: <br>
263+
Before running the test bench, check whether it points to the right library dependency. <br>
264+
245265
Test bench on Windows supports all the user options as Linux,
246266
except for the `-c` option to link and test IPP compression methods.
247267
For more information on various user options, refer to the previous section on Linux.
248268
To set and launch the test bench with a specific user option,
249269
go to project aocl_compression_bench -> Properties -> Debugging;
250270
specify the user options and the input test file.
251271

272+
Running AOCL-Compression Examples
273+
---------------------------------
274+
275+
* CAUTION: <br>
276+
Before running the example programs, check whether it points to the right library dependency. <br>
277+
278+
Example programs are provided for both unified API and native APIs of each compression method.
279+
The library should be built with -DBUILD_EXAMPLE=ON. Other cmake options including
280+
-DAOCL_ENABLE_THREADS=ON can be enabled as desired.
281+
282+
* To run example program for unified API, use the command:<br>
283+
`example_unified_api <input filename>`
284+
285+
* To run example program for LZ4 native API, use the command:<br>
286+
`example_LZ4_compress_default <input filename>`
287+
288+
* To run example program that demonstrates obtaining format compliant compressed stream from multithreaded unified API,
289+
build the library by using -DAOCL_ENABLE_THREADS=ON and run the command:<br>
290+
`example_aocl_llc_skip_rap_frame <input filename>`
252291

253292
Running tests with CTest
254293
------------------------
@@ -267,12 +306,53 @@ Following are a few sample commands that can be executed in the build directory
267306
To run GTest test cases for a specific method<br>
268307
`ctest -R <METHOD_NAME_IN_CAPITALS>`
269308

309+
Running fuzzer tests
310+
--------------------
311+
312+
To list all the fuzz tests available for a method, use the following command:
313+
`<METHOD_GTEST_EXECUTABLE> --list_fuzz_tests`
314+
example: `zlib_gtest --list_fuzz_tests`
315+
316+
Fuzzer test can be run in two modes:
317+
318+
1. Unit test mode: Default operation mode of AOCL_TEST_FUZZER. Can be run as part of ctest. No sanitizer and coverage instrumentation.
319+
`ctest -R <TestSuiteName>.<FuzzTestName>`
320+
2. Fuzzing mode: Enabled with cmake option FUZZTEST_FUZZING_MODE. Runs each fuzz test with sanitizer and coverage instrumentation
321+
322+
To run all fuzz tests for a specified duration, use the following command:
323+
`<METHOD_GTEST_EXECUTABLE> --fuzz_for=<DURATION>`
324+
example: `zlib_gtest --fuzz_for=60s`
325+
326+
To run a single fuzz test until a bug is found or until manually stopped:
327+
`<METHOD_GTEST_EXECUTABLE> --fuzz=<TestSuiteName>.<FuzzTestName>`
328+
example: `zlib_gtest --fuzz=AOCL_Compression_zlib.compress2_fuzz`
329+
330+
To run a single fuzz test by feeding in an external corpus of seeds: Enabled with cmake option AOCL_TEST_FUZZER_WITH_CORPUS.
331+
Place folders containing seed files in the directory pointed by environment variable AOCL_FUZZ_CORPUS_DIR.
332+
Sub-folders under this must be as follows:
333+
* /compress_fuzz : Must contain uncompressed raw files for compress API fuzz tests.
334+
* /*_fuzz : Folders with individual fuzz test names must contain compressed files
335+
for respective methods used for decompress API fuzz tests.
336+
Example: /LZ4_decompress_safe_fuzz, /RawUncompress_fuzz, etc
337+
Run the single fuzz test:
338+
`<METHOD_GTEST_EXECUTABLE> --fuzz=<TestSuiteName>.<FuzzTestName>`
339+
example: `zlib_gtest --fuzz=AOCL_Compression_zlib.compress2_fuzz`
340+
Additional seed properties can be specified by environment variables:
341+
* AOCL_FUZZ_SIZE_MAX : Max size in bytes to use for i/o buffers used in fuzz testing.
342+
* AOCL_FUZZ_CPR_RATIO : Compression ratio estimate of compressed files used for decompress API fuzz tests.
343+
270344
Running source code coverage using GCOV
271345
---------------------------------------
272346

273347
To measure source code coverage, use CODE_COVERAGE option while configuring the CMake build. Run CMake with the custom target option 'code-coverage' to execute tests and generate code coverage data. The code coverage reports are generated in the build directory under subdirectory called 'coverage/html_report'. Open the HTML files in browser to view the coverage information.
274348

275349
Following is the sample command usage to run code coverage:
350+
`cmake -B <build directory> <CMakeList.txt filepath>
351+
-DCMAKE_INSTALL_PREFIX=<install path>
352+
-DCMAKE_BUILD_TYPE=Debug
353+
-DBUILD_STATIC_LIBS=ON
354+
-DCODE_COVERAGE=ON
355+
<Additional Library Build Options>`
276356
`cmake --build <build directory> --target install code-coverage`
277357

278358
Running Valgrind and ASAN memory checks using CTest
@@ -309,8 +389,15 @@ Following are a few sample commands to use the script available in the 'scripts'
309389
Generating Documentation
310390
------------------------
311391
- To generate documentation, specify the `-DBUILD_DOC=ON` option while building.
312-
- Documents will be generated in HTML format in the folder __docs/html__ . Open the index.html file in any browser to view the documentation.
313-
- CMake will use the existing Doxygen if available. Else, it will prompt the user to install doxygen and try again.
392+
- Documents will be generated in HTML format in the folder __docs/html__ as doxygen output & __docs/sphinx/html__ as sphinx output. Open the index.html file from respective folders in any browser to view the documentation.
393+
- The following packages are expected before running CMake with `-DBUILD_DOC=ON` option:
394+
1. Doxygen.
395+
2. Python packages:
396+
- Sphinx
397+
- rocm_docs
398+
- breathe
399+
- myst_parser
400+
- CMake halts if required packages are missing by providing directives for installing the absent packages.
314401

315402
Enabling/disabling optimizations
316403
--------------------------------

0 commit comments

Comments
 (0)