-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT: change basic block weight to float #45052
Changes from 4 commits
171a222
5cdf261
19f5f9c
c36ffc9
bd0f086
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,16 +514,14 @@ struct BasicBlock : private LIR::Range | |
const char* dspToString(int blockNumPadding = 0); | ||
#endif // DEBUG | ||
|
||
typedef unsigned weight_t; // Type used to hold block and edge weights | ||
// Note that for CLR v2.0 and earlier our | ||
// block weights were stored using unsigned shorts | ||
// Type used to hold block and edge weights | ||
typedef float weight_t; | ||
|
||
#define BB_UNITY_WEIGHT 100 // how much a normal execute once block weights | ||
#define BB_LOOP_WEIGHT 8 // how much more loops are weighted | ||
#define BB_ZERO_WEIGHT 0 | ||
#define BB_MAX_WEIGHT UINT32_MAX // we're using an 'unsigned' for the weight | ||
#define BB_VERY_HOT_WEIGHT 256 // how many average hits a BB has (per BBT scenario run) for this block | ||
// to be considered as very hot | ||
#define BB_UNITY_WEIGHT 100.0f // how much a normal execute once block weights | ||
AndyAyersMS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define BB_UNITY_WEIGHT_UNSIGNED 100 // how much a normal execute once block weights | ||
#define BB_LOOP_WEIGHT 8.0f // how much more loops are weighted | ||
AndyAyersMS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define BB_ZERO_WEIGHT 0.0f | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an equality check against zero somewhere that isn't just checking to see if it's this assigned value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be? Might be tricky to find these... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't have any issues with negative zero as previously the weight was an unsigned. |
||
#define BB_MAX_WEIGHT FLT_MAX // maximum finite weight -- needs rethinking. | ||
|
||
weight_t bbWeight; // The dynamic execution weight of this block | ||
|
||
|
@@ -551,7 +549,7 @@ struct BasicBlock : private LIR::Range | |
} | ||
|
||
// setBBProfileWeight -- Set the profile-derived weight for a basic block | ||
void setBBProfileWeight(unsigned weight) | ||
void setBBProfileWeight(weight_t weight) | ||
{ | ||
this->bbFlags |= BBF_PROF_WEIGHT; | ||
this->bbWeight = weight; | ||
|
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.
Is it worthwhile to keep
weight_t
as a BasicBlock member, or should we just make it a global type? (Or even its own class?)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.
I'd probably vote to get rid of it entirely and just use
float
. I don't find these sorts of typedefs helpful; most anywhere you work with these values you also need to know the actual underlying type.In past compilers I've seen people wrap these floats in structs to get stronger type checking but that is a whole lot of uninteresting boilerplate.