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

Move definitions to implementation for core.hpp #17118

Merged
merged 9 commits into from
Jan 27, 2025
Merged

Move definitions to implementation for core.hpp #17118

merged 9 commits into from
Jan 27, 2025

Conversation

blozano-tt
Copy link
Contributor

@blozano-tt blozano-tt commented Jan 26, 2025

Problem description

Build time on single core machine is 2.5 hours.

core.hpp is a header file that is included 462 times, and it consumes 745s of compile time.
There are inline functions in this file, and its not clear to me why.
Defining the definition in every translation unit will have a compile time cost.
If these functions need to be inlined in the binary, the compiler should make that decision automatically (I believe).
Additionally, magic_enum is a very expensive template library, and it is included 462 times transitively.
Move it to Cpp file.

I would like to see if I can start using forward declarations as well in a follow up PR.

What's changed

Remove usage of inline for free functions in ttnn::core namespace.
Add missing includes.
Move singleton instance() method definition to cpp file, along with all other methods.
Move magic_enum inclusion to implementation.

How does compile time change?

This PR fixes this problem (gone)
image

And decreases the compile time cost of core.hpp by 40%.
image

Checklist

Copy link
Contributor

@omilyutin-tt omilyutin-tt left a comment

Choose a reason for hiding this comment

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

Great!

ttnn/cpp/ttnn/core.cpp Outdated Show resolved Hide resolved
@blozano-tt blozano-tt merged commit dc5def7 into main Jan 27, 2025
140 of 193 checks passed
@blozano-tt blozano-tt deleted the blozano-core branch January 27, 2025 01:19
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.

4 participants