-
Notifications
You must be signed in to change notification settings - Fork 102
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
omilyutin-tt
approved these changes
Jan 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
afuller-TT
approved these changes
Jan 26, 2025
ayerofieiev-tt
approved these changes
Jan 27, 2025
williamlyTT
pushed a commit
that referenced
this pull request
Jan 30, 2025
yieldthought
pushed a commit
that referenced
this pull request
Jan 31, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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](https://private-user-images.githubusercontent.com/181790211/406763497-fc259b71-e674-4199-bc9b-ca648dbebd70.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODY4NzAsIm5iZiI6MTczOTM4NjU3MCwicGF0aCI6Ii8xODE3OTAyMTEvNDA2NzYzNDk3LWZjMjU5YjcxLWU2NzQtNDE5OS1iYzliLWNhNjQ4ZGJlYmQ3MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxODU2MTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xODI4NDE3OTEzYWU4NjE3OTA4NjAwOTZiYWVhNThhNWE3ODYwZDBmNDg5MTA1MjAzNTdhNmM2NTc1NzQ5NWUzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.f1s3zKHvzjhfa208azLsQ9ItAmGq0-gh42KR_InyXtc)
And decreases the compile time cost of core.hpp by 40%.
![image](https://private-user-images.githubusercontent.com/181790211/406763713-850f61b4-30b5-47ee-b835-95ffdfe4d0d3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODY4NzAsIm5iZiI6MTczOTM4NjU3MCwicGF0aCI6Ii8xODE3OTAyMTEvNDA2NzYzNzEzLTg1MGY2MWI0LTMwYjUtNDdlZS1iODM1LTk1ZmZkZmU0ZDBkMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxODU2MTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kZTc3ZmQ2M2FhMDBjNzcwOWYyZWQ3YTY0ZGQ3ODFhMmZmZThhYWQwNWYxZjE1NzIyOGM0ZjZhNGRkOTRjNmUwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.FEMiu2vRVeq3lS3pM9wNM1wvXOdLoCAE4GcmXY2IwRs)
Checklist