Skip to content

Commit

Permalink
graph order: run some form of schedule verification in all tiers if
Browse files Browse the repository at this point in the history
possible
  • Loading branch information
davleopo committed Sep 25, 2023
1 parent 009e43c commit 88d2436
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import org.graalvm.collections.EconomicMap;
import org.graalvm.collections.Equivalence;
import org.graalvm.compiler.debug.Assertions;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.graph.GraalGraphError;
Expand Down Expand Up @@ -150,12 +151,24 @@ private static void visitForward(ArrayList<Node> nodes, NodeBitMap visited, Node
}
}

public static boolean assertSchedulableGraph(StructuredGraph g) {
assert GraphOrder.assertNonCyclicGraph(g);
assert g.getGuardsStage() == GuardsStage.AFTER_FSA || GraphOrder.assertScheduleableBeforeFSA(g);
if (g.getGuardsStage() == GuardsStage.AFTER_FSA && Assertions.detailedAssertionsEnabled(g.getOptions())) {
// we still want to do a memory verification of the schedule even if we can
// no longer use assertSchedulableGraph after the floating reads phase
SchedulePhase.runWithoutContextOptimizations(g, SchedulePhase.SchedulingStrategy.LATEST_OUT_OF_LOOPS, true);
}
assert g.verify();
return true;
}

/**
* This method schedules the graph and makes sure that, for every node, all inputs are available
* at the position where it is scheduled. This is a very expensive assertion.
*/
@SuppressWarnings("try")
public static boolean assertSchedulableGraph(final StructuredGraph graph) {
private static boolean assertScheduleableBeforeFSA(final StructuredGraph graph) {
assert graph.getGuardsStage() != GuardsStage.AFTER_FSA : "Cannot use the BlockIteratorClosure after FrameState Assignment, HIR Loop Data Structures are no longer valid.";
try (DebugContext.Scope s = graph.getDebug().scope("AssertSchedulableGraph")) {
SchedulePhase.runWithoutContextOptimizations(graph, getSchedulingPolicy(graph), true);
Expand Down

0 comments on commit 88d2436

Please sign in to comment.