Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code object compression via bundling #2054

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

bstefanuk
Copy link
Contributor

@bstefanuk bstefanuk commented Nov 21, 2024

Summary:

This PR adds a compression layer to all final code objects, thereby generating smaller libraries at the expense of build time. Includes minor refactoring.

Outcomes:

  • A new clang-offload-bundler invocation is added after assembly object linking.
  • getAssemblyCodeObjectFiles has been renamed to buildAssemblyCodeObjectFiles to match the name of source kernel functions.
Build Time Size
Feature, gfx900 1m36.450s 29M
Develop, gfx900 1m29.974s 76M
Feature, gfx90a   435M
Develop, gfx90a 7m24.915s 1.6G

Compression ratio for gfx900: 2.66
Compression ratio for gfx90a: 3.74

Testing and Environment:

Docker: Ubuntu 24.04, ROCm 6.4 RC stack, AMD clang version 18.0.0, AMD clang-offload-bundler version 18.0.0

Tested with hipBLASLt bench

@bstefanuk bstefanuk marked this pull request as ready for review November 21, 2024 20:33
@bstefanuk bstefanuk self-assigned this Nov 21, 2024
@bstefanuk bstefanuk marked this pull request as draft November 21, 2024 20:35
@bstefanuk
Copy link
Contributor Author

bstefanuk commented Nov 21, 2024

Once documentation and tests are added, I will remove from draft.


extObj = ".o"
extCo = ".co"
extCoRaw = ".co.raw"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the meaning of raw?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, ".raw" is an extension used to identify the co file after linking but before compression. Files with this extension live in the build_tmp/ directory and are the input for the compression via bundling step.

bundler,
"--compress",
"--type=o",
"--bundle-align=4096",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did we get 4096 and should it be fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter was recommended to me by the compiler team. @yxsamliu how does this parameter affect the output? Is it needed in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants