[llvm] [llvm] Add API to get decompressed size of a zstd compressed buffer. (PR #107020)
Udit Kumar Agarwal via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 15:30:06 PDT 2025
uditagarwal97 wrote:
> Do you have an in-tree use case for this API? If not, I don't think we want to add a wrapper here.
There are efforts going on to upstream SYCL RT to LLVM (https://discourse.llvm.org/t/rfc-sycl-runtime-upstreaming/74479/4). In SYCL offloading, we use `zstd` to compress device code during compilation and the decompress deice code on demand at runtime.
Without any API to get decompressed size (proposed changes in this PR), the component using ZSTD compression has to always pass on the decompressed size (original blob size) to the component doing decompression - that's what we currently do in `clang-offload-bundler`. However, this is redundant since ZSTD already stores the original size in compressed blob headers (if not using ZSTD streaming mode - which LLVM anyway doesn't support) and we can use `ZSTD_getFrameContentSize` to get that.
Currently, in SYCL RT, we had to link ZSTD library along with `LLVMSupport`, just so that we can get the decompressed size via `ZSTD_getFrameContentSize` and so, adding wrapper to this API in LLVMSupport would simplify things a lot and would help with upstreaming.
Moreover, after this change, we would be able to simply compressed offload bundle data structure (https://clang.llvm.org/docs/ClangOffloadBundler.html#compression-and-decompression) and can get rid of the "Uncompressed binary size" field altogether - saving 32 bits. 😱
https://github.com/llvm/llvm-project/pull/107020
More information about the llvm-commits
mailing list