|
| 1 | +// REQUIRES: zstd && (system-windows || system-linux) |
| 2 | + |
| 3 | +// clang-offload-wrapper compression test: checks that the wrapper can compress the device images. |
| 4 | +// Checks the '--offload-compress', '--offload-compression-level', and '--offload-compression-threshold' |
| 5 | +// CLI options. |
| 6 | + |
| 7 | +// --- Prepare test data by creating the debice binary image. |
| 8 | +// RUN: echo -e -n 'device binary image1\n' > %t.bin |
| 9 | +// RUN: echo -e -n '[Category1]\nint_prop1=1|10\n[Category2]\nint_prop2=1|20\n' > %t.props |
| 10 | +// RUN: echo -e -n 'kernel1\nkernel2\n' > %t.sym |
| 11 | +// RUN: echo -e -n 'Manifest file - arbitrary data generated by the toolchain\n' > %t.mnf |
| 12 | +// RUN: echo '[Code|Properties|Symbols|Manifest]' > %t.img1 |
| 13 | +// RUN: echo %t.bin"|"%t.props"|"%t.sym"|"%t.mnf >> %t.img1 |
| 14 | + |
| 15 | +/////////////////////////////////////////////////////// |
| 16 | +// Compress the test image using clang-offload-wrapper. |
| 17 | +/////////////////////////////////////////////////////// |
| 18 | + |
| 19 | +// RUN: clang-offload-wrapper -kind=sycl -target=TARGET -batch %t.img1 -o %t.wrapped.bc -v \ |
| 20 | +// RUN: --offload-compress --offload-compression-level=9 --offload-compression-threshold=0 \ |
| 21 | +// RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-COMPRESS |
| 22 | + |
| 23 | +// CHECK-COMPRESS: [Compression] Original image size: |
| 24 | +// CHECK-COMPRESS: [Compression] Compressed image size: |
| 25 | +// CHECK-COMPRESS: [Compression] Compression level used: 9 |
| 26 | + |
| 27 | +/////////////////////////////////////////////////////////// |
| 28 | +// Check that there is no compression when the threshold is set to a value higher than the image size |
| 29 | +// or '--offload-compress' is not set. |
| 30 | +/////////////////////////////////////////////////////////// |
| 31 | + |
| 32 | +// RUN: clang-offload-wrapper -kind=sycl -target=TARGET -batch %t.img1 -o %t.wrapped.bc -v \ |
| 33 | +// RUN: --offload-compress --offload-compression-level=3 --offload-compression-threshold=1000 \ |
| 34 | +// RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-NO-COMPRESS |
| 35 | + |
| 36 | +// RUN: clang-offload-wrapper -kind=sycl -target=TARGET -batch %t.img1 -o %t.wrapped.bc -v \ |
| 37 | +// RUN: --offload-compression-level=3 --offload-compression-threshold=0 \ |
| 38 | +// RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-NO-COMPRESS |
| 39 | + |
| 40 | +// CHECK-NO-COMPRESS-NOT: [Compression] Original image size: |
0 commit comments