[med-svn] [Git][med-team/xenium][upstream] New upstream version 0.0+git20200720.e62d4d5+dfsg

Andreas Tille gitlab at salsa.debian.org
Tue Jul 21 08:56:11 BST 2020



Andreas Tille pushed to branch upstream at Debian Med / xenium


Commits:
79581767 by Andreas Tille at 2020-07-21T09:44:56+02:00
New upstream version 0.0+git20200720.e62d4d5+dfsg
- - - - -


12 changed files:

- azure-pipelines.yml
- benchmarks/config.hpp
- + benchmarks/examples/hash_map.json
- benchmarks/examples/queue.json
- − benchmarks/hash_map.json
- benchmarks/hash_map_benchmark.cpp
- benchmarks/hash_maps.hpp
- benchmarks/main.cpp
- xenium/backoff.hpp
- + xenium/detail/hardware.hpp
- xenium/kirsch_bounded_kfifo_queue.hpp
- xenium/kirsch_kfifo_queue.hpp


Changes:

=====================================
azure-pipelines.yml
=====================================
@@ -3,30 +3,44 @@ stages:
     jobs:
       - job: BuildLinux
         displayName: 'Build Linux'
-        pool:
-          vmImage: 'ubuntu-18.04'
 
         strategy:
           matrix:
             gcc8-Release:
               compiler: g++-8
               buildConfiguration: Release
+              image: 'ubuntu-18.04'
             gcc8-Debug:
               compiler: g++-8
               buildConfiguration: Debug
+              image: 'ubuntu-18.04'
             clang8-Release:
               compiler: clang++-8
               buildConfiguration: Release
+              image: 'ubuntu-18.04'
             clang8-Debug:
               compiler: clang++-8
               buildConfiguration: Debug
+              image: 'ubuntu-18.04'
             clang9-Release:
               compiler: clang++-9
               buildConfiguration: Release
+              image: 'ubuntu-18.04'
             clang9-Debug:
               compiler: clang++-9
               buildConfiguration: Debug
+              image: 'ubuntu-18.04'
+            clang10-Mac-Debug:
+              compiler: clang++
+              buildConfiguration: Debug
+              image: macOS-10.15
+            clang10-Mac-Release:
+              compiler: clang++
+              buildConfiguration: Release
+              image: macOS-10.15
 
+        pool:
+          vmImage: $(image)
         steps:
         - script: |
             sudo apt-get update -y
@@ -35,10 +49,11 @@ stages:
           condition: eq(variables['compiler'], 'g++-8')
 
         - script: |
+            $(compiler) --version
             git submodule update --init --recursive
             mkdir $(Build.BinariesDirectory)/build
             cd $(Build.BinariesDirectory)/build
-            cmake $(Build.SourcesDirectory) -DCMAKE_CXX_COMPILER=$(compiler) -DCMAKE_BUILD_TYPE=$(buildConfiguration) -DCMAKE_CXX_FLAGS="-fsanitize=thread"
+            cmake $(Build.SourcesDirectory) -DCMAKE_CXX_COMPILER=$(compiler) -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=$(buildConfiguration) -DCMAKE_CXX_FLAGS="-fsanitize=thread"
           displayName: 'Prepare build'
 
         - script: make -j 4
@@ -49,6 +64,10 @@ stages:
           workingDirectory: $(Build.BinariesDirectory)/build
           displayName: 'Run tests'
 
+        - publish: $(Build.BinariesDirectory)/build/benchmark
+          artifact: benchmark
+          condition: and(eq(variables.compiler, 'g++-8'), eq(variables.buildConfiguration, 'Release'))
+
         - task: PublishTestResults at 2
           inputs:
             testResultsFormat: 'JUnit'
@@ -97,6 +116,34 @@ stages:
             testResultsFormat: 'JUnit'
             testResultsFiles: $(Build.BinariesDirectory)\build\$(buildConfiguration)\gtest.log
 
+############################################################
+
+  - stage: BenchmarkSmokeTest
+    condition: succeeded()
+    jobs:
+    - job: BenchmarkSmokeTest
+      displayName: 'Benchmark smoke tests'
+      pool:
+        vmImage: 'Ubuntu-16.04'
+      steps:
+      - task: DownloadPipelineArtifact at 2
+        inputs:
+          artifact: benchmark
+          path: benchmarks/examples
+      - script: |
+          cd benchmarks/examples
+          chmod +x benchmark
+          set -e
+          for QUEUE in ramalhete michael_scott vyukov_bounded kirsch_kfifo kirsch_bounded_kfifo; do
+            ./benchmark queue.json -- "ds=(queues.$QUEUE)" warmup.rounds=0 rounds=1 runtime=500
+          done
+          for RECLAIMER in EBR NEBR DEBRA QSBR static-HP dynamic-HP; do
+            ./benchmark queue.json -- "ds.reclaimer=(reclaimers.$RECLAIMER)" warmup.rounds=0 rounds=1 runtime=500
+          done
+          for HASHMAP in vyukov harris_michael; do
+            ./benchmark hash_map.json -- "ds=(hash_maps.$HASHMAP)" warmup.rounds=0 rounds=1 runtime=500
+          done
+
 ############################################################
 
   - stage: Documentation
@@ -115,7 +162,7 @@ stages:
           doxygen
         displayName: build doxygen
       - script: |
-          cd doc/html
+         cd doc/html
           git init
           git checkout --orphan gh-pages
           git add .


=====================================
benchmarks/config.hpp
=====================================
@@ -27,7 +27,7 @@
   #define WITH_CDS_BASKET_QUEUE
   #define WITH_CDS_SEGMENTED_QUEUE
 
-  #define WITH_CDS_MICHAEL_MAP
+  #define WITH_CDS_MICHAEL_HASHMAP
   #define WITH_CDS_FELDMAN_HASHMAP
 #endif
 


=====================================
benchmarks/examples/hash_map.json
=====================================
@@ -0,0 +1,63 @@
+{
+  "reclaimers": {
+    "EBR": {
+      "type": "generic_epoch_based",
+      "scan_strategy": { "type": "all_threads" },
+      "region_extension": "none"
+    },
+    "NEBR": {
+      "type": "generic_epoch_based",
+      "scan_strategy": { "type": "all_threads" },
+      "region_extension": "eager"
+    },
+    "DEBRA": {
+      "type": "generic_epoch_based",
+      "scan_strategy": { "type": "one_threads" },
+      "region_extension": "eager"
+    },
+    "QSBR": {
+      "type": "quiescent_state_based"
+    },
+    "static-HP": {
+      "type": "hazard_pointer",
+      "allocation_strategy": { "type": "static"}
+    },
+    "dynamic-HP": {
+      "type": "hazard_pointer",
+      "allocation_strategy": { "type": "dynamic"}
+    },
+  },
+  "hash_maps": {
+    "vyukov": {
+      "type": "vyukov_hash_map",
+      "reclaimer": (reclaimers.EBR)
+    },
+    "harris_michael" : {
+      "type": "harris_michael_hash_map",
+      "reclaimer": (reclaimers.EBR)
+    },
+    "cds-MichaelHashMap" : {
+      "type": "cds::MichaelHashMap",
+      "gc": "HP",
+      "nMaxItemCount": 512,
+      "nLoadFactor": 1
+    },
+    "cds-FeldmanHashMap": {
+      "type": "cds::FeldmanHashMap",
+      "gc": "HP"
+    }
+  },
+  "type": "hash_map",
+  "ds": (hash_maps.vyukov),
+  "warmup": {
+    "rounds": 1,
+    "runtime": 200
+  },
+  "rounds": 4,
+  "runtime": 1000,
+  "threads": {
+    "mixed": {
+      "count": 4
+    }
+  }
+}
\ No newline at end of file


=====================================
benchmarks/examples/queue.json
=====================================
@@ -12,8 +12,8 @@
     },
     "DEBRA": {
       "type": "generic_epoch_based",
-      "scan_strategy": { "type": "one_threads" },
-      "region_extension": "eager"
+      "scan_strategy": { "type": "one_thread" },
+      "region_extension": "none"
     },
     "QSBR": {
       "type": "quiescent_state_based"
@@ -38,7 +38,8 @@
     },
     "vyukov_bounded" : {
       "type": "vyukov_bounded_queue",
-      "size": 256
+      "size": 256,
+      "weak": false
     },
     "kirsch_kfifo" : {
       "type": "kirsch_kfifo_queue",


=====================================
benchmarks/hash_map.json deleted
=====================================
@@ -1,20 +0,0 @@
-{
-  "type": "hash_map",
-  "ds": {
-    "type": "vyukov_hash_map",
-    "reclaimer": {
-      "type": "epoch_based"
-    }
-  },
-  "warmup": {
-    "rounds": 1,
-    "runtime": 200
-  },
-  "rounds": 4,
-  "runtime": 1000,
-  "threads": {
-    "mixed": {
-      "count": 4
-    }
-  }
-}
\ No newline at end of file


=====================================
benchmarks/hash_map_benchmark.cpp
=====================================
@@ -199,10 +199,10 @@ namespace {
   #endif
 #endif
 
-#ifdef WITH_CDS_MICHAEL_MAP
+#ifdef WITH_CDS_MICHAEL_HASHMAP
     make_benchmark_builder<
       cds::container::MichaelHashMap<cds::gc::HP,
-        cds::container::MichaelKVList< cds::gc::HP, int, int>>>(),
+        cds::container::MichaelKVList< cds::gc::HP, QUEUE_ITEM, QUEUE_ITEM>>>(),
 #endif
 
 #ifdef WITH_CDS_FELDMAN_HASHMAP


=====================================
benchmarks/hash_maps.hpp
=====================================
@@ -88,17 +88,18 @@ namespace {
 #include <cds/gc/dhp.h>
 #endif
 
-#ifdef WITH_CDS_MICHAEL_MAP
+#ifdef WITH_CDS_MICHAEL_HASHMAP
 #include <cds/container/michael_kvlist_hp.h>
 #include <cds/container/michael_map.h>
 
-template <class GC, class List, class Traits>
-struct descriptor<cds::container::MichaelHashMap<GC, List, Traits>> {
+template <class List, class Traits>
+struct descriptor<cds::container::MichaelHashMap<cds::gc::HP, List, Traits>> {
   static tao::json::value generate() {
     return {
-      {"type", "cds::MichaelMap"},
+      {"type", "cds::MichaelHashMap"},
       {"nMaxItemCount", DYNAMIC_PARAM},
-      {"nLoadFactor", DYNAMIC_PARAM}
+      {"nLoadFactor", DYNAMIC_PARAM},
+      {"gc", "HP"}
     };
   }
 };
@@ -140,10 +141,13 @@ namespace {
 #include <cds/container/feldman_hashmap_dhp.h>
 #include <cds/container/feldman_hashmap_rcu.h>
 
-template <class GC, class Key, class T, class Traits>
-struct descriptor<cds::container::FeldmanHashMap<GC, Key, T, Traits>> {
+template <class Key, class T, class Traits>
+struct descriptor<cds::container::FeldmanHashMap<cds::gc::HP, Key, T, Traits>> {
   static tao::json::value generate() {
-    return {{"type", "cds::FeldmanHashMap"}};
+    return {
+      {"type", "cds::FeldmanHashMap"},
+      {"gc", "HP"}
+    };
   }
 };
 


=====================================
benchmarks/main.cpp
=====================================
@@ -85,7 +85,8 @@ bool objects_match(const tao::config::value::object_t& config, const tao::json::
 
 bool scalars_match(const tao::config::value& config, const tao::json::value& descriptor) {
   if (config.is_string() != descriptor.is_string() ||
-      config.is_integer() != descriptor.is_integer()) {
+      config.is_integer() != descriptor.is_integer() ||
+      config.is_boolean() != descriptor.is_boolean()) {
     return false;
   }
 
@@ -95,6 +96,9 @@ bool scalars_match(const tao::config::value& config, const tao::json::value& des
   if (config.is_string())
     return config.get_string() == descriptor.get_string();
 
+  if (config.is_boolean())
+    return config.get_boolean() == descriptor.get_boolean();
+
   throw std::runtime_error("Found unexpected type in config.");
 }
 


=====================================
xenium/backoff.hpp
=====================================
@@ -6,15 +6,9 @@
 #ifndef XENIUM_BACKOFF_HPP
 #define XENIUM_BACKOFF_HPP
 
-#include <xenium/detail/port.hpp>
+#include <xenium/detail/hardware.hpp>
 #include <algorithm>
 
-#ifdef XENIUM_ARCH_X86
-#include <emmintrin.h>
-#else
-#include <thread>
-#endif
-
 namespace xenium {
 /**
  * @brief Dummy backoff strategy that does nothing.
@@ -24,26 +18,24 @@ struct no_backoff
   void operator()() {}
 };
 
+/**
+ * @brief Simple backoff strategy that always perfoms a single `hardware_pause` operation.
+ */
+struct single_backoff
+{
+  void operator()() { detail::hardware_pause(); }
+};
+
 template <unsigned Max>
 struct exponential_backoff {
   static_assert(Max > 0, "Max must be greater than zero. If you don't want to backoff use the `no_backoff` class.");
 
   void operator()() {
     for (unsigned i = 0; i < count; ++i)
-      do_backoff();
+      detail::hardware_pause();
     count = std::min(Max, count * 2);
   }
 
-private:
-  void do_backoff() {
-#ifdef XENIUM_ARCH_X86
-    _mm_pause();
-#else
-    #warning "No backoff implementation available."
-    std::this_thread::yield();
-#endif
-  }
-
   unsigned count = 1;
 };
 


=====================================
xenium/detail/hardware.hpp
=====================================
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2018-2020 Manuel Pöter.
+// Licensed under the MIT License. See LICENSE file in the project root for full license information.
+//
+
+#ifndef XENIUM_DETAILS_HARDWARE_HPP
+#define XENIUM_DETAILS_HARDWARE_HPP
+
+#include <xenium/detail/port.hpp>
+
+#if defined(XENIUM_ARCH_X86)
+#include <emmintrin.h>
+#elif defined(XENIUM_ARCH_SPARC)
+#include <synch.h>
+#endif
+
+namespace xenium { namespace detail {
+  inline void hardware_pause() {
+    // TODO - add pause implementations for ARM + Power
+#if defined(XENIUM_ARCH_X86)
+    _mm_pause();
+#elif defined(XENIUM_ARCH_SPARC)
+    smt_pause();
+#else
+    #warning "No hardware_pause implementation available - falling back to local volatile noop."
+    // this effectively prevents the compiler from optimizing away the whole backoff operation
+    volatile int x = 0;
+    (void)x;
+#endif
+  }
+}}
+#endif


=====================================
xenium/kirsch_bounded_kfifo_queue.hpp
=====================================
@@ -13,6 +13,7 @@
 
 #include <xenium/detail/pointer_queue_traits.hpp>
 
+#include <algorithm>
 #include <atomic>
 #include <cstdint>
 
@@ -99,16 +100,16 @@ namespace xenium {
   private:
     struct marked_idx {
       marked_idx() = default;
-      marked_idx(uint64_t val, uint64_t mark) { val_ = val | (mark << bits); }
+      marked_idx(uint64_t val, uint64_t mark) noexcept { val_ = val | (mark << bits); }
 
-      uint64_t get() const { return val_ & val_mask; }
-      uint64_t mark() const { return val_ >> bits; }
-      bool operator==(const marked_idx& other) const { return this->val_ == other.val_; }
-      bool operator!=(const marked_idx& other) const { return this->val_ != other.val_; }
+      uint64_t get() const noexcept { return val_ & val_mask; }
+      uint64_t mark() const noexcept { return val_ >> bits; }
+      bool operator==(const marked_idx& other) const noexcept { return this->val_ == other.val_; }
+      bool operator!=(const marked_idx& other) const noexcept { return this->val_ != other.val_; }
     private:
       static constexpr unsigned bits = 16;
       static constexpr uint64_t val_mask = (static_cast<uint64_t>(1) << bits) - 1;
-      uint64_t val_;
+      uint64_t val_ = 0;
     };
     
     template <bool Empty>
@@ -134,7 +135,7 @@ namespace xenium {
     k_(k),
     head_(),
     tail_(),
-    queue_(new entry[k * num_segments])
+    queue_(new entry[k * num_segments]())
   {}
 
   template <class T, class... Policies>


=====================================
xenium/kirsch_kfifo_queue.hpp
=====================================
@@ -13,6 +13,7 @@
 
 #include <xenium/detail/pointer_queue_traits.hpp>
 
+#include <algorithm>
 #include <atomic>
 #include <cstdint>
 



View it on GitLab: https://salsa.debian.org/med-team/xenium/-/commit/795817677e827a8c380a58fe48c3313151e8a871

-- 
View it on GitLab: https://salsa.debian.org/med-team/xenium/-/commit/795817677e827a8c380a58fe48c3313151e8a871
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200721/9e42dd70/attachment-0001.html>


More information about the debian-med-commit mailing list