Add support for AVX2 optimizations (available for Windows only so far)

Tue, 29 Mar 2016 15:57:02 +0200

author
Ansariel
date
Tue, 29 Mar 2016 15:57:02 +0200
changeset 48936
d288d081943d
parent 48935
fdfd55f84d2a
child 48937
c2a72124afbb

Add support for AVX2 optimizations (available for Windows only so far)

autobuild.xml file | annotate | diff | revisions
indra/CMakeLists.txt file | annotate | diff | revisions
indra/cmake/00-Common.cmake file | annotate | diff | revisions
indra/newview/llmanipscale.cpp file | annotate | diff | revisions
scripts/configure_firestorm.sh file | annotate | diff | revisions
     1.1 --- a/autobuild.xml	Mon Mar 28 03:04:58 2016 +0200
     1.2 +++ b/autobuild.xml	Tue Mar 29 15:57:02 2016 +0200
     1.3 @@ -2635,6 +2635,23 @@
     1.4                <key>name</key>
     1.5                <string>ReleaseFS_AVX</string>
     1.6              </map>
     1.7 +            <key>ReleaseFS_AVX2</key>
     1.8 +            <map>
     1.9 +              <key>configure</key>
    1.10 +              <map>
    1.11 +                <key>command</key>
    1.12 +                <string>bash ../scripts/configure_firestorm.sh</string>
    1.13 +                <key>options</key>
    1.14 +                <array>
    1.15 +                  <string>--config</string>
    1.16 +                  <string>--version</string>
    1.17 +                  <string>--opensim</string>
    1.18 +                  <string>--avx2</string>
    1.19 +                </array>
    1.20 +              </map>
    1.21 +              <key>name</key>
    1.22 +              <string>ReleaseFS_AVX2</string>
    1.23 +            </map>
    1.24              <key>ReleaseFS_open</key>
    1.25              <map>
    1.26                <key>configure</key>
    1.27 @@ -2923,6 +2940,32 @@
    1.28                <key>name</key>
    1.29                <string>ReleaseFS_AVX</string>
    1.30              </map>
    1.31 +            <key>ReleaseFS_AVX2</key>
    1.32 +            <map>
    1.33 +              <key>build</key>
    1.34 +              <map>
    1.35 +                <key>command</key>
    1.36 +                <string>../scripts/configure_firestorm.sh</string>
    1.37 +                <key>options</key>
    1.38 +                <array>
    1.39 +                  <string>--build</string>
    1.40 +                  <string>--platform darwin</string>
    1.41 +                  <string>--fmodex</string>
    1.42 +                  <string>--kdu</string>
    1.43 +                </array>
    1.44 +              </map>
    1.45 +              <key>configure</key>
    1.46 +              <map>
    1.47 +                <key>options</key>
    1.48 +                <array>
    1.49 +                  <string>--platform darwin</string>
    1.50 +                  <string>--kdu</string>
    1.51 +                  <string>--fmodex</string>
    1.52 +                </array>
    1.53 +              </map>
    1.54 +              <key>name</key>
    1.55 +              <string>ReleaseFS_AVX2</string>
    1.56 +            </map>
    1.57              <key>ReleaseFS_open</key>
    1.58              <map>
    1.59                <key>build</key>
    1.60 @@ -3171,6 +3214,30 @@
    1.61                <key>name</key>
    1.62                <string>ReleaseFS_AVX</string>
    1.63              </map>
    1.64 +            <key>ReleaseFS_AVX2</key>
    1.65 +            <map>
    1.66 +              <key>build</key>
    1.67 +              <map>
    1.68 +                <key>command</key>
    1.69 +                <string>../scripts/configure_firestorm.sh</string>
    1.70 +                <key>options</key>
    1.71 +                <array>
    1.72 +                  <string>--build</string>
    1.73 +                  <string>--platform linux32</string>
    1.74 +                </array>
    1.75 +              </map>
    1.76 +              <key>configure</key>
    1.77 +              <map>
    1.78 +                <key>options</key>
    1.79 +                <array>
    1.80 +                  <string>--kdu</string>
    1.81 +                  <string>--fmodex</string>
    1.82 +                  <string>--platform linux32</string>
    1.83 +                </array>
    1.84 +              </map>
    1.85 +              <key>name</key>
    1.86 +              <string>ReleaseFS_AVX2</string>
    1.87 +            </map>
    1.88              <key>ReleaseFS_open</key>
    1.89              <map>
    1.90                <key>build</key>
    1.91 @@ -3531,6 +3598,43 @@
    1.92                <key>name</key>
    1.93                <string>ReleaseFS_AVX</string>
    1.94              </map>
    1.95 +            <key>ReleaseFS_AVX2</key>
    1.96 +            <map>
    1.97 +              <key>build</key>
    1.98 +              <map>
    1.99 +                <key>arguments</key>
   1.100 +                <array>
   1.101 +                  <string>Firestorm.sln</string>
   1.102 +                </array>
   1.103 +                <key>command</key>
   1.104 +                <string>msbuild.exe</string>
   1.105 +                <key>options</key>
   1.106 +                <array>
   1.107 +                  <string>/p:Configuration=Release</string>
   1.108 +                  <string>/flp:LogFile=logs\FirestormBuild_win32.log</string>
   1.109 +                  <string>/flp1:errorsonly;LogFile=logs\FirestormBuild_win32.err</string>
   1.110 +                  <string>/p:Platform=Win32</string>
   1.111 +                  <string>/t:Build</string>
   1.112 +                  <string>/p:useenv=true</string>
   1.113 +                  <string>/verbosity:normal</string>
   1.114 +                  <string>/toolsversion:12.0</string>
   1.115 +                  <string>/p:"VCBuildAdditionalOptions= /incremental"</string>
   1.116 +                </array>
   1.117 +              </map>
   1.118 +              <key>configure</key>
   1.119 +              <map>
   1.120 +                <key>options</key>
   1.121 +                <array>
   1.122 +                  <string>--fmodex</string>
   1.123 +                  <string>--kdu</string>
   1.124 +                  <string>--quicktime</string>
   1.125 +                  <string>--version</string>
   1.126 +                  <string>--platform win32</string>
   1.127 +                </array>
   1.128 +              </map>
   1.129 +              <key>name</key>
   1.130 +              <string>ReleaseFS_AVX2</string>
   1.131 +            </map>
   1.132              <key>ReleaseFS_open</key>
   1.133              <map>
   1.134                <key>build</key>
     2.1 --- a/indra/CMakeLists.txt	Mon Mar 28 03:04:58 2016 +0200
     2.2 +++ b/indra/CMakeLists.txt	Tue Mar 29 15:57:02 2016 +0200
     2.3 @@ -37,9 +37,13 @@
     2.4  
     2.5  # <FS:Ansariel> [AVX Optimization]
     2.6  option(USE_AVX_OPTIMIZATION "AVX optimization support" OFF)
     2.7 +option(USE_AVX2_OPTIMIZATION "AVX2 optimization support" OFF)
     2.8  if (USE_AVX_OPTIMIZATION)
     2.9    add_definitions(-DUSE_AVX_OPTIMIZATION=1)
    2.10    message("compiling with AVX optimizations")
    2.11 +elseif (USE_AVX2_OPTIMIZATION)
    2.12 +  add_definitions(-DUSE_AVX2_OPTIMIZATION=1)
    2.13 +  message("compiling with AVX2 optimizations")
    2.14  else (USE_AVX_OPTIMIZATION)
    2.15    message("compiling without AVX optimizations")
    2.16  endif (USE_AVX_OPTIMIZATION)
     3.1 --- a/indra/cmake/00-Common.cmake	Mon Mar 28 03:04:58 2016 +0200
     3.2 +++ b/indra/cmake/00-Common.cmake	Tue Mar 29 15:57:02 2016 +0200
     3.3 @@ -99,6 +99,24 @@
     3.4          /arch:AVX
     3.5  #        /fp:fast
     3.6          )
     3.7 +  elseif (USE_AVX2_OPTIMIZATION)
     3.8 +    add_definitions(
     3.9 +        /DLL_WINDOWS=1
    3.10 +      /DNOMINMAX
    3.11 +#      /DDOM_DYNAMIC            # For shared library colladadom
    3.12 +        /DUNICODE
    3.13 +        /D_UNICODE 
    3.14 +        /GS
    3.15 +        /TP
    3.16 +        /W3
    3.17 +        /c
    3.18 +        /Zc:forScope
    3.19 +        /nologo
    3.20 +        /Oy-
    3.21 +        /Zc:wchar_t-
    3.22 +        /arch:AVX2
    3.23 +#        /fp:fast
    3.24 +        )
    3.25    else (USE_AVX_OPTIMIZATION)
    3.26      add_definitions(
    3.27          /DLL_WINDOWS=1
     4.1 --- a/indra/newview/llmanipscale.cpp	Mon Mar 28 03:04:58 2016 +0200
     4.2 +++ b/indra/newview/llmanipscale.cpp	Tue Mar 29 15:57:02 2016 +0200
     4.3 @@ -2088,11 +2088,7 @@
     4.4  
     4.5  // <FS:Ansariel> [AVX Optimization]
     4.6  	//return LLVector3( coords[greatest_index] );
     4.7 -#ifdef USE_AVX_OPTIMIZATION
     4.8  	return LLVector3(coords[greatest_index][0], coords[greatest_index][1], coords[greatest_index][2]);
     4.9 -#else
    4.10 -	return LLVector3( coords[greatest_index] );
    4.11 -#endif
    4.12  // </FS:Ansariel> [AVX Optimization]
    4.13  }
    4.14  
     5.1 --- a/scripts/configure_firestorm.sh	Mon Mar 28 03:04:58 2016 +0200
     5.2 +++ b/scripts/configure_firestorm.sh	Tue Mar 29 15:57:02 2016 +0200
     5.3 @@ -19,6 +19,7 @@
     5.4  #                  <string>-DFMODEX:BOOL=ON</string>
     5.5  #                  <string>-DOPENSIM:BOOL=ON</string>
     5.6  #                  <string>-DUSE_AVX_OPTIMIZATION:BOOL=OFF</string>
     5.7 +#                  <string>-DUSE_AVX2_OPTIMIZATION:BOOL=OFF</string>
     5.8  #                  <string>-DLL_TESTS:BOOL=OFF</string>
     5.9  #                  <string>-DPACKAGE:BOOL=OFF></string>
    5.10  
    5.11 @@ -36,6 +37,7 @@
    5.12  WANTS_QUICKTIME=$FALSE
    5.13  WANTS_OPENSIM=$TRUE
    5.14  WANTS_AVX=$FALSE
    5.15 +WANTS_AVX2=$FALSE
    5.16  WANTS_BUILD=$FALSE
    5.17  PLATFORM="darwin" # darwin, win32, win64, linux32, linux64
    5.18  BTYPE="Release"
    5.19 @@ -68,6 +70,7 @@
    5.20      echo "  --opensim    : Build with OpenSim support (Disables Havok features)"
    5.21      echo "  --no-opensim : Build without OpenSim support (Overrides --opensim)"
    5.22      echo "  --avx        : Build with Advanced Vector Extensions"
    5.23 +    echo "  --avx2       : Build with Advanced Vector Extensions 2"
    5.24      echo "  --platform   : darwin | win32 | win64 | linux32 | linux64"
    5.25      echo "  --jobs <num> : Build with <num> jobs in parallel (Linux and Darwin only)"
    5.26      echo
    5.27 @@ -79,7 +82,7 @@
    5.28  # $* = the options passed in from main
    5.29  {
    5.30      if [ $# -gt 0 ]; then
    5.31 -      while getoptex "clean build config version package no-package fmodex ninja jobs: platform: kdu quicktime opensim no-opensim avx help chan: btype:" "$@" ; do
    5.32 +      while getoptex "clean build config version package no-package fmodex ninja jobs: platform: kdu quicktime opensim no-opensim avx avx2 help chan: btype:" "$@" ; do
    5.33  
    5.34            #insure options are valid
    5.35            if [  -z "$OPTOPT"  ] ; then
    5.36 @@ -102,6 +105,7 @@
    5.37            opensim)    WANTS_OPENSIM=$TRUE;;
    5.38            no-opensim) WANTS_OPENSIM=$FALSE;;
    5.39            avx)        WANTS_AVX=$TRUE;;
    5.40 +          avx2)       WANTS_AVX2=$TRUE;;
    5.41            package)    WANTS_PACKAGE=$TRUE;;
    5.42            no-package) WANTS_PACKAGE=$FALSE;;
    5.43            build)      WANTS_BUILD=$TRUE;;
    5.44 @@ -278,6 +282,7 @@
    5.45  echo -e "   QUICKTIME: `b2a $WANTS_QUICKTIME`" | tee -a $LOG
    5.46  echo -e "     OPENSIM: `b2a $WANTS_OPENSIM`"   | tee -a $LOG
    5.47  echo -e "         AVX: `b2a $WANTS_AVX` "      | tee -a $LOG
    5.48 +echo -e "        AVX2: `b2a $WANTS_AVX2` "     | tee -a $LOG
    5.49  echo -e "     PACKAGE: `b2a $WANTS_PACKAGE`"   | tee -a $LOG
    5.50  echo -e "       CLEAN: `b2a $WANTS_CLEAN`"     | tee -a $LOG
    5.51  echo -e "       BUILD: `b2a $WANTS_BUILD`"     | tee -a $LOG
    5.52 @@ -394,6 +399,11 @@
    5.53      else
    5.54          AVX_OPTIMIZATION="-DUSE_AVX_OPTIMIZATION:BOOL=OFF"
    5.55      fi
    5.56 +    if [ $WANTS_AVX2 -eq $TRUE ] ; then
    5.57 +        AVX2_OPTIMIZATION="-DUSE_AVX2_OPTIMIZATION:BOOL=ON"
    5.58 +    else
    5.59 +        AVX2_OPTIMIZATION="-DUSE_AVX2_OPTIMIZATION:BOOL=OFF"
    5.60 +    fi
    5.61      if [ $WANTS_PACKAGE -eq $TRUE ] ; then
    5.62          PACKAGE="-DPACKAGE:BOOL=ON"
    5.63          # Also delete easy-to-copy resource files, insuring that we properly refresh resoures from the source tree
    5.64 @@ -449,7 +459,7 @@
    5.65          UNATTENDED="-DUNATTENDED=ON"
    5.66      fi
    5.67  
    5.68 -    cmake -G "$TARGET" ../indra $CHANNEL $FMODEX $QUICKTIME $KDU $OPENSIM $AVX_OPTIMIZATION $PACKAGE $UNATTENDED -DLL_TESTS:BOOL=OFF -DWORD_SIZE:STRING=$WORD_SIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE \
    5.69 +    cmake -G "$TARGET" ../indra $CHANNEL $FMODEX $QUICKTIME $KDU $OPENSIM $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $PACKAGE $UNATTENDED -DLL_TESTS:BOOL=OFF -DWORD_SIZE:STRING=$WORD_SIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE \
    5.70            -DNDTARGET_ARCH:STRING="${TARGET_ARCH}" -DROOT_PROJECT_NAME:STRING=Firestorm $LL_ARGS_PASSTHRU | tee $LOG
    5.71  
    5.72      if [ $PLATFORM == "win32" ] ; then

mercurial