Skip to content

Commit

Permalink
Replace TAcc with the explicit accelerator type
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Dec 11, 2024
1 parent 2161a5d commit 8b175a1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering {

#ifdef GPU_DEBUG
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_STATIC_ACC_MEM_GLOBAL uint32_t gMaxHit = 0;
#endif

Expand Down Expand Up @@ -65,8 +64,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering {
* - if `status` should be read through a `volatile` pointer (CUDA/ROCm)
* - if `status` should be read with an atomic load (CPU)
*/
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC ALPAKA_FN_INLINE constexpr void promote(TAcc const& acc,
ALPAKA_FN_ACC ALPAKA_FN_INLINE constexpr void promote(Acc1D const& acc,
uint32_t* __restrict__ status,
const uint16_t x,
const uint16_t y) {
Expand All @@ -91,8 +89,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering {

template <typename TrackerTraits>
struct CountModules {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
SiPixelDigisSoAView digi_view,
SiPixelClustersSoAView clus_view,
const unsigned int numElements) const {
Expand Down Expand Up @@ -137,8 +134,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering {
static constexpr uint32_t maxElementsPerBlock =
cms::alpakatools::round_up_by(TrackerTraits::maxPixInModule / maxIterGPU, 128);

template <typename TAcc>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
SiPixelDigisSoAView digi_view,
SiPixelClustersSoAView clus_view,
const unsigned int numElements) const {
Expand Down Expand Up @@ -309,7 +305,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering {

// number of elements per thread
constexpr uint32_t maxElements =
cms::alpakatools::requires_single_thread_per_block_v<TAcc> ? maxElementsPerBlock : 1;
cms::alpakatools::requires_single_thread_per_block_v<Acc1D> ? maxElementsPerBlock : 1;
ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Thread, alpaka::Elems>(acc)[0u] <= maxElements));

constexpr unsigned int maxIter = maxIterGPU * maxElements;
Expand Down Expand Up @@ -461,8 +457,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering {
clus_view[thisModuleId].clusInModule() = foundClusters;
clus_view[module].moduleId() = thisModuleId;
#ifdef GPU_DEBUG
if (foundClusters > gMaxHit<TAcc>) {
gMaxHit<TAcc> = foundClusters;
if (foundClusters > gMaxHit) {
gMaxHit = foundClusters;
if (foundClusters > 8)
printf("max hit %d in %d\n", foundClusters, thisModuleId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
// Kernel to perform Raw to Digi conversion
template <bool debug = false>
struct RawToDigi_kernel {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(const TAcc &acc,
ALPAKA_FN_ACC void operator()(Acc1D const &acc,
const SiPixelMappingSoAConstView &cablingMap,
const unsigned char *modToUnp,
const uint32_t wordCounter,
Expand Down Expand Up @@ -430,8 +429,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

template <typename TrackerTraits>
struct FillHitsModuleStart {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(const TAcc &acc, SiPixelClustersSoAView clus_view) const {
ALPAKA_FN_ACC void operator()(Acc1D const &acc, SiPixelClustersSoAView clus_view) const {
constexpr bool isPhase2 = std::is_base_of<pixelTopology::Phase2, TrackerTraits>::value;

// For Phase1 there are 1856 pixel modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
template <typename TrackerTraits>
class setHitsLayerStart {
public:
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
uint32_t const* __restrict__ hitsModuleStart,
pixelCPEforDevice::ParamsOnDeviceT<TrackerTraits> const* __restrict__ cpeParams,
uint32_t* __restrict__ hitsLayerStart) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
template <typename TrackerTraits>
class GetHits {
public:
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
pixelCPEforDevice::ParamsOnDeviceT<TrackerTraits> const* __restrict__ cpeParams,
BeamSpotPOD const* __restrict__ bs,
SiPixelDigisSoAConstView digis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
// Kernel to apply cuts to calorimeter hits and construct PFRecHits
template <typename CAL>
struct PFRecHitProducerKernelConstruct {
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
const typename CAL::ParameterType::ConstView params,
const typename CAL::TopologyTypeDevice::ConstView topology,
const typename CAL::CaloRecHitSoATypeDevice::ConstView recHits,
Expand Down Expand Up @@ -142,8 +141,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
// Kernel to associate topology information of PFRecHits
template <typename CAL>
struct PFRecHitProducerKernelTopology {
template <typename TAcc, typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,
const typename CAL::TopologyTypeDevice::ConstView topology,
reco::PFRecHitDeviceCollection::View pfRecHits,
const uint32_t* __restrict__ denseId2pfRecHit,
Expand Down

0 comments on commit 8b175a1

Please sign in to comment.