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

#13787: Fix build with CMAKE_DISABLE_PRECOMPILE_HEADERS #13700

Merged
merged 8 commits into from
Oct 15, 2024

Conversation

afuller-TT
Copy link
Contributor

@afuller-TT afuller-TT commented Oct 10, 2024

Ticket

closes #13787
needed for #13698

Problem description

When building with PCH disabled (set CMAKE_DISABLE_PRECOMPILE_HEADERS to True), the build fails because not all files include the headers they use. They are only accidentally able to resolve certain dependencies.

This is a problem, because the first cut of ccache is going to skip PCH. Also analysis tools (including the compiler) don't process non-included headers. As evidenced by the one non-include change in this PR that the compiler is now detecting.

What's changed

  • Build with CMAKE_DISABLE_PRECOMPILE_HEADERS = true
  • Fix failure
  • GOTO step 1

Checklist

  • Post commit CI passes
  • Blackhole Post commit (if applicable)
  • Model regression CI testing passes (if applicable)
  • Device performance regression CI testing passes (if applicable)
  • New/Existing tests provide coverage for changes

https://github.com/tenstorrent/tt-metal/actions/runs/11335836891

@@ -807,6 +807,7 @@ struct get_first_object_of_type_t<std::vector<T>> {
for (auto& tensor : value) {
return get_first_object_of_type<object_t>(tensor);
}
throw std::out_of_range("No such element");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Picked something arbitrary to satisfy the compiler's complaint that the f'n may exit without returning a value. Looking to the owners for context re: are we guarnateed that this will never happen, and can we hint to the compiler as much? Failing that, what is the desired outcome of this f'n?

@blozano-tt blozano-tt force-pushed the afuller/fix-missing-headers branch from 8a84a9f to 3e6749c Compare October 11, 2024 16:22
@tt-rkim
Copy link
Collaborator

tt-rkim commented Oct 11, 2024

@afuller-TT Do you mind putting the issue number with a colon in your final squashed commit message or edit your commits now, as enforced by git hooks?

@@ -5,6 +5,8 @@
#include "events.hpp"

#include "tt_metal/impl/event/event.hpp"
#include "pybind11/operators.h"
Copy link
Member

Choose a reason for hiding this comment

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

not sure this is the right include here. do you know whats missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for looking it over. Indeed that's the wrong one. I think I got trigger happy :)

This file was complaining about unable to resolve py::class_ and module.def. Looks like pybind11/pybind11.h is probably the right include. Updated.

Copy link
Member

@ayerofieiev-tt ayerofieiev-tt left a comment

Choose a reason for hiding this comment

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

This is a good change, but we don't run builds w/o PCH on CI.
This is going to happen again and again.
If we need to guarantee - we need to have a CI job.

Please don't forget to update PR title

@blozano-tt blozano-tt changed the title Afuller/fix missing headers #13787: Fix build with CMAKE_DISABLE_PRECOMPILE_HEADERS Oct 14, 2024
@afuller-TT
Copy link
Contributor Author

From @ayerofieiev-tt

This is a good change, but we don't run builds w/o PCH on CI.
This is going to happen again and again.
If we need to guarantee - we need to have a CI job.

Good call out. But fear not, the reason I discovered these is precisely because I'm preparing a build that cannot use PCH, so this is a pre-req and shortly after we get this in we'll be having a build that will detect any regression here.

@afuller-TT
Copy link
Contributor Author

I'm going to go ahead and merge this without waiting on the final approvals. It's had a number of eyes, including on the one code change. The rest is just #includes.

@afuller-TT afuller-TT merged commit 1043c46 into main Oct 15, 2024
6 checks passed
@afuller-TT afuller-TT deleted the afuller/fix-missing-headers branch October 15, 2024 16:25
yan-zaretskiy pushed a commit that referenced this pull request Oct 18, 2024
### Ticket
closes #13787 
needed for #13698

### Problem description
When building with PCH disabled (set `CMAKE_DISABLE_PRECOMPILE_HEADERS` to True), the build fails because not all files include the headers they use.  They are only accidentally able to resolve certain dependencies.

This is a problem, because the first cut of `ccache` is going to skip PCH.  Also analysis tools (including the compiler) don't process non-included headers.  As evidenced by the one non-include change in this PR that the compiler is now detecting.

### What's changed
* Build with `CMAKE_DISABLE_PRECOMPILE_HEADERS = true`
* Fix failure
* GOTO step 1

### Checklist
- [x] [Post commit CI passes](https://github.com/tenstorrent/tt-metal/actions/runs/11335836891)
- [ ] Blackhole Post commit (if applicable)
- [ ] Model regression CI testing passes (if applicable)
- [ ] Device performance regression CI testing passes (if applicable)
- [x] New/Existing tests provide coverage for changes

https://github.com/tenstorrent/tt-metal/actions/runs/11335836891

---------

Co-authored-by: Bryan Wilder Field Lozano <[email protected]>
ct-clmsn pushed a commit to ct-clmsn/tt-metal that referenced this pull request Nov 12, 2024
…enstorrent#13700)

### Ticket
closes tenstorrent#13787 
needed for tenstorrent#13698

### Problem description
When building with PCH disabled (set `CMAKE_DISABLE_PRECOMPILE_HEADERS` to True), the build fails because not all files include the headers they use.  They are only accidentally able to resolve certain dependencies.

This is a problem, because the first cut of `ccache` is going to skip PCH.  Also analysis tools (including the compiler) don't process non-included headers.  As evidenced by the one non-include change in this PR that the compiler is now detecting.

### What's changed
* Build with `CMAKE_DISABLE_PRECOMPILE_HEADERS = true`
* Fix failure
* GOTO step 1

### Checklist
- [x] [Post commit CI passes](https://github.com/tenstorrent/tt-metal/actions/runs/11335836891)
- [ ] Blackhole Post commit (if applicable)
- [ ] Model regression CI testing passes (if applicable)
- [ ] Device performance regression CI testing passes (if applicable)
- [x] New/Existing tests provide coverage for changes

https://github.com/tenstorrent/tt-metal/actions/runs/11335836891

---------

Co-authored-by: Bryan Wilder Field Lozano <[email protected]>
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.

Build is broken with precompiled headers disabled
7 participants