-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ConstraintSystem] Add index value (as an impact of the score kind) to output of debug constraints. #78740
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
[ConstraintSystem] Add index value (as an impact of the score kind) to output of debug constraints. #78740
Conversation
…o debug constraints.
@@ -1197,6 +1197,9 @@ struct Score { | |||
for (unsigned int i = 0; i < NumScoreKinds; ++i) { | |||
if (Data[i] != 0) { | |||
out << " [component: "; | |||
out << "#"; | |||
out << std::to_string(i); | |||
out << " "; |
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.
Thanks! I think to clarify this even further we should use weight
instead of index
(which is opposite) and instead of value:
-> impact:
. This would better reflect the meaning of these values.
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.
Thanks for suggestion! I addressed at 88fba29
before this PR
Fixed score: [component: collection upcast conversion(s), value: 1] [component: empty-existential conversion(s), value: 1]
now
Fixed score: [component: #8 collection upcast conversion(s), impact: 1] [component: #6 empty-existential conversion(s), impact: 1]
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.
As I mentioned in my previous comment, I think we need to change component:
that you added into something which has clearer meaning i.e. weight
and print it the inverse of it to indicate the scores placed at a higher index have a higher 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.
@xedin Thanks again, sorry for my misunderstanding.
print it the inverse of it to indicate the scores placed at a higher index have a higher weight.
is NumScoreKinds - i
correct? this means higher value indicate higher weight I think.
e.g.
SK_Hole
== 22SK_UnappliedFunction
== 1
I think we need to change component: that you added into something which has clearer meaning i.e. weight
let me double check, did you mean like this?
[weight: #8 collection upcast conversion(s), impact: 1]
If I still have misunderstanding, I'd be very happy if you suggest with a example output like ↑🙇
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.
also I thought
[collection upcast conversion(s), weight: 8, impact: 1]
maybe more readable? (either is fine for me 😄 )
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 like the latter format where both values are together and yes about NumScoreKinds - i
, SK_Hole
has more weight than SK_UnappliedFunction
during solution ranking.
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.
bc10f6f
to
88fba29
Compare
@swift-ci please test |
Thank you for the contribution! |
Environment
Motivation
resolve #72842
As I mentioned in #72842,
In current output of debug-constraints, We cannot easily recognize which score is more impactful.
Full Output
We cannot recognize which score is more/less impactful. e.g. between
value to optional promotion
ofSolution#0
andempty-existential conversion
ofSolution#1
.(We can guess
empty-existential conversion(s)
is less impactful, since final Solution is Solution#1 but it is ambiguous.)Proposed Solution
I added number indicating impact of score to output of debug-constraints.
Currently I used index of
enum ScoreKind
. (i.e. smaller number is more impactful).Alternative Format
Suggestion for other formats are welcome.
e. g.