Beispiel #1
0
def test_prune_k_cache_fills_backward():
    testee = VerticalLoopFactory(
        loop_order=LoopOrder.BACKWARD,
        sections__0__horizontal_executions__0__body=[
            AssignStmtFactory(left__name="foo",
                              right__name="foo",
                              right__offset__k=-1),
            AssignStmtFactory(left__name="bar",
                              right__name="bar",
                              right__offset__k=0),
            AssignStmtFactory(left__name="baz",
                              right__name="baz",
                              right__offset__k=1),
            AssignStmtFactory(left__name="barbaz", right__name="bar"),
            AssignStmtFactory(left__name="barbaz",
                              right__name="barbaz",
                              right__offset__k=1),
        ],
        caches=[
            KCacheFactory(name="foo", fill=True),
            KCacheFactory(name="bar", fill=True),
            KCacheFactory(name="baz", fill=True),
            KCacheFactory(name="barbaz", fill=True),
        ],
    )
    transformed = PruneKCacheFills().visit(testee)
    cache_dict = {c.name: c for c in transformed.caches}
    assert cache_dict["foo"].fill
    assert cache_dict["bar"].fill
    assert not cache_dict["baz"].fill
    assert not cache_dict["barbaz"].fill
Beispiel #2
0
 def _optimize_oir(self, oir):
     oir = GreedyMerging().visit(oir)
     oir = AdjacentLoopMerging().visit(oir)
     oir = LocalTemporariesToScalars().visit(oir)
     oir = WriteBeforeReadTemporariesToScalars().visit(oir)
     oir = OnTheFlyMerging().visit(oir)
     oir = NoFieldAccessPruning().visit(oir)
     oir = IJCacheDetection().visit(oir)
     oir = KCacheDetection().visit(oir)
     oir = PruneKCacheFills().visit(oir)
     oir = PruneKCacheFlushes().visit(oir)
     return oir
Beispiel #3
0
 def _optimize_oir(self, oir):
     oir = optimize_horizontal_executions(oir, GraphMerging)
     oir = AdjacentLoopMerging().visit(oir)
     oir = LocalTemporariesToScalars().visit(oir)
     oir = WriteBeforeReadTemporariesToScalars().visit(oir)
     oir = OnTheFlyMerging().visit(oir)
     oir = MaskStmtMerging().visit(oir)
     oir = NoFieldAccessPruning().visit(oir)
     oir = IJCacheDetection().visit(oir)
     oir = KCacheDetection().visit(oir)
     oir = PruneKCacheFills().visit(oir)
     oir = PruneKCacheFlushes().visit(oir)
     return oir