Codegen should handle custom actors and actors that do not have adapters
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#342 From: @cxbrooks Reported version: 8.1.devel CC: [email protected]
If the code generator comes across a custom actor or an actor for which there is no codegen adapter, then the code generator should construct a stub which calls the custom actor.
This would mean that generated code would have a dependency on the Ptolemy II tree.
Generating code for custom actors that do not have templates is in progress.
We have a script at ptolemy/cg/kernel/generic/program/procedural/java/test/findAllSDFTests that looks at all the tests and find SDF models that might work with codegen. The output is:
All tests: 2289 All SDF tests: 1353 All SDF tests except cg, codegen, jai jmf: 694 SDF tests that are not in domains/*, except for domains/sdf: 417 SDF tests that have DE, FSM or PN: 17 SDF tests obviously use Matrices: 0 SDF tests that might work: 400 SDF tests that don't hang: 399
When we run the 399 tests, we generated code for 317 of them. Of the 317 tests for which we generated code, 167 used custom actors. Of the 167 custom actor tests, 107 failed and 60 passed.
The passed tests are:
AbsoluteValue AllColt ApplyFunction ArrayAppend3 ArrayContains ArrayLevelCrossing ArrayLevelCrossing2 ArrayRemoveElement Case2 ClassWrapper DeScrambler DelayTime ElementsToArray Equals FileWriter1 FileWriter2 Gaussian Gaussian1 Gaussian2 GradientAdaptiveLattice IIR Lattice LazyInnerClass LazyVariableBug LevinsonDurbin LevinsonDurbin2 LevinsonDurbin3 LookupTable MathFunction3 MaxIndex Maximum Multiplexor PhaseUnwrap PolarToComplexAndBack RampFiringLimitSDF ReadFile1 RecursiveLattice Scrambler1 Sinewave Sinewave2 Sinewave3 SleepMultipleFire StringCompare StringFunction StringLength StringMatches2 StringReplace StringSimpleReplace StringSubstring StringSubstring2 StringSubstring3 StringToIntArray Test ThrowModelError TokenToExpression UnaryMathFunction VariableSleep WallClockTime logic sizedarray1
The 107 failures are for models that use types such as UnsignedByte or ImageTokens that are not supported.
A common failure that we need to address is multirate actors. For example, the HadamardCode model fails in codegeneration:
Attempt to get data from an empty mailbox. in .HadamardCode.SequenceToArray2.HadamardCode_SequenceToArray2__actor.input at ptolemy.actor.AbstractReceiver.getArray(AbstractReceiver.java:155) at ptolemy.actor.IOPort.get(IOPort.java:995) at ptolemy.domains.sdf.lib.SequenceToArray.fire(SequenceToArray.java:156)