public AstReadNotifyNodeBuilder() { this(new AstReadNotifyNode()); }
public AstReadNotifyNodeBuilder setBarrierName(String barrierName) { node.setBarrierName(barrierName); return this; }
@Override public AstReadNotifyNode visitReadNotifyNode(ReadNotifyNodeContext ctx) { node = new AstReadNotifyNode(); node.setRegionInfo(asSequentialRegion(childInfos, ctx)); node.setBarrierName(ctx.Name().getText()); return node; }
@Override public Configuration visit(AstReadNotifyNode node, State state) { RegionInfo regionInfo = node.getRegionInfo(); String barrierName = node.getBarrierName(); Barrier barrier = state.lookupBarrier(barrierName); NotifyBarrierHandler handler = new NotifyBarrierHandler(barrier); handler.setRegionInfo(regionInfo); Map<String, ChannelHandler> pipelineAsMap = state.pipelineAsMap; String handlerName = String.format("read.notify#%d", pipelineAsMap.size() + 1); pipelineAsMap.put(handlerName, handler); state.configuration.getBarriers().add(barrier); return state.configuration; }
@Override protected void describe(StringBuilder buf) { super.describe(buf); buf.append(format("read notify %s\n", getBarrierName())); } }
@Override public AstReadNotifyNode visitReadNotifyNode(ReadNotifyNodeContext ctx) { AstReadNotifyNodeVisitor visitor = new AstReadNotifyNodeVisitor(factory, environment); AstReadNotifyNode readNotifyNode = visitor.visitReadNotifyNode(ctx); if (readNotifyNode != null) { childInfos().add(readNotifyNode.getRegionInfo()); } return readNotifyNode; }
private void conditionallyInjectWriteBarrier(State state, RegionInfo regionInfo) { List<AstStreamableNode> streamables = state.streamables; switch (state.readWriteState) { case READ: String barrierName = String.format("~read~write~%d", ++state.readWriteBarrierCount); AstReadNotifyNode readNotify = new AstReadNotifyNode(); readNotify.setRegionInfo(regionInfo); readNotify.setBarrierName(barrierName); AstWriteAwaitNode writeAwait = new AstWriteAwaitNode(); writeAwait.setRegionInfo(regionInfo); writeAwait.setBarrierName(barrierName); streamables.add(readNotify); streamables.add(writeAwait); break; default: break; } }
public StreamNested(R builder) { super(new AstReadNotifyNode(), builder); }
public StreamNested<R> setBarrierName(String barrierName) { node.setBarrierName(barrierName); return this; }