use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelFencerel method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
maxTupleSet = new TupleSet();
for (Thread t : task.getProgram().getThreads()) {
List<Event> fences = t.getCache().getEvents(FilterBasic.get(fenceName));
List<Event> memEvents = t.getCache().getEvents(FilterBasic.get(Tag.MEMORY));
for (Event fence : fences) {
int numEventsBeforeFence = (int) memEvents.stream().mapToInt(Event::getCId).filter(id -> id < fence.getCId()).count();
List<Event> eventsBefore = memEvents.subList(0, numEventsBeforeFence);
List<Event> eventsAfter = memEvents.subList(numEventsBeforeFence, memEvents.size());
for (Event e1 : eventsBefore) {
for (Event e2 : eventsAfter) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class BinaryRelation method addEncodeTupleSet.
@Override
public void addEncodeTupleSet(TupleSet tuples) {
// Not valid for composition
TupleSet activeSet = new TupleSet(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
encodeTupleSet.addAll(activeSet);
activeSet.removeAll(getMinTupleSet());
if (!activeSet.isEmpty()) {
r1.addEncodeTupleSet(activeSet);
r2.addEncodeTupleSet(activeSet);
}
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelComposition method getMinTupleSet.
@Override
public TupleSet getMinTupleSet() {
if (minTupleSet == null) {
ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
minTupleSet = r1.getMinTupleSet().postComposition(r2.getMinTupleSet(), (t1, t2) -> exec.isImplied(t1.getFirst(), t1.getSecond()) || exec.isImplied(t2.getSecond(), t1.getSecond()));
removeMutuallyExclusiveTuples(minTupleSet);
}
return minTupleSet;
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelComposition method getMaxTupleSetRecursive.
@Override
public TupleSet getMaxTupleSetRecursive() {
if (recursiveGroupId > 0 && maxTupleSet != null) {
ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
maxTupleSet = r1.getMaxTupleSetRecursive().postComposition(r2.getMaxTupleSetRecursive(), (t1, t2) -> !exec.areMutuallyExclusive(t1.getFirst(), t2.getSecond()));
return maxTupleSet;
}
return getMaxTupleSet();
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelComposition method addEncodeTupleSet.
@Override
public void addEncodeTupleSet(TupleSet tuples) {
Set<Tuple> activeSet = new HashSet<>(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
encodeTupleSet.addAll(activeSet);
activeSet.removeAll(getMinTupleSet());
if (!activeSet.isEmpty()) {
TupleSet r1Set = new TupleSet();
TupleSet r2Set = new TupleSet();
TupleSet r1Max = r1.getMaxTupleSet();
TupleSet r2Max = r2.getMaxTupleSet();
for (Tuple t : activeSet) {
Event e1 = t.getFirst();
Event e3 = t.getSecond();
for (Tuple t1 : r1Max.getByFirst(e1)) {
Event e2 = t1.getSecond();
Tuple t2 = new Tuple(e2, e3);
if (r2Max.contains(t2)) {
r1Set.add(t1);
r2Set.add(t2);
}
}
}
r1.addEncodeTupleSet(r1Set);
r2.addEncodeTupleSet(r2Set);
}
}
Aggregations