EwBinary codegen broadcasting tests #922
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds some test cases for #920.
The existing tests have been renamed and a new test for row and column broadcasting has been added.
EwBinary codegen supports broadcasting for all functions that use the
BinaryOpLoweringtemplate (at the point of writing this includesEwAdd,EwSub,EwMul,EwDiv,EwMin,EwMax). The operand that is broadcast is assumed to be rhs.Singletons (1x1 dense matrices) are broadcast to the entire rhs matrix, whereas row/column vectors must have size 1 in the dimension that is broadcast and match
lhsin the other dimension. Thus,2x3+2x1would be valid dimensions where the rows ofrhsare broadcast along the columns oflhs, i.e. all values in the first row oflhsare respectively combined with the value in the first row ofrhs.If dimensions do not match, a compiler error is thrown:
Currently, the changes trigger some issue with
runDaphnewithinEwBinaryTest. The issue seems to be unrelated to the new tests and causes the tests to run indefinitely (running./test.sh [codegen]). From what I can tell, execution withintest/api/cli/Utils.hinrunProgramgets blocked at the firstdup2call at l.117. This might be similar to the issue described in #675 which were first fixed with c2900a3 .