Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Support vectorized flow connectors #2768

Closed
wants to merge 7 commits into from
Closed

Support vectorized flow connectors #2768

wants to merge 7 commits into from

Conversation

rfranke
Copy link
Member

@rfranke rfranke commented Nov 6, 2018

No description provided.

@OpenModelica-Hudson
Copy link
Member

The job failed to compile; for details, see OpenModelica_TEST_PULL_REQUEST 2018-11-06_21-50-47.

@OpenModelica-Hudson
Copy link
Member

The job failed to compile; for details, see OpenModelica_TEST_PULL_REQUEST 2018-11-06_22-30-47.

@adrpo
Copy link
Member

adrpo commented Nov 6, 2018

@rfranke very strange error you're getting:

clang -O2 -march=native -fno-stack-protector -fPIC  -Wno-parentheses-equality -Wno-unused-variable -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -I/var/lib/hudson/slave/workspace/OpenModelica_TEST_PULL_REQUEST/OpenModelica/build/include/omc/c -I../Util/  -DADD_METARECORD_DEFINITIONS=  -c -o build/InstStateMachineUtil.o build/InstStateMachineUtil.c
/var/lib/hudson/slave/workspace/OpenModelica_TEST_PULL_REQUEST/OpenModelica/OMCompiler/Compiler/FrontEnd/InstStateMachineUtil.mo:841:31: error: expected expression
  create_index_spec(&tmp4, 0, );
                              ^
1 error generated.
<builtin>: recipe for target 'build/InstStateMachineUtil.o' failed
make[5]: *** [build/InstStateMachineUtil.o] Error 1
make[5]: Leaving directory '/var/lib/hudson/slave/workspace/OpenModelica_TEST_PULL_REQUEST/OpenModelica/OMCompiler/Compiler/boot'
make[5]: *** Waiting for unfinished jobs....

@adrpo
Copy link
Member

adrpo commented Nov 6, 2018

You shouldn't get such C code from MetaModelica, only from Modelica with array slice indexes.
What is even stranger is that you haven't touched that file.

- split array connectors into variables and keep dimensions
- enhanced generation of for equations
- add unconnected flow variables after connections to sets
  to get the right dimensions of connections
- assign to array slices in for loops
- omit subscripts within array names
- usub_array supports multiple dimensions
@adrpo
Copy link
Member

adrpo commented Nov 6, 2018

In my compiler I get this code for incidence := fill(false,n,n); in InstStateMachineUtil.mo:841:

#line 841 "C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/FrontEnd/InstStateMachineUtil.mo"
  tmp2 = 0;
#line 841 "C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/FrontEnd/InstStateMachineUtil.mo"
  fill_alloc_boolean_array(&tmp3, tmp2, 2, (modelica_integer)_n, (modelica_integer)_n);
#line 841 "C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/FrontEnd/InstStateMachineUtil.mo"
  copy_boolean_array_data(tmp3, &_incidence);

In your PR some bad code is generated using create_index_spec.

@OpenModelica-Hudson
Copy link
Member

The job failed to compile; for details, see OpenModelica_TEST_PULL_REQUEST 2018-11-06_22-57-39.

@adrpo
Copy link
Member

adrpo commented Nov 6, 2018

The problem is in your changes to SimCodeFunctionUtil.crefSubIsScalar:
https://github.com/OpenModelica/OMCompiler/pull/2768/files#diff-09259109af7756dbab462753cb372f0bR83
In the case of incidence = fill(false, n, n) you get listLength(subs) = 0 and listLength(dims) = 2 and instead of returning true you return false.

@rfranke
Copy link
Member Author

rfranke commented Nov 7, 2018

OK, I interpreted the function crefSubIsScalar wrong. I thought it should determine if a cref refers to a scalar. This applies to scalars and to array crefs with a scalar subscript for each dimension that are reduced to a scalar in this case. This is why I added a check for the number of dimensions.

It seems the function I'm looking for is ComponentReference.crefHasScalarSubscripts.

@OpenModelica-Hudson
Copy link
Member

The test suite is unstable according to OpenModelica_TEST_PULL_REQUEST 2018-11-07_11-46-32.

@OpenModelica-Hudson
Copy link
Member

The tests run correctly according to OpenModelica_TEST_PULL_REQUEST 2018-11-07_13-37-01.

OpenModelica-Hudson pushed a commit that referenced this pull request Nov 7, 2018
- split array connectors into variables and keep dimensions
- enhanced generation of for equations
- add unconnected flow variables after connections to sets
  to get the right dimensions of connections

Belonging to [master]:
  - #2768
  - OpenModelica/OpenModelica-testsuite#1070
OpenModelica-Hudson pushed a commit that referenced this pull request Nov 7, 2018
OpenModelica-Hudson pushed a commit that referenced this pull request Nov 7, 2018
- assign to array slices in for loops
- omit subscripts within array names
- usub_array supports multiple dimensions

Belonging to [master]:
  - #2768
  - OpenModelica/OpenModelica-testsuite#1070
OpenModelica-Hudson pushed a commit that referenced this pull request Nov 7, 2018
The remaining dimensions are treated as whole dim.

Belonging to [master]:
  - #2768
  - OpenModelica/OpenModelica-testsuite#1070
OpenModelica-Hudson pushed a commit to OpenModelica/OpenModelica-testsuite that referenced this pull request Nov 7, 2018
@rfranke rfranke deleted the vecflow branch November 8, 2018 09:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants