Browse Source

re-added asmjit

Nicolas Winkler 4 years ago
parent
commit
17663caaff
4 changed files with 26 additions and 34 deletions
  1. 1 1
      libmandel/CMakeLists.txt
  2. 22 22
      libmandel/src/Mandel.cpp
  3. 1 9
      mandelbench/CMakeLists.txt
  4. 2 2
      mandelbench/mandelbench.cpp

+ 1 - 1
libmandel/CMakeLists.txt

@@ -84,7 +84,7 @@ target_link_libraries(mandel PUBLIC qd)
 
 
 if(MANDEL_ASMJIT)
 if(MANDEL_ASMJIT)
     add_subdirectory(asmjit)
     add_subdirectory(asmjit)
-    target_compile_definitions(mandel PUBLIC MANDEL_ASMJIT)
+    target_compile_definitions(mandel PUBLIC WITH_ASMJIT)
     target_link_libraries(mandel PUBLIC AsmJit::AsmJit)
     target_link_libraries(mandel PUBLIC AsmJit::AsmJit)
 endif(MANDEL_ASMJIT)
 endif(MANDEL_ASMJIT)
 
 

+ 22 - 22
libmandel/src/Mandel.cpp

@@ -72,7 +72,7 @@ MandelContext::MandelContext(void)
     if (cpuInfo.hasAvx512()) {
     if (cpuInfo.hasAvx512()) {
         auto fl = std::make_unique<CpuGenerator<float, mnd::X86_AVX_512, true>>();
         auto fl = std::make_unique<CpuGenerator<float, mnd::X86_AVX_512, true>>();
         //auto db = std::make_unique<CpuGenerator<double, mnd::X86_AVX_512, true>>();
         //auto db = std::make_unique<CpuGenerator<double, mnd::X86_AVX_512, true>>();
-        cpuGenerators.insert({ { Precision::FLOAT, CpuExtension::X86_AVX_512 }, std::move(fl) });
+        cpuGenerators.insert({ std::pair{ Precision::FLOAT, CpuExtension::X86_AVX_512 }, std::move(fl) });
         //cpuGenerators.insert({ { Precision::DOUBLE, CpuExtension::X86_AVX_512 }, std::move(db) });
         //cpuGenerators.insert({ { Precision::DOUBLE, CpuExtension::X86_AVX_512 }, std::move(db) });
     }
     }
 #   endif
 #   endif
@@ -81,26 +81,26 @@ MandelContext::MandelContext(void)
         auto db = std::make_unique<CpuGenerator<double, mnd::X86_AVX, true>>();
         auto db = std::make_unique<CpuGenerator<double, mnd::X86_AVX, true>>();
         auto ddb = std::make_unique<CpuGenerator<DoubleDouble, mnd::X86_AVX, true>>();
         auto ddb = std::make_unique<CpuGenerator<DoubleDouble, mnd::X86_AVX, true>>();
         auto tdb = std::make_unique<CpuGenerator<TripleDouble, mnd::X86_AVX, true>>();
         auto tdb = std::make_unique<CpuGenerator<TripleDouble, mnd::X86_AVX, true>>();
-        cpuGenerators.insert({ { Precision::FLOAT, CpuExtension::X86_AVX }, std::move(fl) });
-        cpuGenerators.insert({ { Precision::DOUBLE, CpuExtension::X86_AVX }, std::move(db) });
-        cpuGenerators.insert({ { Precision::DOUBLE_DOUBLE, CpuExtension::X86_AVX }, std::move(ddb) });
-        cpuGenerators.insert({ { Precision::TRIPLE_DOUBLE, CpuExtension::X86_AVX }, std::move(tdb) });
+        cpuGenerators.insert({ std::pair{ Precision::FLOAT, CpuExtension::X86_AVX }, std::move(fl) });
+        cpuGenerators.insert({ std::pair{ Precision::DOUBLE, CpuExtension::X86_AVX }, std::move(db) });
+        cpuGenerators.insert({ std::pair{ Precision::DOUBLE_DOUBLE, CpuExtension::X86_AVX }, std::move(ddb) });
+        cpuGenerators.insert({ std::pair{ Precision::TRIPLE_DOUBLE, CpuExtension::X86_AVX }, std::move(tdb) });
     }
     }
     if (cpuInfo.hasAvx2() && cpuInfo.hasFma()) {
     if (cpuInfo.hasAvx2() && cpuInfo.hasFma()) {
         auto favxfma = std::make_unique<CpuGenerator<float, mnd::X86_AVX_FMA, true>>();
         auto favxfma = std::make_unique<CpuGenerator<float, mnd::X86_AVX_FMA, true>>();
         auto davxfma = std::make_unique<CpuGenerator<double, mnd::X86_AVX_FMA, true>>();
         auto davxfma = std::make_unique<CpuGenerator<double, mnd::X86_AVX_FMA, true>>();
         auto ddavxfma = std::make_unique<CpuGenerator<DoubleDouble, mnd::X86_AVX_FMA, true>>();
         auto ddavxfma = std::make_unique<CpuGenerator<DoubleDouble, mnd::X86_AVX_FMA, true>>();
         auto qdavxfma = std::make_unique<CpuGenerator<QuadDouble, mnd::X86_AVX_FMA, true>>();
         auto qdavxfma = std::make_unique<CpuGenerator<QuadDouble, mnd::X86_AVX_FMA, true>>();
-        cpuGenerators.insert({ { Precision::FLOAT, CpuExtension::X86_AVX_FMA }, std::move(favxfma) });
-        cpuGenerators.insert({ { Precision::DOUBLE, CpuExtension::X86_AVX_FMA }, std::move(davxfma) });
-        cpuGenerators.insert({ { Precision::DOUBLE_DOUBLE, CpuExtension::X86_AVX_FMA }, std::move(ddavxfma) });
-        cpuGenerators.insert({ { Precision::QUAD_DOUBLE, CpuExtension::X86_AVX_FMA }, std::move(qdavxfma) });
+        cpuGenerators.insert({ std::pair{ Precision::FLOAT, CpuExtension::X86_AVX_FMA }, std::move(favxfma) });
+        cpuGenerators.insert({ std::pair{ Precision::DOUBLE, CpuExtension::X86_AVX_FMA }, std::move(davxfma) });
+        cpuGenerators.insert({ std::pair{ Precision::DOUBLE_DOUBLE, CpuExtension::X86_AVX_FMA }, std::move(ddavxfma) });
+        cpuGenerators.insert({ std::pair{ Precision::QUAD_DOUBLE, CpuExtension::X86_AVX_FMA }, std::move(qdavxfma) });
     }
     }
     if (cpuInfo.hasSse2()) {
     if (cpuInfo.hasSse2()) {
         auto fl = std::make_unique<CpuGenerator<float, mnd::X86_SSE2, true>>();
         auto fl = std::make_unique<CpuGenerator<float, mnd::X86_SSE2, true>>();
         auto db = std::make_unique<CpuGenerator<double, mnd::X86_SSE2, true>>();
         auto db = std::make_unique<CpuGenerator<double, mnd::X86_SSE2, true>>();
-        cpuGenerators.insert({ { Precision::FLOAT, CpuExtension::X86_SSE2 }, std::move(fl) });
-        cpuGenerators.insert({ { Precision::DOUBLE, CpuExtension::X86_SSE2 }, std::move(db) });
+        cpuGenerators.insert({ std::pair{ Precision::FLOAT, CpuExtension::X86_SSE2 }, std::move(fl) });
+        cpuGenerators.insert({ std::pair{ Precision::DOUBLE, CpuExtension::X86_SSE2 }, std::move(db) });
     }
     }
 #elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) 
 #elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) 
     if (cpuInfo.hasNeon()) {
     if (cpuInfo.hasNeon()) {
@@ -115,34 +115,34 @@ MandelContext::MandelContext(void)
     {
     {
         auto fl = std::make_unique<CpuGenerator<float, mnd::NONE, true>>();
         auto fl = std::make_unique<CpuGenerator<float, mnd::NONE, true>>();
         auto db = std::make_unique<CpuGenerator<double, mnd::NONE, true>>();
         auto db = std::make_unique<CpuGenerator<double, mnd::NONE, true>>();
-        cpuGenerators.insert({ { Precision::FLOAT, CpuExtension::NONE }, std::move(fl) });
-        cpuGenerators.insert({ { Precision::DOUBLE, CpuExtension::NONE }, std::move(db) });
+        cpuGenerators.insert({ std::pair{ Precision::FLOAT, CpuExtension::NONE }, std::move(fl) });
+        cpuGenerators.insert({ std::pair{ Precision::DOUBLE, CpuExtension::NONE }, std::move(db) });
 
 
         auto fx64 = std::make_unique<CpuGenerator<Fixed64, mnd::NONE, true>>();
         auto fx64 = std::make_unique<CpuGenerator<Fixed64, mnd::NONE, true>>();
         auto fx128 = std::make_unique<CpuGenerator<Fixed128, mnd::NONE, true>>();
         auto fx128 = std::make_unique<CpuGenerator<Fixed128, mnd::NONE, true>>();
-        cpuGenerators.insert({ { Precision::FIXED64, CpuExtension::NONE }, std::move(fx64) });
-        cpuGenerators.insert({ { Precision::FIXED128, CpuExtension::NONE }, std::move(fx128) });
+        cpuGenerators.insert({ std::pair{ Precision::FIXED64, CpuExtension::NONE }, std::move(fx64) });
+        cpuGenerators.insert({ std::pair{ Precision::FIXED128, CpuExtension::NONE }, std::move(fx128) });
     }
     }
 
 
 #ifdef WITH_BOOST
 #ifdef WITH_BOOST
     auto quad = std::make_unique<CpuGenerator<Float128, mnd::NONE, true>>();
     auto quad = std::make_unique<CpuGenerator<Float128, mnd::NONE, true>>();
     auto oct = std::make_unique<CpuGenerator<Float256, mnd::NONE, true>>();
     auto oct = std::make_unique<CpuGenerator<Float256, mnd::NONE, true>>();
-    cpuGenerators.insert({ { Precision::FLOAT128, CpuExtension::NONE }, std::move(quad) });
-    cpuGenerators.insert({ { Precision::FLOAT256, CpuExtension::NONE }, std::move(oct) });
+    cpuGenerators.insert({ std::pair{ Precision::FLOAT128, CpuExtension::NONE }, std::move(quad) });
+    cpuGenerators.insert({ std::pair{ Precision::FLOAT256, CpuExtension::NONE }, std::move(oct) });
 #endif // WITH_BOOST
 #endif // WITH_BOOST
 
 
     auto dd = std::make_unique<CpuGenerator<DoubleDouble, mnd::NONE, true>>();
     auto dd = std::make_unique<CpuGenerator<DoubleDouble, mnd::NONE, true>>();
     auto td = std::make_unique<CpuGenerator<TripleDouble, mnd::NONE, true>>();
     auto td = std::make_unique<CpuGenerator<TripleDouble, mnd::NONE, true>>();
     auto qd = std::make_unique<CpuGenerator<QuadDouble, mnd::NONE, true>>();
     auto qd = std::make_unique<CpuGenerator<QuadDouble, mnd::NONE, true>>();
     auto hd = std::make_unique<CpuGenerator<HexDouble, mnd::NONE, true>>();
     auto hd = std::make_unique<CpuGenerator<HexDouble, mnd::NONE, true>>();
-    cpuGenerators.insert({ { Precision::DOUBLE_DOUBLE, CpuExtension::NONE }, std::move(dd) });
-    cpuGenerators.insert({ { Precision::TRIPLE_DOUBLE, CpuExtension::NONE }, std::move(td) });
-    cpuGenerators.insert({ { Precision::QUAD_DOUBLE, CpuExtension::NONE }, std::move(qd) });
-    cpuGenerators.insert({ { Precision::HEX_DOUBLE, CpuExtension::NONE }, std::move(hd) });
+    cpuGenerators.insert({ std::pair{ Precision::DOUBLE_DOUBLE, CpuExtension::NONE }, std::move(dd) });
+    cpuGenerators.insert({ std::pair{ Precision::TRIPLE_DOUBLE, CpuExtension::NONE }, std::move(td) });
+    cpuGenerators.insert({ std::pair{ Precision::QUAD_DOUBLE, CpuExtension::NONE }, std::move(qd) });
+    cpuGenerators.insert({ std::pair{ Precision::HEX_DOUBLE, CpuExtension::NONE }, std::move(hd) });
 
 
 
 
     auto fix512 = std::make_unique<CpuGenerator<Fixed512, mnd::NONE, true>>();
     auto fix512 = std::make_unique<CpuGenerator<Fixed512, mnd::NONE, true>>();
-    cpuGenerators.insert({ { Precision::FIXED512, CpuExtension::NONE }, std::move(fix512) });
+    cpuGenerators.insert({ std::pair{ Precision::FIXED512, CpuExtension::NONE }, std::move(fix512) });
 
 
     devices = createDevices();
     devices = createDevices();
 
 

+ 1 - 9
mandelbench/CMakeLists.txt

@@ -1,19 +1,11 @@
 cmake_minimum_required(VERSION 3.9)
 cmake_minimum_required(VERSION 3.9)
 
 
-set(Boost_USE_STATIC_LIBS ON)
-find_package(Boost 1.53)
+project(Mandelbench VERSION 1.0.0 DESCRIPTION "benchmarks for libmandel")
 
 
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libmandel ${CMAKE_CURRENT_BINARY_DIR}/libmandel)
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libmandel ${CMAKE_CURRENT_BINARY_DIR}/libmandel)
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD 17)
 
 
 add_executable(mandelbench mandelbench.cpp)
 add_executable(mandelbench mandelbench.cpp)
 
 
-target_include_directories(mandelbench PUBLIC ../libmandel/include)
-
 target_link_libraries(mandelbench mandel)
 target_link_libraries(mandelbench mandel)
 
 
-if(Boost_FOUND)
-    target_compile_definitions(mandelbench PUBLIC WITH_BOOST)
-    target_include_directories(mandelbench PRIVATE ${Boost_INCLUDE_DIRS})
-endif(Boost_FOUND)
-

+ 2 - 2
mandelbench/mandelbench.cpp

@@ -90,8 +90,8 @@ double benchmark(mnd::MandelGenerator& generator)
         auto [iters, time] = measureMips([&generator, &mi, &data]() { generator.generate(mi, data.get()); return std::make_pair(data.get(), mi.bWidth * mi.bHeight);  });
         auto [iters, time] = measureMips([&generator, &mi, &data]() { generator.generate(mi, data.get()); return std::make_pair(data.get(), mi.bWidth * mi.bHeight);  });
         //printf("benchmark lvl %d, time %d ms\n", i, time.count() / 1000 / 1000);
         //printf("benchmark lvl %d, time %d ms\n", i, time.count() / 1000 / 1000);
         //fflush(stdout);
         //fflush(stdout);
-        if (time > std::chrono::milliseconds(200)) {
-            testIndex = i + 2;
+        if (time > std::chrono::milliseconds(400)) {
+            testIndex = i + 1;
             break;
             break;
         }
         }
     }
     }