Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other.

Similar presentations


Presentation on theme: "INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other."— Presentation transcript:

1 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 1/ ::Mask cannot be translated – hence some source code modifications in declaration/definition…: template … template > inline __attribute__((always_inline)) typename VectorType::Mask determineRHit( VectorType const & /*x- vec*/, VectorType const & /*y-vec*/, … inline __attribute__((always_inline)) int determineRHitav( T const & /*x-vec*/, T const & /*y-vec*/, T const & /*z-vec*/,

2 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 2/ Source code is still too adherent to Vc Ex PointIsInPhiSector method: void PointIsInPhiSector(T const & phi1normalx, T const & phi1normaly, T const & phi2normalx, T const & phi2normaly, Vc::Vector const & xcoord, Vc::Vector const & ycoord, typename Vc::Vector ::Mask & isinphi ) { // method based on calculating the scalar product of position vectors with the normals of the (empty) phi sektor // avoids taking the atan2 // this method could be template specialized in case DeltaPhi = 180^o Vc::Vector scalarproduct1 = phi1normalx*xcoord + phi1normaly*ycoord; Vc::Vector scalarproduct2 = phi2normalx*xcoord + phi2normaly*ycoord; isinphi = (scalarproduct1 > Vc::Zero && scalarproduct2 > Vc::Zero); }

3 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 3/ Vc master branch + VecGeom prototypev1 compiled with gcc CHEP13Benchmark For 1024 vector length and 1000 repetition vecnav.DistToNextBoundary() best timing is: ~94ms Machine is a E GHz

4 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 4/ Intel Vtune gives the following profile (sampling overhead pushed the 94ms to ~130ms) Decision to port to auto-vectorisation the PlacedUSolidsTube ::DistanceToIn method (hotspot#2). Baseline timing 30ms.

5 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 5/ Vc generates very nice asm…

6 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 6/ Could not instanciate a PlacedUSolidsTube ::DistanceToIn method for template parameter = double Choice was to re-implement another overloaded method for such type:

7 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 7/ Not a small kernel; but code is quite easily portable to auto-vectorization: MaskType inz_m = safez > Utils::fgToleranceVc; done_m = !inz_m && ( z*dirz >= Vc::Zero ); // particle outside the z-range and moving away … int inz_m = (safez > Utils::fgTolerance) ? 1 : 0; int done_m = (!inz_m && (z*dirz >= 0.0)) ? 1 : 0; // particle outside the z-range and moving away VectorType distanceRmax( Utils::kInfinityVc ); distanceRmax( canhitrmax ) = (-b - Vc::sqrt( discriminant ))*inverse2a; ValueType distanceRmax = (canhitrmax) ? ((-b - std::sqrt(discriminant))*inverse2a) : Utils::kInfinity;

8 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 8/ Auto-vectorization timings are not too catastrophic …~40ms vs 30ms for Vc (speed-down of 33%) No arithmetic perturbation visible !? Same behavior for x10 repetitions Asm inspection shows partial vectorization for g++ -- need to dig in this direction, as g++ is doing a pretty good job in handling recursive template inlining form out of the box….

9 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 9/ With Intel compiler vectorisation seems complete (see next slide for asm inspection), although for the rest of the code embedding Vc template our compiler seems to be lost!

10 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 10/

11 INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others. All products, dates, and figures are preliminary and are subject to change without any notice. Copyright © 2013, Intel Corporation. Auto-vectorization 11/ I would recommend to always keep in mind the auto- vectorisation branch in template writing. Auto-vectorization can be a pain – depending how compiler handles recursive template inlining..Ours seems to do a very poor job – I will initiate an internal review of this code with compiler engineering. Need also to review reasons of partial vectorization for g++ Need to test other kernels more complicated Try this on Haswell (int will be promoted to 256bits vl) Try this on MIC …


Download ppt "INTEL CONFIDENTIAL Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other."

Similar presentations


Ads by Google