Skip to content

cmd/compile/internal/inline: hairyVisitor doesn't properly account for conditionally-inlined PGO calls #59484

Description

@prattmic

In hairVisitor.doNode we give calls a cost of 57, unless the call is inlineable, in which case we use the cost of the callee, under the assumption that this call will get inlined.

"Inlineable" here more-or-less just means that fn.Inl != nil. In a non-PGO build, we only set fn.Inl if the function cost is < 80, making it inlineable ~anywhere.

In a PGO build, fn.Inl is set for any function involved in a hot callsite (e.g., a -> b), but we will only inline at the hot callsite. Any other callsite (e.g., c -> b) will not inline. This makes the assumption incorrect and means that the cold caller (c) will have an artificially inflated cost, potentially making it too expensive to inline.

I will send a CL to fix this.

cc @cherrymui @thanm @mdempsky

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions