use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelTrans method getFullEncodeTupleSet.
private TupleSet getFullEncodeTupleSet(TupleSet tuples) {
TupleSet processNow = new TupleSet(Sets.intersection(tuples, getMaxTupleSet()));
TupleSet result = new TupleSet();
while (!processNow.isEmpty()) {
TupleSet processNext = new TupleSet();
result.addAll(processNow);
for (Tuple tuple : processNow) {
Event e1 = tuple.getFirst();
Event e2 = tuple.getSecond();
for (Tuple t : r1.getMaxTupleSet().getByFirst(e1)) {
Event e3 = t.getSecond();
if (e3.getCId() != e1.getCId() && e3.getCId() != e2.getCId() && transitiveReachabilityMap.get(e3).contains(e2)) {
result.add(new Tuple(e1, e3));
processNext.add(new Tuple(e3, e2));
}
}
}
processNext.removeAll(result);
processNow = processNext;
}
return result;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelInt method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
maxTupleSet = new TupleSet();
for (Thread t : task.getProgram().getThreads()) {
List<Event> events = t.getCache().getEvents(FilterBasic.get(Tag.VISIBLE));
for (Event e1 : events) {
for (Event e2 : events) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelPo method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
maxTupleSet = new TupleSet();
for (Thread t : task.getProgram().getThreads()) {
List<Event> events = t.getCache().getEvents(filter);
for (int i = 0; i < events.size(); i++) {
Event e1 = events.get(i);
for (int j = i + 1; j < events.size(); j++) {
Event e2 = events.get(j);
maxTupleSet.add(new Tuple(e1, e2));
}
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class TupleSet method preComposition.
// TODO: Make clear through which tuple set is iterated first/second
// This can make a big difference because getByFirst/Second needs to be recomputed
// if the corresponding tuple set is changed (e.g. by repeated composition)
public TupleSet preComposition(TupleSet tuples) {
TupleSet result = new TupleSet();
for (Tuple t1 : tuples) {
Event e1 = t1.getFirst();
Event e2 = t1.getSecond();
for (Tuple t2 : this.getByFirst(e2)) {
Event e3 = t2.getSecond();
result.add(new Tuple(e1, e3));
}
}
return result;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class TupleSet method approximateTransitiveMustReduction.
// =============== Static utility functions =================
public static TupleSet approximateTransitiveMustReduction(ExecutionAnalysis exec, TupleSet minSet) {
// Approximative must-transitive reduction of minSet:
TupleSet reduct = new TupleSet();
Iterable<Event> codomain = Iterables.transform(minSet, Tuple::getSecond);
DependencyGraph<Event> depGraph = DependencyGraph.from(codomain, e -> Iterables.transform(minSet.getBySecond(e), Tuple::getFirst));
for (DependencyGraph<Event>.Node start : depGraph.getNodes()) {
Event e1 = start.getContent();
List<DependencyGraph<Event>.Node> deps = start.getDependents();
for (int i = deps.size() - 1; i >= 0; i--) {
DependencyGraph<Event>.Node end = deps.get(i);
Event e3 = end.getContent();
boolean redundant = false;
for (DependencyGraph<Event>.Node mid : deps.subList(0, i)) {
Event e2 = mid.getContent();
if (exec.isImplied(e1, e2) || exec.isImplied(e3, e2)) {
if (minSet.contains(new Tuple(e2, e3))) {
redundant = true;
break;
}
}
}
if (!redundant) {
reduct.add(new Tuple(e1, e3));
}
}
}
return reduct;
}
Aggregations