You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2018/02/14 06:33:50 UTC
systemml git commit: [MINOR] Improved handling of commutative binary
codegen operations
Repository: systemml
Updated Branches:
refs/heads/master 7aa9cca7b -> beb704e2d
[MINOR] Improved handling of commutative binary codegen operations
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/beb704e2
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/beb704e2
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/beb704e2
Branch: refs/heads/master
Commit: beb704e2dc1fe2d42a1a9d6cb6d4563f37623863
Parents: 7aa9cca
Author: Matthias Boehm <mb...@gmail.com>
Authored: Tue Feb 13 18:01:44 2018 -0800
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Tue Feb 13 18:01:44 2018 -0800
----------------------------------------------------------------------
.../org/apache/sysml/hops/codegen/cplan/CNodeBinary.java | 9 ++++++---
.../apache/sysml/runtime/codegen/LibSpoofPrimitives.java | 11 +++--------
2 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/beb704e2/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java b/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
index 89ddde4..d1343c2 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
@@ -63,12 +63,15 @@ public class CNodeBinary extends CNode
public boolean isCommutative() {
boolean ssComm = (this==EQUAL || this==NOTEQUAL
- || this==PLUS || this==MULT || this==MIN || this==MAX);
+ || this==PLUS || this==MULT || this==MIN || this==MAX
+ || this==OR || this==AND || this==XOR || this==BITWAND);
boolean vsComm = (this==VECT_EQUAL_SCALAR || this==VECT_NOTEQUAL_SCALAR
|| this==VECT_PLUS_SCALAR || this==VECT_MULT_SCALAR
- || this==VECT_MIN_SCALAR || this==VECT_MAX_SCALAR);
+ || this==VECT_MIN_SCALAR || this==VECT_MAX_SCALAR
+ || this==VECT_XOR_SCALAR || this==VECT_BITWAND_SCALAR );
boolean vvComm = (this==VECT_EQUAL || this==VECT_NOTEQUAL
- || this==VECT_PLUS || this==VECT_MULT || this==VECT_MIN || this==VECT_MAX);
+ || this==VECT_PLUS || this==VECT_MULT || this==VECT_MIN || this==VECT_MAX
+ || this==VECT_XOR || this==BinType.VECT_BITWAND);
return ssComm || vsComm || vvComm;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/beb704e2/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java b/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
index 30855ad..fe34507 100644
--- a/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
+++ b/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
@@ -580,8 +580,7 @@ public class LibSpoofPrimitives
}
public static void vectXorAdd(double bval, double[] a, double[] c, int ai, int ci, int len) {
- for( int j = ai; j < ai+len; j++, ci++)
- c[ci] += ( (bval != 0) != (a[j] != 0) ) ? 1 : 0;
+ vectXorAdd(a, bval, c, ai, ci, len);
}
public static void vectXorAdd(double[] a, double bval, double[] c, int[] aix, int ai, int ci, int alen, int len) {
@@ -590,8 +589,7 @@ public class LibSpoofPrimitives
}
public static void vectXorAdd(double bval, double[] a, double[] c, int[] aix, int ai, int ci, int alen, int len) {
- for( int j = ai; j < ai+alen; j++ )
- c[ci + aix[j]] += ( (bval != 0) != (a[j] != 0) ) ? 1 : 0;
+ vectXorAdd(a, bval, c, aix, ai, ci, alen, len);
}
//1. scalar vs. dense vector
@@ -604,10 +602,7 @@ public class LibSpoofPrimitives
//2. dense vector vs. scalar
public static double[] vectXorWrite(double bval, double[] a, int ai, int len) {
- double[] c = allocVector(len, false);
- for( int j = 0; j < len; j++)
- c[j] = ( (bval != 0) != (a[ai + j] != 0) ) ? 1 : 0;
- return c;
+ return vectXorWrite(a, bval, ai, len);
}
//3. dense vector vs. dense vector