-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a28fa9c
commit d22ab31
Showing
17 changed files
with
2,297 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
device/cuda/include/traccc/cuda/seeding2/kernels/kd_tree_kernel.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <traccc/cuda/seeding2/types/internal_sp.hpp> | ||
#include <traccc/cuda/seeding2/types/kd_tree.hpp> | ||
#include <traccc/edm/internal_spacepoint.hpp> | ||
#include <traccc/edm/spacepoint.hpp> | ||
#include <vector> | ||
|
||
namespace traccc::cuda { | ||
/** | ||
* @brief Creates a k-d tree from a given set of spacepoints. | ||
* | ||
* @return A pair containing the k-d tree nodes as well as the number of nodes. | ||
*/ | ||
std::tuple<kd_tree_owning_t, uint32_t, internal_sp_owning_t> create_kd_tree( | ||
vecmem::memory_resource&, internal_sp_owning_t&&, uint32_t); | ||
} // namespace traccc::cuda |
39 changes: 39 additions & 0 deletions
39
device/cuda/include/traccc/cuda/seeding2/kernels/seed_finding_kernel.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <traccc/cuda/seeding2/types/internal_seed.hpp> | ||
#include <traccc/cuda/seeding2/types/internal_sp.hpp> | ||
#include <traccc/cuda/seeding2/types/kd_tree.hpp> | ||
#include <traccc/edm/internal_spacepoint.hpp> | ||
#include <traccc/edm/spacepoint.hpp> | ||
#include <traccc/seeding/detail/seeding_config.hpp> | ||
|
||
namespace traccc::cuda { | ||
/** | ||
* @brief Convenience data structure for all the data we need for seeding. | ||
*/ | ||
struct seed_finding_data_t { | ||
const seedfinder_config finder_conf; | ||
const seedfilter_config filter_conf; | ||
const internal_sp_t spacepoints; | ||
const std::size_t n_spacepoints; | ||
const kd_tree_t tree; | ||
const uint32_t tree_nodes; | ||
}; | ||
|
||
/** | ||
* @brief Execute the seed finding kernel itself. | ||
* | ||
* @return A pair containing the list of internal seeds as well as the number | ||
* of seeds. | ||
*/ | ||
std::pair<vecmem::unique_alloc_ptr<internal_seed[]>, uint32_t> run_seeding( | ||
seedfinder_config, seedfilter_config, vecmem::memory_resource&, | ||
internal_sp_t, uint32_t, kd_tree_t, uint32_t); | ||
} // namespace traccc::cuda |
27 changes: 27 additions & 0 deletions
27
device/cuda/include/traccc/cuda/seeding2/kernels/write_output_kernel.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <traccc/cuda/seeding2/types/internal_seed.hpp> | ||
#include <traccc/cuda/seeding2/types/internal_sp.hpp> | ||
#include <traccc/edm/alt_seed.hpp> | ||
#include <traccc/edm/internal_spacepoint.hpp> | ||
#include <traccc/edm/seed.hpp> | ||
#include <traccc/edm/spacepoint.hpp> | ||
#include <traccc/utils/memory_resource.hpp> | ||
|
||
namespace traccc::cuda { | ||
/** | ||
* @brief Kernel to write output data back into traccc's EDM. | ||
* | ||
* @return A vector buffer containing the output seeds. | ||
*/ | ||
alt_seed_collection_types::buffer write_output(const traccc::memory_resource &, | ||
uint32_t, const internal_sp_t, | ||
const internal_seed *const); | ||
} // namespace traccc::cuda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <traccc/edm/alt_seed.hpp> | ||
#include <traccc/edm/spacepoint.hpp> | ||
#include <traccc/seeding/detail/seeding_config.hpp> | ||
#include <traccc/utils/algorithm.hpp> | ||
#include <traccc/utils/memory_resource.hpp> | ||
#include <vecmem/memory/cuda/device_memory_resource.hpp> | ||
|
||
namespace traccc::cuda { | ||
/** | ||
* @brief Alternative seed finding algorithm, using orthogonal range search | ||
* implemented through a k-d tree. | ||
*/ | ||
class seed_finding2 : public algorithm<alt_seed_collection_types::buffer( | ||
const spacepoint_collection_types::const_view&)> { | ||
public: | ||
seed_finding2(const traccc::memory_resource& mr); | ||
|
||
output_type operator()( | ||
const spacepoint_collection_types::const_view& sps) const override; | ||
|
||
private: | ||
traccc::memory_resource m_output_mr; | ||
seedfinder_config m_finder_conf; | ||
seedfilter_config m_filter_conf; | ||
}; | ||
} // namespace traccc::cuda |
29 changes: 29 additions & 0 deletions
29
device/cuda/include/traccc/cuda/seeding2/types/internal_seed.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <array> | ||
#include <cstdint> | ||
|
||
namespace traccc::cuda { | ||
/** | ||
* @brief Internal structure representing a single seed. | ||
*/ | ||
struct internal_seed { | ||
std::array<uint32_t, 3> spacepoints; | ||
float weight; | ||
|
||
__host__ __device__ static internal_seed Invalid() { | ||
internal_seed r; | ||
|
||
r.weight = std::numeric_limits<float>::lowest(); | ||
|
||
return r; | ||
} | ||
}; | ||
} // namespace traccc::cuda |
143 changes: 143 additions & 0 deletions
143
device/cuda/include/traccc/cuda/seeding2/types/internal_sp.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <array> | ||
#include <cstdint> | ||
#include <traccc/edm/internal_spacepoint.hpp> | ||
#include <traccc/edm/spacepoint.hpp> | ||
#include <vecmem/memory/unique_ptr.hpp> | ||
|
||
namespace traccc::cuda { | ||
struct internal_sp_owning_t { | ||
internal_sp_owning_t(vecmem::unique_alloc_ptr<float[]> &&_xs, | ||
vecmem::unique_alloc_ptr<float[]> &&_ys, | ||
vecmem::unique_alloc_ptr<float[]> &&_zs, | ||
vecmem::unique_alloc_ptr<float[]> &&_phis, | ||
vecmem::unique_alloc_ptr<float[]> &&_radii, | ||
vecmem::unique_alloc_ptr<unsigned int[]> &&_links) | ||
: xs(std::forward<vecmem::unique_alloc_ptr<float[]>>(_xs)), | ||
ys(std::forward<vecmem::unique_alloc_ptr<float[]>>(_ys)), | ||
zs(std::forward<vecmem::unique_alloc_ptr<float[]>>(_zs)), | ||
phis(std::forward<vecmem::unique_alloc_ptr<float[]>>(_phis)), | ||
radii(std::forward<vecmem::unique_alloc_ptr<float[]>>(_radii)), | ||
links( | ||
std::forward<vecmem::unique_alloc_ptr<unsigned int[]>>(_links)) {} | ||
|
||
internal_sp_owning_t() {} | ||
|
||
vecmem::unique_alloc_ptr<float[]> xs, ys, zs, phis, radii; | ||
vecmem::unique_alloc_ptr<unsigned int[]> links; | ||
|
||
// internal_sp_owning_t( | ||
// vecmem::unique_alloc_ptr<internal_spacepoint<spacepoint>[]> && _sps | ||
// ) : | ||
// sps(std::forward<vecmem::unique_alloc_ptr<internal_spacepoint<spacepoint>[]>>(_sps)) | ||
// {} | ||
|
||
// internal_sp_owning_t() {} | ||
|
||
// vecmem::unique_alloc_ptr<internal_spacepoint<spacepoint>[]> sps; | ||
}; | ||
|
||
struct internal_sp_t { | ||
internal_sp_t(const internal_sp_owning_t &o) | ||
: xs(o.xs.get()), | ||
ys(o.ys.get()), | ||
zs(o.zs.get()), | ||
phis(o.phis.get()), | ||
radii(o.radii.get()), | ||
links(o.links.get()) {} | ||
|
||
// internal_sp_t(const internal_sp_owning_t & o) : sps(o.sps.get()) {} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float &x(const I i) { | ||
return xs[i]; | ||
// return sps[i].m_x; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float x(const I i) const { | ||
return xs[i]; | ||
// return sps[i].m_x; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float &y(const I i) { | ||
return ys[i]; | ||
// return sps[i].m_y; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float y(const I i) const { | ||
return ys[i]; | ||
// return sps[i].m_y; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float &z(const I i) { | ||
return zs[i]; | ||
// return sps[i].m_z; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float z(const I i) const { | ||
return zs[i]; | ||
// return sps[i].m_z; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float &phi(const I i) { | ||
return phis[i]; | ||
// return sps[i].m_phi; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float phi(const I i) const { | ||
return phis[i]; | ||
// return sps[i].m_phi; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float &radius(const I i) { | ||
return radii[i]; | ||
// return sps[i].m_r; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ float radius(const I i) const { | ||
return radii[i]; | ||
// return sps[i].m_r; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ unsigned int &link(const I i) { | ||
return links[i]; | ||
// return sps[i].m_link_alt; | ||
} | ||
|
||
template <typename I> | ||
__device__ __forceinline__ unsigned int link(const I i) const { | ||
return links[i]; | ||
// return sps[i].m_link_alt; | ||
} | ||
|
||
template <typename T, typename I> | ||
__device__ __forceinline__ internal_spacepoint<T> get(const I i) const { | ||
return internal_spacepoint<T>(x(i), y(i), z(i), radius(i), phi(i), | ||
link(i)); | ||
// return sps[i]; | ||
} | ||
|
||
private: | ||
float *xs, *ys, *zs, *phis, *radii; | ||
unsigned int *links; | ||
// internal_spacepoint<spacepoint> * sps; | ||
}; | ||
} // namespace traccc::cuda |
Oops, something went wrong.