[clang] [HIP] Support compressing device binary (PR #67162)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 2 11:16:45 PDT 2023


yxsamliu wrote:

> > We need to support compression/uncompression of standalone bundled bitcode, and standalone bundled code objects that are not embedded in ELF or COFF binaries. An OS-neutral binary format is preferred.
> 
> I think my ideal solution would be LLVM supporting some module metadata such that a section emitted by the backend automatically uses an ELF compressed section, though this wouldn't apply to LTO objects unfortunately. That being said, it's not unreasonable to do this manually for this specified use-case.
> 
> I see this introduces a new header to the bundled format, will this break any backwards compatibility? I'm guessing old binaries can check for the LLVM bitcode, ELF, or COFF magic directly instead. If that's the case I'd probably recommend adding your magic number to the `file_magic` implementation.

Good point. The compiler and runtime are able to consume the offload bundle files created by the old compiler. If compression is not enabled, the old compiler and runtime will be able to consume it. However, old compiler and runtime will not be able to consume the compressed bundle.

I have added recognizing the clang offload bundle (compressed and uncompressed) to the magic number.

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


More information about the cfe-commits mailing list