This is an archive of the discontinued LLVM Phabricator instance.

[llvm] add compression AlgorithmName (s) to the zlib and zstd namespaces
AcceptedPublic

Authored by ckissane on Jul 7 2022, 1:13 PM.

Details

Diff Detail

Event Timeline

ckissane created this revision.Jul 7 2022, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 1:13 PM
ckissane requested review of this revision.Jul 7 2022, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 1:13 PM
ckissane added a parent revision: Restricted Differential Revision.Jul 7 2022, 1:13 PM
phosek accepted this revision.Jul 7 2022, 1:20 PM

LGTM

This revision is now accepted and ready to land.Jul 7 2022, 1:20 PM
dblaikie added inline comments.
llvm/include/llvm/Support/Compression.h
25–31

I worry that this setup (a namespace that defines an interface) looks like it's setup for some kind of compile-time substitution (eg: #define LLVM_COMPRESSION_TYPE zlib then doing things equivalent to compression::LLVM_COMPRESSION_TYPE::compress) which I think was discussed earlier in the patch series and something I think I pushed back on. Compression default would likely be configurable, and which compression options are compiled in (if zlib is compiled in/available, if zstd is compiled in/available) would be configurable, but the choice would/should still be at runtime for ease of rollout, integration with different tools that might only support zlib, etc.

ie: if you want to abstract over compression algorithms this should be a runtime abstraction, not a build time one - and this code here looks a lot like it'd be built for build-time choice of compression algorithm, which I think is something we should not do.

ckissane added a subscriber: MaskRay.EditedJul 17 2022, 12:32 PM

@dblaikie Yes, the end goal is to make it configurable and eventually refactor to make a shared "compression class" interface where we have zlib and zstd implementations.
However, this patch/patch before it is only pointed at adding an implementation of code to call zstd in the first place. Also @MaskRay has an draft patch that demonstrates how this current setup could still be used in a runtime way.
Note to make that intention clear we have dropped the usage of namespace aliases at the request of @phosek and others.
Edit:
TLDR:
a refactor of compression to use a class interface system is out of scope IMO for this patch

@dblaikie Yes, the end goal is to make it configurable and eventually refactor to make a shared "compression class" interface where we have zlib and zstd implementations.
However, this patch is only pointed at adding an implementation of code to call zstd in the first place. Also @MaskRay has an draft patch that demonstrates how this current setup could still be used in a runtime way.
Note to make that intention clear we have dropped the usage of namespace aliases at the request of @phosek and others.
Edit:
TLDR:
a refactor of compression to use a class interface system is out of scope IMO for this patch

Cool, thanks for the context!

ckissane removed a parent revision: Restricted Differential Revision.Jul 19 2022, 11:42 AM