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
cmd/compile: document PGO policy regarding explicit user optimization hint behavior #64460
Comments
CC @golang/compiler. |
I think in general Go will not have many compiler directives/pragmas for optimization hints. I'm not sure what to document specifically. Maybe we could add that with If later we introduce a compiler directive that has interesting interactions with PGO, we can document that. |
I understand it, but from the current Go documentation:
According to this, "function should not be inlined" I see "should not". I cannot read it right now as "a function with go:noinline directive is NEVER inlined". That's why I am asking the question. From my current reading, |
I agree the current wording is fine. I don't want us to overcommit on cmd/go documents and supports more directives that are user targeted. The cmd/compile directives are for low-level details that most users shouldn't need to use or worry about. |
If the current wording is fine, then I am kindly asking to add a note somewhere that the PGO optimization does not affect the inlining decisions for the functions with |
But why? Who does that help? |
This information is important for people, who optimize their programs. As you know, inlining decisions could be critical in some cases. E.g. performing extra inlining in the "wrong" place could affect the code size. Code size characteristics could be critical in certain situations. If the compiler has If you are strictly against adding such implementation detail to the documentation - okay, it's of course up to the development team. Hopefully, if someone is interested a lot about the question - they will be able to dig into the compiler and search over the GitHub issue. This way has worse UX but reduces the documentation maintenance cost. |
I don't what to get to too much about wording (and I'm not an expert on it). But I think at least in this case, "should not" means never. It is not a hint, but a requirement. |
Regarding meanings of words like "should", "may" and others - to eliminate different readings of the same words I like to use RFC 2119 (https://datatracker.ietf.org/doc/html/rfc2119). Maybe I am a bit pedantic in this area since I spent several years of my life with the C++ standardization process... :) Of course, if it's the well-known fact in this area of Go that "should" has other meaning than a recommendation, the current wording is fine. |
If the compiler does something it "should not" do, I'd think that is a very bad thing and only creates confusions. |
In compiler/runtime triage, we don't think we're going to do anything here. However, if you'd like to send a CL to alter the wording, that's fine with us. Thanks. |
Hi!
In LLVM there is an interesting issue about how PGO profiles interact with user-provided hints (like
//go:noinline
pragma).In the Go compiler right now only inlining decisions (AFAIK) are influenced by PGO, so the the only visible to me right now affected pragma is
go::noinline
. We need to document the current behavior.Later, when the Go compiler will implement more and more optimizations, possibly other pragmas would be affected as well. They should tracked somehow and documented as well.
The text was updated successfully, but these errors were encountered: