Skip to content

Consider fully replacing BBF_RUN_RARELY with the weight of 0 #48778

Closed

Description

@SingleAccretion

I see that most code clearing this flag is doing the moral equivalent of the following:

block->bbWeight = weight;
if (weight > 0)
{
    block->bbFlags &= ~BBF_RUN_RARELY;
}

Perhaps it would be feasible to avoid writing this code and just use bbWeight == 0.0f (bbSetRunRarely/isRunRarely) everywhere instead?

cc @AndyAyersMS

Edit: label addition was not intended :(.

category:cq
theme:profile-feedback

Activity

  1. ghost added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Feb 25, 2021
  2. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Feb 25, 2021
  3. changed the title [-]Consider fully replacing `BBF_RUN_RARELY` with profile weight of `0.0f`[/-] [+]Consider fully replacing BBF_RUN_RARELY with profile weight of 0[/+] on Feb 25, 2021
  4. AndyAyersMS commented on Feb 25, 2021

    @AndyAyersMS
    Member

    BBF_RUN_RARELY gets set even when we don't have profile data, eg for things like BBJ_THROW blocks.

    My ambition is that we always have some form of profile data flowing around, even if we have to synthesize it via heuristics. Once we get to that point, your suggestion (or something similar) makes total sense.

  5. SingleAccretion commented on Feb 25, 2021

    @SingleAccretion
    ContributorAuthor

    BBF_RUN_RARELY gets set even when we don't have profile data, eg for things like BBJ_THROW blocks.

    I see. My thinking was we'd indicate the fact that that the weight (profile-derived or synthetic) is missing by some sentinel value as well (e. g. -1), but if the plan is to always have valid weights, than this change should indeed wait.

  6. changed the title [-]Consider fully replacing BBF_RUN_RARELY with profile weight of 0[/-] [+]Consider fully replacing BBF_RUN_RARELY with the weight of 0[/+] on Feb 25, 2021
  7. AndyAyersMS commented on Feb 25, 2021

    @AndyAyersMS
    Member

    The plan is to always have weights, yes. In the scheme I'm envisioning, zero weights would have special meaning. Synthesis would only produce zeros for things that are truly always rare, like throws.

    When we have true profile data, the plan is to blend in a little bit of synthesis data so that we're not overfitting our optimizations to the observed behavior (in a perhaps ideal world if a profile-optimized program fell "off trace" too often we would reoptimize, but we're a ways off from things like that). So even if a block ends up unprofiled it will have a small nonzero weight.

    I expect at that point the notion of rare will split into "truly rare" and "cold" and we'll have to sort out conditions for the optimizations currently gated by rare.

  8. added
    needs-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
    and removed
    untriagedNew issue has not been triaged by the area owner
    on Mar 2, 2021
  9. added this to the 6.0.0 milestone on Mar 10, 2021
  10. removed
    needs-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
    on Mar 12, 2021
  11. added
    needs-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
    and removed
    needs-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
    on Mar 23, 2021
  12. modified the milestones: 6.0.0, Future on Mar 29, 2021
  13. added
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 28, 2025
  14. locked and limited conversation to collaborators on Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Priority:3Work that is nice to havearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issue

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions