[arrayfire] 27/408: Reduce size of Array<T> by rearranging mem vars

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 67d0f602def70ae46b1eab1cd8b6e92ab32ef5a3
Author: Umar Arshad <umar at arrayfire.com>
Date:   Sun Jun 21 01:35:37 2015 -0400

    Reduce size of Array<T> by rearranging mem vars
---
 src/backend/cpu/Array.cpp    | 10 +++++-----
 src/backend/cpu/Array.hpp    |  6 +++---
 src/backend/cuda/Array.cpp   | 12 ++++++------
 src/backend/cuda/Array.hpp   |  4 ++--
 src/backend/opencl/Array.cpp | 12 ++++++------
 src/backend/opencl/Array.hpp |  4 ++--
 6 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/backend/cpu/Array.cpp b/src/backend/cpu/Array.cpp
index 716715a..bdb0954 100644
--- a/src/backend/cpu/Array.cpp
+++ b/src/backend/cpu/Array.cpp
@@ -29,14 +29,14 @@ namespace cpu
     Array<T>::Array(dim4 dims):
         info(getActiveDeviceId(), dims, dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(memAlloc<T>(dims.elements()), memFree<T>), data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     { }
 
     template<typename T>
     Array<T>::Array(dim4 dims, const T * const in_data):
         info(getActiveDeviceId(), dims, dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(memAlloc<T>(dims.elements()), memFree<T>), data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
         static_assert(std::is_standard_layout<Array<T>>::value, "Array<T> must be a standard layout type");
         std::copy(in_data, in_data + dims.elements(), data.get());
@@ -47,7 +47,7 @@ namespace cpu
     Array<T>::Array(af::dim4 dims, TNJ::Node_ptr n) :
         info(-1, dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(), data_dims(dims),
-        node(n), ready(false), offset(0), owner(true)
+        node(n), offset(0), ready(false), owner(true)
     {
     }
 
@@ -55,9 +55,9 @@ namespace cpu
     Array<T>::Array(const Array<T>& parent, const dim4 &dims, const dim4 &offsets, const dim4 &strides) :
         info(parent.getDevId(), dims, offsets, strides, (af_dtype)dtype_traits<T>::af_type),
         data(parent.getData()), data_dims(parent.getDataDims()),
-        node(), ready(true),
+        node(),
         offset(parent.getOffset() + calcOffset(parent.strides(), offsets)),
-        owner(false)
+        ready(true), owner(false)
     { }
 
     template<typename T>
diff --git a/src/backend/cpu/Array.hpp b/src/backend/cpu/Array.hpp
index 47e5d0e..43304a1 100644
--- a/src/backend/cpu/Array.hpp
+++ b/src/backend/cpu/Array.hpp
@@ -81,16 +81,16 @@ namespace cpu
     template<typename T>
     class Array
     {
-         ArrayInfo info;
+        ArrayInfo info; // Must be the first element of Array<T>
         //TODO: Generator based array
 
         //data if parent. empty if child
         std::shared_ptr<T> data;
         af::dim4 data_dims;
-
         TNJ::Node_ptr node;
-        bool ready;
+
         dim_t offset;
+        bool ready;
         bool owner;
 
         Array() = default;
diff --git a/src/backend/cuda/Array.cpp b/src/backend/cuda/Array.cpp
index f881fa4..f62fbc6 100644
--- a/src/backend/cuda/Array.cpp
+++ b/src/backend/cuda/Array.cpp
@@ -30,7 +30,7 @@ namespace cuda
     Array<T>::Array(af::dim4 dims) :
         info(getActiveDeviceId(), dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(memAlloc<T>(dims.elements()), memFree<T>), data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {}
 
     template<typename T>
@@ -38,7 +38,7 @@ namespace cuda
         info(getActiveDeviceId(), dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data((is_device ? (T *)in_data : memAlloc<T>(dims.elements())), memFree<T>),
         data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
 #if __cplusplus > 199711L
         static_assert(std::is_standard_layout<Array<T>>::value, "Array<T> must be a standard layout type");
@@ -52,9 +52,9 @@ namespace cuda
     Array<T>::Array(const Array<T>& parent, const dim4 &dims, const dim4 &offsets, const dim4 &strides) :
         info(parent.getDevId(), dims, offsets, strides, (af_dtype)dtype_traits<T>::af_type),
         data(parent.getData()), data_dims(parent.getDataDims()),
-        node(), ready(true),
+        node(),
         offset(parent.getOffset() + calcOffset(parent.strides(), offsets)),
-        owner(false)
+        ready(true), owner(false)
     { }
 
     template<typename T>
@@ -65,7 +65,7 @@ namespace cuda
                   (af_dtype)dtype_traits<T>::af_type),
         data(tmp.ptr, memFree<T>),
         data_dims(af::dim4(tmp.dims[0], tmp.dims[1], tmp.dims[2], tmp.dims[3])),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
     }
 
@@ -73,7 +73,7 @@ namespace cuda
     Array<T>::Array(af::dim4 dims, JIT::Node_ptr n) :
         info(-1, dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(), data_dims(dims),
-        node(n), ready(false), offset(0), owner(true)
+        node(n), offset(0), ready(false), owner(true)
     {
     }
 
diff --git a/src/backend/cuda/Array.hpp b/src/backend/cuda/Array.hpp
index 8ce2a38..b5d5ea3 100644
--- a/src/backend/cuda/Array.hpp
+++ b/src/backend/cuda/Array.hpp
@@ -95,13 +95,13 @@ namespace cuda
     template<typename T>
     class Array
     {
-        ArrayInfo       info;
+        ArrayInfo       info; // This must be the first element of Array<T>
         shared_ptr<T> data;
         af::dim4 data_dims;
 
         JIT::Node_ptr node;
-        bool ready;
         dim_t offset;
+        bool ready;
         bool owner;
 
         Array(af::dim4 dims);
diff --git a/src/backend/opencl/Array.cpp b/src/backend/opencl/Array.cpp
index 94069a8..b0ae226 100644
--- a/src/backend/opencl/Array.cpp
+++ b/src/backend/opencl/Array.cpp
@@ -31,7 +31,7 @@ namespace opencl
         info(getActiveDeviceId(), dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(bufferAlloc(info.elements() * sizeof(T)), bufferFree),
         data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
     }
 
@@ -40,7 +40,7 @@ namespace opencl
         info(-1, dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(),
         data_dims(dims),
-        node(n), ready(false), offset(0), owner(true)
+        node(n), offset(0), ready(false), owner(true)
     {
     }
 
@@ -49,7 +49,7 @@ namespace opencl
         info(getActiveDeviceId(), dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(bufferAlloc(info.elements()*sizeof(T)), bufferFree),
         data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
         static_assert(std::is_standard_layout<Array<T>>::value, "Array<T> must be a standard layout type");
         getQueue().enqueueWriteBuffer(*data.get(), CL_TRUE, 0, sizeof(T)*info.elements(), in_data);
@@ -60,7 +60,7 @@ namespace opencl
         info(getActiveDeviceId(), dims, af::dim4(0,0,0,0), calcStrides(dims), (af_dtype)dtype_traits<T>::af_type),
         data(new cl::Buffer(mem), bufferFree),
         data_dims(dims),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
     }
 
@@ -70,8 +70,8 @@ namespace opencl
         data(parent.getData()),
         data_dims(parent.getDataDims()),
         node(),
-        ready(true),
         offset(parent.getOffset() + calcOffset(parent.strides(), offsets)),
+        ready(true),
         owner(false)
     { }
 
@@ -85,7 +85,7 @@ namespace opencl
                   (af_dtype)dtype_traits<T>::af_type),
         data(tmp.data, bufferFree),
         data_dims(af::dim4(tmp.info.dims[0], tmp.info.dims[1], tmp.info.dims[2], tmp.info.dims[3])),
-        node(), ready(true), offset(0), owner(true)
+        node(), offset(0), ready(true), owner(true)
     {
     }
 
diff --git a/src/backend/opencl/Array.hpp b/src/backend/opencl/Array.hpp
index 7169f09..77c3dcc 100644
--- a/src/backend/opencl/Array.hpp
+++ b/src/backend/opencl/Array.hpp
@@ -85,13 +85,13 @@ namespace opencl
     template<typename T>
     class Array
     {
-        ArrayInfo info;
+        ArrayInfo info; // This must be the first element of Array<T>
         Buffer_ptr  data;
         af::dim4 data_dims;
 
         JIT::Node_ptr node;
-        bool ready;
         dim_t offset;
+        bool ready;
         bool owner;
 
         Array(af::dim4 dims);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list