Skip to content

Commit

Permalink
Add gch/small_vector, and use for dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterTh committed Mar 1, 2022
1 parent fc08c44 commit 9ff8e8a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 33 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
[submodule "vendor/Catch2"]
path = vendor/Catch2
url = https://github.com/catchorg/Catch2
[submodule "vendor/small_vector"]
path = vendor/small_vector
url = https://github.com/gharveymn/small_vector.git
branch = main
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ target_include_directories(celerity_runtime PUBLIC
$<INSTALL_INTERFACE:include/celerity>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor>
$<INSTALL_INTERFACE:include/celerity/vendor>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/small_vector/source/include>
$<INSTALL_INTERFACE:include/celerity/vendor/small_vector/source/include>
)

target_link_libraries(celerity_runtime PUBLIC
Expand Down Expand Up @@ -352,6 +354,10 @@ install(
FILES ${PROJECT_SOURCE_DIR}/vendor/ctpl_stl.h
DESTINATION include/celerity/vendor
)
install(
FILES ${PROJECT_SOURCE_DIR}/vendor/small_vector/source/include/gch/small_vector.h
DESTINATION include/celerity/vendor/small_vector/source/include/gch
)
install(
TARGETS celerity_runtime
EXPORT install_exports
Expand Down
58 changes: 29 additions & 29 deletions ci/perf/gpuc1_bench.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[2022-02-28 17:41:30.979] [0] [info] Celerity runtime version 0.3.2 7df4afd-dirty running on hipSYCL 0.9.1. PID = 1931410, build type = release
[2022-02-28 17:41:32.251] [0] [info] Using platform 'CUDA', device 'NVIDIA GeForce RTX 2070' (automatically selected platform 1, device 0)
[2022-02-28 17:47:34.772] [0] [info] Celerity runtime version 0.3.2 fc08c44-dirty running on hipSYCL 0.9.1. PID = 1936954, build type = release
[2022-02-28 17:47:35.855] [0] [info] Using platform 'CUDA', device 'NVIDIA GeForce RTX 2070' (automatically selected platform 1, device 0)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
benchmarks is a Catch v2.13.8 host application.
Expand All @@ -15,17 +15,17 @@ benchmark name samples iterations estimated
mean low mean high mean
std dev low std dev high std dev
-------------------------------------------------------------------------------
creating and adding dependencies 100 287 2.4969 ms
93.6053 ns 93.2225 ns 94.5808 ns
2.88602 ns 0.867489 ns 5.59704 ns
creating and adding dependencies 100 566 2.4904 ms
41.6148 ns 41.3174 ns 42.946 ns
2.67696 ns 0.0910341 ns 6.3291 ns

adding and removing dependencies 100 346 2.4912 ms
72.4014 ns 72.2463 ns 72.8002 ns
1.1875 ns 0.588586 ns 2.50499 ns
adding and removing dependencies 100 741 2.4453 ms
31.08 ns 30.7104 ns 31.5913 ns
2.21036 ns 1.69118 ns 2.7294 ns

checking for dependencies 100 8343 2.5029 ms
3.0209 ns 3.01516 ns 3.02368 ns
0.019484 ns 0.0108124 ns 0.0308004 ns
checking for dependencies 100 7230 2.169 ms
3.16926 ns 3.14641 ns 3.22915 ns
0.18019 ns 0.0744205 ns 0.340222 ns


-------------------------------------------------------------------------------
Expand All @@ -38,17 +38,17 @@ benchmark name samples iterations estimated
mean low mean high mean
std dev low std dev high std dev
-------------------------------------------------------------------------------
creating and adding dependencies 100 61 2.5315 ms
428.892 ns 428.072 ns 431.432 ns
6.63337 ns 1.92252 ns 14.4693 ns
creating and adding dependencies 100 145 2.5085 ms
184.841 ns 184.075 ns 188.23 ns
7.01341 ns 0.925066 ns 16.556 ns

adding and removing dependencies 100 70 2.52 ms
357.577 ns 356.66 ns 360.501 ns
7.56952 ns 2.80122 ns 16.8408 ns
adding and removing dependencies 100 177 2.4957 ms
145.418 ns 145.114 ns 146.768 ns
2.80328 ns 0.38075 ns 6.62784 ns

checking for dependencies 100 1479 2.3664 ms
18.6819 ns 18.6196 ns 18.8521 ns
0.480231 ns 0.179429 ns 0.981342 ns
checking for dependencies 100 2164 2.3804 ms
11.9257 ns 11.887 ns 12.0508 ns
0.32212 ns 0.117204 ns 0.72305 ns


-------------------------------------------------------------------------------
Expand All @@ -61,17 +61,17 @@ benchmark name samples iterations estimated
mean low mean high mean
std dev low std dev high std dev
-------------------------------------------------------------------------------
creating and adding dependencies 100 27 2.5812 ms
985.761 ns 984.129 ns 988.144 ns
9.8914 ns 6.78319 ns 17.33 ns
creating and adding dependencies 100 77 2.5333 ms
345.841 ns 345.198 ns 348.067 ns
5.4417 ns 1.76879 ns 12.3431 ns

adding and removing dependencies 100 33 2.5311 ms
688.153 ns 687.607 ns 690.762 ns
5.20775 ns 0.193305 ns 12.4025 ns
adding and removing dependencies 100 86 2.5112 ms
303.867 ns 303.212 ns 306.912 ns
6.13818 ns 0.537291 ns 14.5706 ns

checking for dependencies 100 470 2.491 ms
51.6004 ns 51.2345 ns 52.3291 ns
2.53074 ns 1.50466 ns 4.92961 ns
checking for dependencies 100 719 2.4446 ms
37.2511 ns 37.1655 ns 37.546 ns
0.727315 ns 0.239268 ns 1.65291 ns


===============================================================================
Expand Down
9 changes: 5 additions & 4 deletions include/intrusive_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <optional>
#include <type_traits>

#include <gch/small_vector.hpp>

namespace celerity {
namespace detail {

Expand Down Expand Up @@ -124,17 +126,16 @@ namespace detail {
int get_pseudo_critical_path_length() const { return pseudo_critical_path_length; }

private:
// TODO grep "list<" and think about each (here probably boost::small_vector)
std::list<dependency> dependencies;
std::list<dependent> dependents;
gch::small_vector<dependency> dependencies;
gch::small_vector<dependent> dependents;

// This only (potentially) grows when adding dependencies,
// it never shrinks and does not take into account later changes further up in the dependency chain
// (that is all that is needed for celerity use).
int pseudo_critical_path_length = 0;

template <typename Dep>
std::optional<typename std::list<Dep>::iterator> maybe_get_dep(std::list<Dep>& deps, T* node) {
std::optional<typename gch::small_vector<Dep>::iterator> maybe_get_dep(gch::small_vector<Dep>& deps, T* node) {
auto it = std::find_if(deps.begin(), deps.end(), [&](auto d) { return d.node == node; });
if(it == deps.end()) return std::nullopt;
return it;
Expand Down
1 change: 1 addition & 0 deletions vendor/small_vector
Submodule small_vector added at 7d4237

0 comments on commit 9ff8e8a

Please sign in to comment.