[clang] [llvm] [HIP] change compress level (PR #83605)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 20:10:15 PST 2024


================
@@ -942,20 +942,28 @@ CompressedOffloadBundle::compress(const llvm::MemoryBuffer &Input,
       Input.getBuffer().size());
 
   llvm::compression::Format CompressionFormat;
+  int Level;
 
-  if (llvm::compression::zstd::isAvailable())
+  if (llvm::compression::zstd::isAvailable()) {
     CompressionFormat = llvm::compression::Format::Zstd;
-  else if (llvm::compression::zlib::isAvailable())
+    // Use a high zstd compress level by default for better size reduction.
+    const int DefaultZstdLevel = 20;
----------------
yxsamliu wrote:

> What's the default compression level for zstd?
> 
default compression level for zstd is 6

> It would be great if we could override the compression level. I'm somewhat reluctant to impose max compression level on everyone by default, without any way out, if it turns out to be a problem.
> 

I can add a clang-offload-bundler option -compress-level=n and a clang option --offload-compress-level=n to control the compression level.

> @MaskRay WDYT?
> 
> Max compression level may be fine. If we produce enough stuff for compression to take long, compilation time itself will likely dwarf the compression time. For the small TUs, even slow compression may be fine.
> 
> @yxsamliu how long the compilation w/o compression takes in your benchmarks?

For Blender 4.1, compiling kernels to bitcode for 6 GPU takes 30s. compression with zstd level 20 takes 2s.

https://github.com/llvm/llvm-project/pull/83605


More information about the cfe-commits mailing list