povray icon indicating copy to clipboard operation
povray copied to clipboard

AVX512 version for POVRAY

Open Srihari-mcw opened this issue 2 years ago • 17 comments

The current PR implements AVX512 version of POV-RAY. This contains optimized implementations for Noise and DNoise functions.

Details of implementation:

  • Implementations/Modifications for single coordinate and double coordinate Noise/DNoise function that processes single/two Vector3D inputs at a time.
  • An implementation to process and get noise for 8 multiples of single Vector3D coordinate input at a time.
  • Rewritten versions of functions like DTurbulence/Turbulence/wrinkles/Initialize_Waves and classes like GranitePattern/WrinklesPattern so as to process multiple Vector3D coordinates at a time and use capabilities of AVX512. The present versions of these functions are also retained so that we can take that implementation route whenever we want the code to run with the other versions (Let's say AVX2FMA3)
  • Additional flags and checks were added to check if the machine supports AVX512 and corresponding code flow.

We are able to observe significantly better performance for POVRAY pipeline with the AVX512 implementation. Results related to performance comparison of AVX512 version and AVX2FMA3 version with MSVC compiler are added in avx512_build_setup folder in a xlsx file. The results are recorded in Intel I5-1035 G1 and AMD 7600X. README related to the AVX512 version is attached in the avx512_build_setup folder detailing how to build the Windows and UNIX versions. Details with the Windows build is attached here also for easier reference

Notes for AVX512 Windows build ==============================

The visual studio version was updated from vs2015 to vs2022 to enable support of AVX512 Version

  1. Set the configuration in solution file to Release-AVX512 | x64
  2. Select the 'Generic POV-Ray > povbase' project and expand 'Backend Headers', then open the file build.h(source/base/build.h) listed within it.In it replace with name and email of person who builds the code in BUILT_BY flag and comment the #error directive (line 129)
  3. In syspovconfig.h(windows/povconfig/syspovconfig.h) uncomment the #define _CONSOLE. (line 56) The AVX512 version was developed with the console version. The GUI build has been skipped in the solution file. Note: (Presently with the updated code the GUI project is skipped for building, as the cmedit64.dll and povcmax64.dll from official windows distribution are incompatible with VS2022. The console version alone is available to build and test).
  4. Build the solution file and in the vs2022/bin64 folder we can run the POVRAY examples with povconsole-avx512.exe.
         General command example - povconsole-avx512.exe +Ibenchmark.pov
         Single worker thread - povconsole-avx512.exe +WT1 benchmark.pov
         Output image - benchmark.png

Srihari-mcw avatar May 16 '23 07:05 Srihari-mcw

For easier reference of the performance results a excel workbook detailing the same has been attached here (also part of the branch submitted) - POVRAY Compiled Results - AVX512 - AMD 7600X and Intel I5-1035 G1 with +WT1 Option.xlsx

Srihari-mcw avatar May 23 '23 04:05 Srihari-mcw

Sample results for dimensions 320 x 240 :

AMD Raphael 7600X

image

image

Intel Icelake I5-1035 G1 image image

Srihari-mcw avatar Jun 01 '23 01:06 Srihari-mcw