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

Tweak the Printer code in runtime for smaller code #8023

Merged
merged 7 commits into from
Jan 22, 2024

Conversation

steven-johnson
Copy link
Contributor

TL;DR: template expansion meant that we had more replicated code than expected from the inline expansion of code in Printer and friends. Restructured and added NEVER_INLINE to try to make the call sites as small as possible. It's a modest code-size savings but nonzero... e.g., the linux-x86-64 .o output from correct_cross_compilation drops from 164280 bytes to 162936 bytes.

TL;DR: template expansion meant that we had more replicated code than expected from the inline expansion of code in Printer and friends. Restructured and added NEVER_INLINE to try to make the call sites as small as possible. It's a modest code-size savings but nonzero... e.g., the linux-x86-64 .o output from correct_cross_compilation drops from 164280 bytes to 162936 bytes.
@steven-johnson steven-johnson requested a review from abadams January 4, 2024 19:37
@steven-johnson
Copy link
Contributor Author

(soooo many subtle off by one errors, sigh)

@steven-johnson
Copy link
Contributor Author

Finally green! PTAL

@steven-johnson steven-johnson merged commit e0e9f63 into main Jan 22, 2024
19 checks passed
@steven-johnson steven-johnson deleted the srj/printer-tweak branch January 22, 2024 21:43
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
* Tweak the Printer code in runtime for smaller code

TL;DR: template expansion meant that we had more replicated code than expected from the inline expansion of code in Printer and friends. Restructured and added NEVER_INLINE to try to make the call sites as small as possible. It's a modest code-size savings but nonzero... e.g., the linux-x86-64 .o output from correct_cross_compilation drops from 164280 bytes to 162936 bytes.

* Update printer.h

* debug

* Update HalideTestHelpers.cmake

* Update printer.h

* fixes
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