Commit 61dc6ff8 authored by Christian Fuß's avatar Christian Fuß
Browse files

put timeParameter in correct scope for use in EMADL

parent 6c7d85c5
Pipeline #175783 passed with stages
in 20 minutes and 11 seconds
......@@ -355,6 +355,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
optArgument.ifPresent(arguments::add);
}
layer.setArguments(arguments);
layer.setTimeParameter((ParameterSymbol)ast.getTimeParameter().getSymbolOpt().get());
removeCurrentScope();
}
......
......@@ -148,6 +148,7 @@ public class UnrollDeclarationSymbol extends CommonScopeSpanningSymbol {
copy.setAstNode(getAstNode().get());
}
System.err.println("parameters to copy: " + getParameters());
List<ParameterSymbol> parameterCopies = new ArrayList<>(getParameters().size());
for (ParameterSymbol parameter : getParameters()){
ParameterSymbol parameterCopy = parameter.deepCopy();
......
......@@ -137,7 +137,6 @@ public class UnrollSymbol extends CommonScopeSpanningSymbol {
getBody().resolveOrError();
UnrollSymbol resolvedUnroll = getDeclaration().call(this);
setResolvedThis(resolvedUnroll);
}
}
return new HashSet<ParameterSymbol>() ;
......@@ -288,9 +287,31 @@ public class UnrollSymbol extends CommonScopeSpanningSymbol {
for (ArgumentSymbol argument : getArguments()){
args.add(argument.preResolveDeepCopy());
}
copy.setDeclaration(getDeclaration());
List<ParameterSymbol> parameterCopies = new ArrayList<>(getDeclaration().getParameters().size());
for (ParameterSymbol parameter : getDeclaration().getParameters()){
ParameterSymbol parameterCopy = parameter.deepCopy();
parameterCopies.add(parameterCopy);
parameterCopy.putInScope(copy.getSpannedScope());
}
copy.getDeclaration().setParameters(parameterCopies);
copy.setArguments(args);
copy.setTimeParameter(getTimeParameter().deepCopy());
//System.err.println("t2: " + this.getIntValue(AllPredefinedLayers.BEAMSEARCH_T_NAME));
// TODO: currently only the defaultValue for t is used, make it use the assigned value instead
((ParameterSymbol)((ArrayList<Symbol>)getSpannedScope().getLocalSymbols().get("t")).get(0)).getExpression().setValue(this.getIntValue(AllPredefinedLayers.BEAMSEARCH_T_NAME));
System.err.println("t_value: " + ((ParameterSymbol)((ArrayList<Symbol>)getSpannedScope().getLocalSymbols().get("t")).get(0)).getValue().get().toString());
copy.getTimeParameter().putInScope(getSpannedScope());
copy.setBody(getBody().preResolveDeepCopy());
copy.getBody().putInScope(copy.getSpannedScope());
//TODO: Find a nicer way to put the timeParameter into the unroll elements' scope
for(ArchitectureElementSymbol element: copy.getBody().getElements()){
element.getSpannedScope().add(copy.getTimeParameter());
}
return copy;
}
......
......@@ -107,6 +107,7 @@ public class BeamSearchStart extends PredefinedUnrollDeclaration {
new ParameterSymbol.Builder()
.name(AllPredefinedLayers.BEAMSEARCH_T_NAME)
.constraints(Constraints.INTEGER, Constraints.NON_NEGATIVE)
.defaultValue(0)
.build(),
new ParameterSymbol.Builder()
.name(AllPredefinedLayers.BEAMSEARCH_WIDTH_NAME)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment