Commit 9d72f317 authored by dino's avatar dino
Browse files

Minor changes in the macro to align the arrays to use the SSE extensions

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1118 170316e4-aea8-4b27-aad4-0380ec0519c9
parent b76bb0ad
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
#include "SignalBasis.h" #include "SignalBasis.h"
#ifdef USE_SSE_VERSION // defined in GridSearchParams.h #ifdef USE_SSE_VERSION // defined in GridSearchParams.h
#include <xmmintrin.h> #include <tmmintrin.h> // SS3 and all preceding stuff
#include <tmmintrin.h>
#endif #endif
//#define SPECMETRICS // to produce specMetrics in SearchFullGrid and SearchAdaptive ==> will be very slow and is not thread-safe //#define SPECMETRICS // to produce specMetrics in SearchFullGrid and SearchAdaptive ==> will be very slow and is not thread-safe
......
...@@ -7,15 +7,16 @@ ...@@ -7,15 +7,16 @@
#include <cmath> #include <cmath>
#include <string.h> #include <string.h>
// macro for aligning data on 16 byte boundary (page 109 in agner.org/optimize/optimizing_cpp.pfd)
#ifndef USE_SSE_VERSION #ifndef USE_SSE_VERSION
# define GS_MEMALIGN_16 # define GSALIGN16(vv) vv
#else #else
# if defined(__GNUC__) # if defined(__GNUC__)
# define GS_MEMALIGN_16 __attribute__((aligned(16))) # define GSALIGN16(vv) vv __attribute__((aligned(16)))
# elif defined(_MSC_VER) # elif defined(_MSC_VER)
# define GS_MEMALIGN_16 __declspec(align(16)) # define GSALIGN16(vv) __declspec(align(16)) vv
# else # else
# define GS_MEMALIGN_16 # define GSALIGN16(vv) vv
# endif # endif
#endif #endif
...@@ -43,16 +44,15 @@ enum ENextXYZ {kNextMx=0, kNextPx=1, kNextMy=2, kNextPy=3, kNextMz=4, kNextPz=5} ...@@ -43,16 +44,15 @@ enum ENextXYZ {kNextMx=0, kNextPx=1, kNextMy=2, kNextPy=3, kNextMz=4, kNextPz=5}
class pointPsa class pointPsa
{ {
public: public:
float x, y, z; // coordinates of the interaction (mm) float x, y, z; // coordinates of the interaction (mm)
int netChargeSegment; // its net-charge segment int netChargeSegment; // its net-charge segment
GS_MEMALIGN_16 // compiler-specific alignment directive GSALIGN16(float amplitude[TCHAN][NTIME]); // 36 segments + CC + non differentiated copies of net-charge segment and the core
float amplitude[TCHAN][NTIME]; // 36 segments + CC + non differentiated copies of net-charge segment and the core int addr_first; // valid/useful start of the amplitude
int addr_first; // valid/useful start of the amplitude int addr_last; // valid/useful last of the amplitude (margin included)
int addr_last; // valid/useful last of the amplitude (margin included) float sumTransients; // sum of all transient signals
float sumTransients; // sum of all transient signals float sumDiffNetSeg; // area of the differentiated net-charge segment
float sumDiffNetSeg; // area of the differentiated net-charge segment int nextXYZ[6]; // [ixM, ixP, iyM, iyP, izM, izP] cartesian axis neighbours in the same segment (-1 if not existing)
int nextXYZ[6]; // [ixM, ixP, iyM, iyP, izM, izP] cartesian axis neighbours in the same segment (-1 if not existing) //int nextAll[numNeigh]; // all neigbours of a point; first is the point itself
//int nextAll[numNeigh]; // all neigbours of a point; first is the point itself
bool isFullCharge; // the net charge signal has reached full amplitude (the 2 bool moved here to get 40 bytes) bool isFullCharge; // the net charge signal has reached full amplitude (the 2 bool moved here to get 40 bytes)
bool isInnerPoint; // the point is not on the boundary of the segment bool isInnerPoint; // the point is not on the boundary of the segment
...@@ -408,14 +408,11 @@ public: ...@@ -408,14 +408,11 @@ public:
int numNetCharges; int numNetCharges;
int netChargeSegnum[NSEGS]; // normally given in the order of energy release int netChargeSegnum[NSEGS]; // normally given in the order of energy release
float netChargeEnergy[NSEGS]; float netChargeEnergy[NSEGS];
GS_MEMALIGN_16
float tAmplitude[TCHAN][NTIME]; // the total original experimental data GSALIGN16(float tAmplitude[TCHAN][NTIME]); // the total original experimental data
GS_MEMALIGN_16 GSALIGN16(float wAmplitude[TCHAN][NTIME]); // the experimental data to be used and modified by the grid search
float wAmplitude[TCHAN][NTIME]; // the experimental data to be used and modified by the grid search GSALIGN16(float sAmplitude[TCHAN][NTIME]); // experimental trace manipulated for being used by the "chi2" loops
GS_MEMALIGN_16 GSALIGN16(float rAmplitude[TCHAN][NTIME]); // the "fitted" trace
float sAmplitude[TCHAN][NTIME]; // experimental trace manipulated for being used by the "chi2" loops
GS_MEMALIGN_16
float rAmplitude[TCHAN][NTIME]; // the "fitted" trace
int resPt1[NSEGS]; // the best 1st solution point for the numNetCharges segments int resPt1[NSEGS]; // the best 1st solution point for the numNetCharges segments
int resPt2[NSEGS]; // the best 2nd solution point " int resPt2[NSEGS]; // the best 2nd solution point "
......
...@@ -52,12 +52,16 @@ const float MAXNORM = 1000.f; // normalization of the signal basis ...@@ -52,12 +52,16 @@ const float MAXNORM = 1000.f; // normalization of the signal basis
// We should check this in PSAFilterGridSearch or, maybe, go back to the formulation by // We should check this in PSAFilterGridSearch or, maybe, go back to the formulation by
// Roberto Venturelli where the experimental signal is rescaled event-by-event to MAXNORM. // Roberto Venturelli where the experimental signal is rescaled event-by-event to MAXNORM.
#ifdef HAS_AGAPROCONFIG // This define should be managed at the project level (VC or cmake -DUSE_SSE_VERSION=1 or CmakeLists.txt)
#ifdef HAS_SSE // However, during development it is convenient to control it directly to avoid full recompilation if changing the project)
#define USE_SSE_VERSION // automatic through cmake #if 0
#endif #ifdef HAS_AGAPROCONFIG
#else #ifdef HAS_SSE
#define USE_SSE_VERSION // uncomment to use SSE intrinsics for the innermost figure-of-merit loop #define USE_SSE_VERSION // automatic through cmake
#endif
#else
#define USE_SSE_VERSION // uncomment to use SSE intrinsics for the innermost figure-of-merit loop
#endif
#endif #endif
// the vectorized version only for the standard values .._MODULO, .._SQUARE, .._1SQRT, .._2SQRT // the vectorized version only for the standard values .._MODULO, .._SQUARE, .._1SQRT, .._2SQRT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment