-
Notifications
You must be signed in to change notification settings - Fork 327
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
Graph Visualization: Added a 'Label' structure, debug marks , order of commandBuffer and reestructuration of the code. #2541
Conversation
UNUSED = "UNUSED" | ||
) | ||
|
||
func (g *graph) traverseGraph(currentNode *node, visitTime, minVisitTime, idInStronglyConnectedComponents, visitedNodesId *[]int, currentId, currentTime *int) { |
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.
These are large enough functions, it would be good to get comments on exactly what the parameters are supposed to be.
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 abstracted the parameters used to compute the Strongly Connected Components in a directed graph based on Tarjan algorithm. Thank you.
LevelsID []int | ||
} | ||
|
||
func (label *Label) GetSize() int { |
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.
Godocs needed for all public methods.
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.
Thank you, I added the Godocs for all public methods.
"bytes" | ||
"fmt" | ||
) | ||
|
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.
Godocs here as well.
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 added the Godocs here as well. Thanks.
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.
lgtm, modulo adding the godocs, our offline discussion about debug markers, and a few nits.
level := builder.labelsInsideDebugMarkers[len(builder.labelsInsideDebugMarkers)-1].GetSize() - 1 | ||
builder.numberOfDebugMarker++ | ||
for i := from; i <= to; i++ { | ||
builder.labelsInsideDebugMarkers[i].Insert(level, VK_CMD_DEBUG_MARKER, builder.numberOfDebugMarker) |
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 don't understand why adding a debug marker affects multiple entries in labelsInsideDebugMarkers.
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.
In fact some labels could be affected by more than one debug marker (nested debug markers), in that case the algorithm add more than one time the debug marker level. All commands between debug_marker_begin and debug_marker_end are affected.
|
||
} else if len(builder.positionOfDebugMarkersBegin) > 0 { | ||
if labelOfLastDebugMarkerBegin.GetSize() != currentLabel.GetSize() { | ||
builder.positionOfDebugMarkersBegin = builder.positionOfDebugMarkersBegin[:0] |
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.
It looks like this aborts ALL open debug markers as soon as ONE doesn't nest correctly with the non-debug markers. Is that a correct understanding?
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.
We have a ton of code in vulkan.go to handle nesting of debug markers and similar, (as used for displaying groups in the UI) It handles some of these cases (bad nestings etc).
Is there a chance we can leverage that?
It may be a follow-up, but it may save some time in handling some of these cases.
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.
Now I am adding debug markers as long as it does not destroy any level of hierarchy defined in commands. So, if exists some command between debug_marker_begin and debug_marker_end which has smaller Label size , adding the debug marker here will destroy the levels of hierarchy and for this case I just ignore the debug marker. It means I am preserving Labels with no-decreasing size. I have tested with several captures and it is working very nice. In addition to this, I am analyzing the possibility to include code from vulkan.go to address this problem as well, but if it is the case , I will add this in the last commit. Thank you.
} | ||
} | ||
} | ||
if _, ok := builder.labelToHierarchy[label]; !ok { | ||
builder.labelToHierarchy[label] = &api.Hierarchy{} | ||
temporalLabelAsAString := label.GetLabelAsAString() |
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 the name "temporal" intentional? Or was it meant to be "temporary"?
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.
It is intentional, but I figured out that 'temporal' is not the correct word to describe something provisional , thank you. I changed it to temporary.
} | ||
hierarchy := builder.labelToHierarchy[label] | ||
hierarchy := builder.labelAsAStringToHierarchy[temporalLabelAsAString] |
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.
In general this pattern of inserting a default value into the map when the key is missing can be re-expressed as
hierarchy, ok := builder.labelAsAStringToHierarchy[temporalLabelAsAString]
if !ok {
hierarchy = &api.Hierarchy{}
builder.labelAsAStringToHierarchy[temporalLabelAsAString] = hierarchy
}
This removes one of the map lookups.
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.
Thank you. Yes , using this I am removing one look up in the map. I changed it for the two cases.
@@ -197,122 +189,6 @@ func (input nodeSorter) Less(i, j int) bool { | |||
return input[i].id < input[j].id | |||
} | |||
|
|||
func (g *graph) traverseGraph(currentNode *node, visitTime, minVisitTime, idInStronglyConnectedComponents, visitedNodesId *[]int, currentId, currentTime *int) { |
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.
When moving big chunks of code like this, it's usually preferred to do the move in a separate commit, since it is hard to see what changed. Just a comment, no need to change this.
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 have abstracted this part of code to simplify the understanding, because it is essentially the Tarjan algorithm to compute Strongly Connected Components in a directed graph. I will remove this in a later commit.
5f232a1
to
fce6646
Compare
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.
lgtm
} | ||
|
||
func (builder *labelForVulkanCommands) GetCommandLabel(command api.Cmd, commandNodeId uint64) string { | ||
func (builder *labelForVulkanCommands) GetCommandLabel(command api.Cmd, cmdId uint64) *api.Label { |
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.
These functions that implement the interfaces are also public, and should also have godocs. Those godocs are usually exactly the same as the godocs from the interface method they are implementing.
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.
Thank you, I will add the Godocs here as well.
10bdf15
to
c895efd
Compare
commandBuffer and reestructuration of the code. 'Label' Structure: It improves the time and space complexity for algorithms on the graph and the output format. Debug markers: They are added whenever do not break any previous hierarchy already defined. It follows the idea of balance parenthesis. Reestructuration of the code: This is divided in graph_algorithms, graph_structure, graph_output and graph_visualization for better understanding and future work.
c895efd
to
54a9bbc
Compare
No description provided.