Skip to content

Commit

Permalink
Change behaviour of arrayConnect flag (#9908)
Browse files Browse the repository at this point in the history
- Don't enable `arrayConnect` flag for new backend by default.
- Always use the array connection handling if the `arrayConnect` flag is
  enabled.
- Remove the `arrayConnectMinSize` flag since it no longer has any
  purpose.
  • Loading branch information
perost committed Dec 9, 2022
1 parent d8355cf commit 9afd292
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 12 deletions.
3 changes: 1 addition & 2 deletions OMCompiler/Compiler/NFFrontEnd/NFFlatten.mo
Expand Up @@ -327,8 +327,7 @@ algorithm
execStat(getInstanceName());
InstUtil.dumpFlatModelDebug("flatten", flatModel);

if settings.arrayConnect and
FlatModel.hasArrayConnections(flatModel, Flags.getConfigInt(Flags.ARRAY_CONNECT_MIN_SIZE)) then
if settings.arrayConnect then
flatModel := resolveArrayConnections(flatModel);
else
flatModel := resolveConnections(flatModel, deleted_vars, settings);
Expand Down
1 change: 0 additions & 1 deletion OMCompiler/Compiler/NFFrontEnd/NFInst.mo
Expand Up @@ -240,7 +240,6 @@ function resetGlobalFlags
algorithm
if Flags.getConfigBool(Flags.NEW_BACKEND) then
FlagsUtil.set(Flags.NF_SCALARIZE, false);
FlagsUtil.set(Flags.ARRAY_CONNECT, true);
end if;

// gather here all the flags to disable expansion
Expand Down
5 changes: 0 additions & 5 deletions OMCompiler/Compiler/Util/Flags.mo
Expand Up @@ -1451,11 +1451,6 @@ constant ConfigFlag FRONTEND_INLINE = CONFIG_FLAG(154, "frontendInline",
NONE(), EXTERNAL(), BOOL_FLAG(false), NONE(),
Gettext.gettext("Enables inlining of functions in the frontend."));

constant ConfigFlag ARRAY_CONNECT_MIN_SIZE = CONFIG_FLAG(155, "arrayConnectMinSize",
NONE(), EXTERNAL(), INT_FLAG(100), NONE(),
Gettext.gettext("The minimum size of array connections for -d=arrayConnect to have effect"));


function getFlags
"Loads the flags with getGlobalRoot. Assumes flags have been loaded."
input Boolean initialize = true;
Expand Down
3 changes: 1 addition & 2 deletions OMCompiler/Compiler/Util/FlagsUtil.mo
Expand Up @@ -409,8 +409,7 @@ constant list<Flags.ConfigFlag> allConfigFlags = {
Flags.SIMULATION,
Flags.OBFUSCATE,
Flags.FMU_RUNTIME_DEPENDS,
Flags.FRONTEND_INLINE,
Flags.ARRAY_CONNECT_MIN_SIZE
Flags.FRONTEND_INLINE
};

public function new
Expand Down
2 changes: 1 addition & 1 deletion testsuite/flattening/modelica/scodeinst/ArrayConnect1.mo
@@ -1,7 +1,7 @@
// name: ArrayConnect1
// keywords:
// status: correct
// cflags: -d=newInst,arrayConnect,-nfScalarize --arrayConnectMinSize=10
// cflags: -d=newInst,arrayConnect,-nfScalarize
//

connector C
Expand Down
2 changes: 1 addition & 1 deletion testsuite/openmodelica/flatmodelica/SD.mo
@@ -1,7 +1,7 @@
// name: SD
// keywords:
// status: correct
// cflags: -d=newInst,-nfScalarize,arrayConnect,combineSubscripts -f --arrayConnectMinSize=3
// cflags: -d=newInst,-nfScalarize,arrayConnect,combineSubscripts -f
//

connector C
Expand Down

0 comments on commit 9afd292

Please sign in to comment.