Skip to content

Heterogeneous Alpaka implementation of electron pixel seed-matching - #51200

Open
ckoraka wants to merge 10 commits into
cms-sw:masterfrom
ckoraka:pixelSeedingAlpaka_20_1_X
Open

Heterogeneous Alpaka implementation of electron pixel seed-matching#51200
ckoraka wants to merge 10 commits into
cms-sw:masterfrom
ckoraka:pixelSeedingAlpaka_20_1_X

Conversation

@ckoraka

@ckoraka ckoraka commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

PR description:

This PR introduces a heterogeneous implementation of the electron pixel seed-matching algorithm, intended to replace the legacy ElectronNHitSeedProducer. It introduces the following developments:

  • Two new SoA data formats in DataFormats/EgammaReco:

    • ElectronSeedSoA: describes the pixel-matching seed information (hit positions, detector surfaces/rotations, and pixel-match variables dPhi/dRZ) in a portable layout.
    • SuperClusterSoA: describes the minimal supercluster information needed for matching (position and energy) in a memory-efficient portable layout.
  • Portable utility functions for helix track propagation, ported to be usable on device: helixBarrelPlaneCrossingByCircle, helixForwardPlaneCrossing, helixArbitraryPlaneCrossing(and 2nd order), ftsFromVertexToPointPortable, EleRelPointPairPortable, and Plane.

  • A dedicated Alpaka kernel that performs the seed-to-supercluster matching on the device.

Two new producers implementing the new workflow:

  • ElectronNHitSeedAlpakaProducer: fills the ElectronSeedSoA/SuperClusterSoA host collections from the legacy TrajectorySeed and SuperCluster collections, copies them to the device, and launches the matching kernel.
  • ElectronSeedConverter: converts the matched seeds back to the legacy format, and additionally performs a doublet-rejection algorithm on CPU that discards doublet seeds with a high number of valid trajectory layers which is a known source of fake-electron contributions.

PR validation:

Timing and performance studies have been conducted to validate these developments. The results can be found here:

  • Using the Phase-2 menu: [Link]
  • Using the Run-3 menu: [Link]

Note One can run these developments using :
runTheMatrix.py -w upgrade -l 34434.751
adding a customization to step2 : --customise RecoEgamma/Configuration/hltEgammaPixelSeedingPortable.customise_alpaka_seeds
or using :
runTheMatrix.py -w upgrade -l 34434.7511

@cmsbuild

cmsbuild commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

cms-bot internal usage

@cmsbuild

Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-51200/49727

@cmsbuild

Copy link
Copy Markdown
Contributor

A new Pull Request was created by @ckoraka for master.

It involves the following packages:

  • DataFormats/EgammaReco (reconstruction)
  • RecoEgamma/Configuration (reconstruction)
  • RecoEgamma/EgammaElectronAlgos (reconstruction)
  • RecoEgamma/EgammaElectronProducers (reconstruction)

@Moanwar, @cmsbuild, @jfernan2, @mandrenguyen, @srimanob can you please review it and eventually sign? Thanks.
@Prasant1993, @Sam-Harper, @a-kapoor, @afiqaize, @jainshilpi, @lgray, @missirol, @mmusich, @ram1123, @rovere, @sameasy, @sobhatta, @valsdav, @varuns23 this is something you requested to watch as well.
@ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@Moanwar

Moanwar commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

enable gpu

@Moanwar

Moanwar commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@cmsbuild, please test

@fwyzard

fwyzard commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

assign heterogeneous

@cmsbuild

Copy link
Copy Markdown
Contributor

New categories assigned: heterogeneous

@fwyzard,@makortel you have been requested to review this Pull request/Issue and eventually sign? Thanks

Comment on lines +11 to +12
namespace ALPAKA_ACCELERATOR_NAMESPACE {
namespace reco {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be simplified to

Suggested change
namespace ALPAKA_ACCELERATOR_NAMESPACE {
namespace reco {
namespace ALPAKA_ACCELERATOR_NAMESPACE::reco {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected in ckoraka@4552547

}

template <typename TAcc>
ALPAKA_FN_ACC T partial_norm(const TAcc& acc) const {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial_norm() and partial_norm2() are not very descriptive.

How about r() and r2() ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to follow ROOT conventions, along with several other functions.


Phys3DVector(const Phys3DVector<T>&) = default;

constexpr Phys3DVector(const T& value) : m_data{} {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to pass it by value:

Suggested change
constexpr Phys3DVector(const T& value) : m_data{} {
constexpr Phys3DVector(const T value) : m_data{} {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed with 2d78844


namespace cms::alpakatools::math {

template <class T>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a short documentation, explaining that Phys3DVector represents a vector in 3D space in cartesian (x, y, z) or cylindrical (r, z) coordinates ?

@fwyzard fwyzard Jun 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how much more complicated would it be to use an Eigen::Matrix<T, 3, 1> here ?
It might give better performance due to how Eigen combines multiple operations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eigen was attempted earlier, but that was hit by #48928

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A related bug has been reported to NVIDIA and fixed in CUDA 13.1, so this may have been resolved by now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, did anything change in the implementation ?
Now this looks like only Cartesian coordinates are used.

};

template <typename T>
inline constexpr Phys3DVector<T> ax(const T a, const Phys3DVector<T>& x) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not operator* ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed with 2d78844

}

template <typename T>
inline constexpr Phys3DVector<T> xmy(const Phys3DVector<T>& x, const Phys3DVector<T>& y) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not operator- ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed with 2d78844

@cmsbuild

Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-51200/49731

@cmsbuild

cmsbuild commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-51200/50480

@cmsbuild

cmsbuild commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@ckoraka

ckoraka commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Can you:

* add the offset .7511 in the readme of the `Configuration/PyReleaseValidation` package.

* add the workflow in the p2_hlt sub-matrix: https://github.com/cms-sw/cmssw/blob/b42d8f97ad51eabeae03ca636e8eb8c7be215787/Configuration/PyReleaseValidation/scripts/runTheMatrix.py#L154

* extend the list of workflows that run in IBs with it: https://github.com/cms-sw/cmssw/blob/b42d8f97ad51eabeae03ca636e8eb8c7be215787/Configuration/PyReleaseValidation/python/relval_Run4.py#L62

?

Added with commit 863c01f

@mmusich

mmusich commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

test parameters:

  • enable = gpu, hlt_p2_integration
  • workflows = ph2_hlt

@mmusich

mmusich commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@cmsbuild, please test

@cmsbuild

cmsbuild commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

-1

Failed Tests: UnitTests RelVals-AMD_MI300X
Size: This PR adds an extra 164KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-401477/55137/summary.html
COMMIT: 863c01f
CMSSW: CMSSW_20_1_X_2026-08-06-1200/el9_amd64_gcc13
Additional Tests: GPU,HLT_P2_INTEGRATION,AMD_MI300X,AMD_W7900,NVIDIA_H100,NVIDIA_L40S,NVIDIA_T4
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/51200/55137/install.sh to create a dev area with all the needed externals and cmssw changes.

Failed Unit Tests

I found 1 errors in the following unit tests:

---> test test_heterogeneousMenu had ERRORS

Failed RelVals-AMD_MI300X

  • 34434.40234434.402_TTbar_14TeV+Run4D121_Patatrack_PixelOnlyAlpaka/step2_TTbar_14TeV+Run4D121_Patatrack_PixelOnlyAlpaka.log
  • 34434.40434434.404_TTbar_14TeV+Run4D121_Patatrack_PixelOnlyAlpaka_Profiling/step2_TTbar_14TeV+Run4D121_Patatrack_PixelOnlyAlpaka_Profiling.log
  • 34434.750334434.7503_TTbar_14TeV+Run4D121_HLTHeterogeneousValid/step2_TTbar_14TeV+Run4D121_HLTHeterogeneousValid.log

Comparison Summary

Summary:

  • No significant changes to the logs found
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 59
  • DQMHistoTests: Total histograms compared: 4080730
  • DQMHistoTests: Total failures: 22
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4080690
  • DQMHistoTests: Total skipped: 18
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 58 files compared)
  • Checked 249 log files, 203 edm output root files, 59 DQM output files
  • TriggerResults: no differences found

AMD_W7900 Comparison Summary

There are some workflows for which there are errors in the baseline:
34434.404 step 2
The results for the comparisons for these workflows could be incomplete
This means most likely that the IB is having errors in the relvals.The error does NOT come from this pull request

Summary:

  • You potentially removed 67 lines from the logs
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 52 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 172823
  • DQMHistoTests: Total failures: 7327
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 165496
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 24 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

NVIDIA_H100 Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 59 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 172823
  • DQMHistoTests: Total failures: 8493
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 164330
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 25 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

NVIDIA_L40S Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 58 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 172823
  • DQMHistoTests: Total failures: 8227
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 164596
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 25 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

NVIDIA_T4 Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 60 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 172823
  • DQMHistoTests: Total failures: 7803
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 165020
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 25 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

Max Memory Comparisons exceeding threshold

@cms-sw/core-l2 , I found 73 workflow step(s) with memory usage exceeding the error threshold:

Expand to see workflows ...
  • Error: Workflow 4.22_RunCosmics2011A step3 max memory diff 575.5 exceeds +/- 30.0 MiB
  • Error: Workflow 4.22_RunCosmics2011A step2 max memory diff 573.7 exceeds +/- 30.0 MiB
  • Error: Workflow 4.22_RunCosmics2011A step4 max memory diff 575.6 exceeds +/- 30.0 MiB
  • Error: Workflow 4.53_RunPhoton2012B step3 max memory diff 578.0 exceeds +/- 30.0 MiB
  • Error: Workflow 5.1_TTbarFS step1 max memory diff 573.7 exceeds +/- 30.0 MiB
  • Error: Workflow 7.3_CosmicsSPLoose2018 step3 max memory diff 572.3 exceeds +/- 30.0 MiB
  • Error: Workflow 7.3_CosmicsSPLoose2018 step4 max memory diff 575.2 exceeds +/- 30.0 MiB
  • Error: Workflow 8.0_BeamHalo step3 max memory diff 572.3 exceeds +/- 30.0 MiB
  • Error: Workflow 8.0_BeamHalo step4 max memory diff 588.6 exceeds +/- 30.0 MiB
  • Error: Workflow 9.0_Higgs200ChargedTaus step3 max memory diff 577.1 exceeds +/- 30.0 MiB
  • Error: Workflow 25.0_TTbar step3 max memory diff 578.1 exceeds +/- 30.0 MiB
  • Error: Workflow 135.4_ZEEFS_13 step1 max memory diff 573.6 exceeds +/- 30.0 MiB
  • Error: Workflow 135.4_ZEEFS_13 step4 max memory diff 542.4 exceeds +/- 30.0 MiB
  • Error: Workflow 135.4_ZEEFS_13 step3 max memory diff 578.9 exceeds +/- 30.0 MiB
  • Error: Workflow 136.731_RunSinglePh2016B step3 max memory diff 578.1 exceeds +/- 30.0 MiB
  • Error: Workflow 136.793_RunDoubleEG2017C step3 max memory diff 581.3 exceeds +/- 30.0 MiB
  • Error: Workflow 136.874_RunEGamma2018C step3 max memory diff 580.4 exceeds +/- 30.0 MiB
  • Error: Workflow 139.001_RunMinimumBias2021 step3 max memory diff 580.4 exceeds +/- 30.0 MiB
  • Error: Workflow 140.56_RunHI2018 step2 max memory diff 569.9 exceeds +/- 30.0 MiB
  • Error: Workflow 1000.0_RunMinBias2011A step2 max memory diff 577.2 exceeds +/- 30.0 MiB
  • Error: Workflow 1000.0_RunMinBias2011A step3 max memory diff 569.7 exceeds +/- 30.0 MiB
  • Error: Workflow 1001.0_RunMinBias2011A step3 max memory diff 577.5 exceeds +/- 30.0 MiB
  • Error: Workflow 1001.0_RunMinBias2011A step2 max memory diff 576.1 exceeds +/- 30.0 MiB
  • Error: Workflow 1306.0_SingleMuPt1_UP15 step3 max memory diff 567.0 exceeds +/- 30.0 MiB
  • Error: Workflow 1330.0_ZMM_13 step3 max memory diff 567.1 exceeds +/- 30.0 MiB
  • Error: Workflow 1330.0_ZMM_13 step5 max memory diff 541.3 exceeds +/- 30.0 MiB
  • Error: Workflow 2022.0010001_RunTau2022D_10k step3 max memory diff 535.0 exceeds +/- 30.0 MiB
  • Error: Workflow 2023.0020001_RunJetMET02023D_10k step3 max memory diff 534.8 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0000001_RunZeroBias2024B_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0010001_RunJetMET02024C_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0020001_RunEGamma02024D_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0030001_RunDisplacedJet2024E_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0040001_RunPark2MuonLowMass02024F_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0050001_RunBTagMu2024G_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0060001_RunMuon02024H_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2024.0070001_RunTau2024I_10k step3 max memory diff 534.9 exceeds +/- 30.0 MiB
  • Error: Workflow 2025.0000002_RunZeroBias2025B_10k step3 max memory diff 497.7 exceeds +/- 30.0 MiB
  • Error: Workflow 2025.0010001_RunJetMET02025C_10k step3 max memory diff 497.7 exceeds +/- 30.0 MiB
  • Error: Workflow 11634.0_TTbar_14TeV+2022 step3 max memory diff 534.4 exceeds +/- 30.0 MiB
  • Error: Workflow 12434.0_TTbar_14TeV+2023 step3 max memory diff 534.4 exceeds +/- 30.0 MiB
  • Error: Workflow 12834.0_TTbar_14TeV+2024 step3 max memory diff 534.4 exceeds +/- 30.0 MiB
  • Error: Workflow 12846.0_ZEE_14+2024 step3 max memory diff 534.6 exceeds +/- 30.0 MiB
  • Error: Workflow 13234.0_TTbar_14TeV+2022FS step2 max memory diff 534.4 exceeds +/- 30.0 MiB
  • Error: Workflow 14034.0_TTbar_14TeV+2023FS step2 max memory diff 534.4 exceeds +/- 30.0 MiB
  • Error: Workflow 16834.0_TTbar_14TeV+2025 step3 max memory diff 534.5 exceeds +/- 30.0 MiB
  • Error: Workflow 17034.96_TTbar_14TeV+2025PU_HybridPUS1S2 step4 max memory diff 534.6 exceeds +/- 30.0 MiB
  • Error: Workflow 18434.0_TTbar_14TeV+2026 step3 max memory diff 497.4 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.0_TTbar_14TeV+Run4D121 step5 max memory diff 493.3 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.0_TTbar_14TeV+Run4D121 step3 max memory diff 489.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.75_TTbar_14TeV+Run4D121_HLT75e33Timing step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.7503_TTbar_14TeV+Run4D121_HLTHeterogeneousValid step2 max memory diff 487.6 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.751_TTbar_14TeV+Run4D121_HLT75e33TimingAlpaka step2 max memory diff 487.6 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.7521_TTbar_14TeV+Run4D121_HLT75e33TimingTiclV5TrackLinkGNN step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.7522_TTbar_14TeV+Run4D121_HLT75e33TimingMTDatHLT step2 max memory diff 489.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.753_TTbar_14TeV+Run4D121_HLT75e33TimingLegacyTracking step2 max memory diff 489.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.754_TTbar_14TeV+Run4D121_HLT75e33TimingLegacyTrackingPatatrackQuads step2 max memory diff 489.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.755_TTbar_14TeV+Run4D121_HLT75e33TimingLST step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.756_TTbar_14TeV+Run4D121_HLT75e33TimingTrimmedTracking step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.757_TTbar_14TeV+Run4D121_HLT75e33TimingMkFitFit step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.758_TTbar_14TeV+Run4D121_HLT75e33TimingTiclBarrel step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.7591_TTbar_14TeV+Run4D121_HLTPhase2WithNanoValid step2 max memory diff 494.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.77_TTbar_14TeV+Run4D121_NGTScouting step2 max memory diff 489.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.771_TTbar_14TeV+Run4D121_NGTScoutingAll step2 max memory diff 489.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.773_TTbar_14TeV+Run4D121_NGTScoutingWithNanoValid step2 max memory diff 494.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.774_TTbar_14TeV+Run4D121_L1NGTScoutingWithNanoValid step2 max memory diff 485.1 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.775_TTbar_14TeV+Run4D121_NGTScoutingCAExtensionMergeT5 step2 max memory diff 487.5 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.911_TTbar_14TeV+Run4D121_DD4hep step3 max memory diff 489.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.911_TTbar_14TeV+Run4D121_DD4hep step5 max memory diff 493.3 exceeds +/- 30.0 MiB
  • Error: Workflow 34496.0_CloseByPGun_CE_E_Front_120um+Run4D121 step5 max memory diff 493.3 exceeds +/- 30.0 MiB
  • Error: Workflow 34496.0_CloseByPGun_CE_E_Front_120um+Run4D121 step3 max memory diff 489.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34500.0_CloseByPGun_CE_H_Coarse_Scint+Run4D121 step5 max memory diff 493.3 exceeds +/- 30.0 MiB
  • Error: Workflow 34500.0_CloseByPGun_CE_H_Coarse_Scint+Run4D121 step3 max memory diff 489.0 exceeds +/- 30.0 MiB
  • Error: Workflow 34634.0_TTbar_14TeV+Run4D121PU step3 max memory diff 488.9 exceeds +/- 30.0 MiB

Max Memory Comparisons exceeding threshold NVIDIA_H100

@cms-sw/core-l2 , I found 2 workflow step(s) with memory usage exceeding the error threshold:

Expand to see workflows ...
  • Error: Workflow 34434.7503_TTbar_14TeV+Run4D121_HLTHeterogeneousValid step2 max memory diff 728.8 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.751_TTbar_14TeV+Run4D121_HLT75e33TimingAlpaka step2 max memory diff 490.0 exceeds +/- 30.0 MiB

Max Memory Comparisons exceeding threshold NVIDIA_L40S

@cms-sw/core-l2 , I found 2 workflow step(s) with memory usage exceeding the error threshold:

Expand to see workflows ...
  • Error: Workflow 34434.7503_TTbar_14TeV+Run4D121_HLTHeterogeneousValid step2 max memory diff 733.8 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.751_TTbar_14TeV+Run4D121_HLT75e33TimingAlpaka step2 max memory diff 490.0 exceeds +/- 30.0 MiB

Max Memory Comparisons exceeding threshold NVIDIA_T4

@cms-sw/core-l2 , I found 2 workflow step(s) with memory usage exceeding the error threshold:

Expand to see workflows ...
  • Error: Workflow 34434.7503_TTbar_14TeV+Run4D121_HLTHeterogeneousValid step2 max memory diff 478.8 exceeds +/- 30.0 MiB
  • Error: Workflow 34434.751_TTbar_14TeV+Run4D121_HLT75e33TimingAlpaka step2 max memory diff 488.9 exceeds +/- 30.0 MiB

@mmusich

mmusich commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@ckoraka

---> test test_heterogeneousMenu had ERRORS

the failure in this test is genuine.
Can you please:

?
This will make sure that the hltEgammaElectronPixelSeedsPortable is actually used in the HeterogeneousOnly menu (together with the whole chain of modules that it depends upon).
For the record, this bring in quite a few other non-heterogeneous modules because of the complicated chain of dependencies of the e-gamma reconstruction:

deps

Footnotes

  1. This was tested with: scram b runtests_test_heterogeneousMenu and hltPhase2UpgradeIntegrationTests --menu HeterogeneousOnly.

@makortel

Copy link
Copy Markdown
Contributor

test parameters:

@makortel

Copy link
Copy Markdown
Contributor

@cmsbuild, please build

To have a ROOT debug build with this PR included in order to continue hunting types whose dictionary being missing triggers ROOT header parsing in connection to this PR.

@makortel

Copy link
Copy Markdown
Contributor

@cmsbuild, please build

#51739 should no longer have a conflict with this PR

@cmsbuild

Copy link
Copy Markdown
Contributor

+1

Size: This PR adds an extra 40KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-401477/55486/summary.html
COMMIT: 863c01f
CMSSW: CMSSW_20_1_X_2026-08-20-1100/el9_amd64_gcc14
Additional Tests: GPU,HLT_P2_INTEGRATION,AMD_MI300X,AMD_W7900,NVIDIA_H100,NVIDIA_L40S,NVIDIA_T4
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/51200/55486/install.sh to create a dev area with all the needed externals and cmssw changes.

The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic:

You can see more details here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-401477/55486/git-recent-commits.json
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-401477/55486/git-merge-result

@fwyzard

fwyzard commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

please test

Hopefully the AMD tests should succeed now.

@fwyzard fwyzard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for taking so long - I'm finally through with the review.

Other than some suggestions to clean up the code, the main point is to make the code more generic, so float and double can be used more easily.

Based on the latest presentation I think there is in fact good reason for moving to float in most of the code.

Comment on lines +15 to +20
// Helper function to compute relative position
template <typename T>
constexpr auto relativePosition(const math::Phys3DVector<T>& point, const math::Phys3DVector<T>& origin)
-> math::Phys3DVector<T> {
return point - origin;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this could just be replaced by point - origin at the call site.


if (nrm == 0.)
if (mag == 0.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment on lines +24 to +28
constexpr Phys3DVector(const T value) : m_data{} {
CMS_UNROLL_LOOP
for (int i = 0; i < 3; i++) {
m_data[i] = value;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constexpr Phys3DVector(const T value) : m_data{} {
CMS_UNROLL_LOOP
for (int i = 0; i < 3; i++) {
m_data[i] = value;
}
constexpr Phys3DVector(const T value) : m_data{value, value, value} {}

to avoid the initialisation followed by the assignments (even if they should be optimised).

Comment on lines +31 to +35
constexpr Phys3DVector(const T x, const T y, const T z) : m_data{} {
m_data[0] = x;
m_data[1] = y;
m_data[2] = z;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constexpr Phys3DVector(const T x, const T y, const T z) : m_data{} {
m_data[0] = x;
m_data[1] = y;
m_data[2] = z;
}
constexpr Phys3DVector(const T x, const T y, const T z) : m_data{x, y, z} {}

Comment on lines +45 to +50
inline constexpr void zero() {
CMS_UNROLL_LOOP
for (int i = 0; i < 3; i++) {
m_data[i] = static_cast<T>(0);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that there are exactly three elements, I would find it more clear to unroll the loops explicitly:

Suggested change
inline constexpr void zero() {
CMS_UNROLL_LOOP
for (int i = 0; i < 3; i++) {
m_data[i] = static_cast<T>(0);
}
}
inline constexpr void zero() {
m_data[0] = static_cast<T>(0);
m_data[1] = static_cast<T>(0);
m_data[2] = static_cast<T>(0);
}

Same for all other methods.

Comment on lines +142 to +145
reco::SuperClusterDeviceCollection deviceProductSCs{event.queue(), superClusterCollectionSize};
reco::ElectronSeedDeviceCollection deviceProductSeeds{event.queue(), seedCollectionSize};
alpaka::memcpy(event.queue(), deviceProductSCs.buffer(), hostProductSCs.buffer());
alpaka::memcpy(event.queue(), deviceProductSeeds.buffer(), hostProductSeeds.buffer());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy could be avoided when the back-end is the CPU.

Comment on lines +47 to +48
template <typename TAcc, typename = std::enable_if_t<alpaka::concepts::Acc<TAcc>>>
ALPAKA_FN_ACC void operator()(TAcc const& acc,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be simply Acc1D ?

Suggested change
template <typename TAcc, typename = std::enable_if_t<alpaka::concepts::Acc<TAcc>>>
ALPAKA_FN_ACC void operator()(TAcc const& acc,
ALPAKA_FN_ACC void operator()(Acc1D const& acc,

// Constructor to compute relative points
constexpr EleRelPointPairPortable(const Vec3& p1, const Vec3& p2, const Vec3& origin)
: relP1(relativePosition(p1, origin)), relP2(relativePosition(p2, origin)) {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a deduction guide, so EleRelPointPairPortable pair(p1, p2, origin) can deduce the type of T from that of p1, p2, origin ?

continue;

const double zVertex =
getZVtxFromExtrapolation<TAcc, typename Vec3d::value_type>(acc, vertex, hitPosition, positionSC);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TAcc can be deduced from acc.

Can Vec3d::value_type be deduced from the arguments?


const double zVertex =
getZVtxFromExtrapolation<TAcc, typename Vec3d::value_type>(acc, vertex, hitPosition, positionSC);
Vec3d vertexUpdated(vertex[0], vertex[1], zVertex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a glance vertex is not used any more, so it could be updated in place ?

@fwyzard

fwyzard commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

please test for el9_amd64_gcc13

To clean the old results.

@fwyzard

fwyzard commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

-heterogeneous

To remove it from the queue, while the comments are being addressed.

@chrishanw

Copy link
Copy Markdown
Contributor

@fwyzard reading though your comments, I understand that the conclusion now is to template the floating point type essentially everywhere in the code of this branch / PR instead of just using single precision float everywhere. Is that correct?

If so, should I still run performance comparisons (execution time, (GPU) memory consumption) for float vs double? In that case I would still need to find out how to do this and on which machine. I understand (at least so far) that the timing server cannot be used for the memory studies, and that it might also be difficult to estimate the difference in execution time between float and double on that server.

@fwyzard

fwyzard commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

If we decide to use float everywhere, that should be OK.

If we need to keep double in some of the functions, then I would suggest to template them on the floating point type.

@fwyzard

fwyzard commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

If so, should I still run performance comparisons (execution time, (GPU) memory consumption) for float vs double?

Yes, I think that would be interesting

In that case I would still need to find out how to do this and on which machine.

I understand (at least so far) that the timing server cannot be used for the memory studies

I don't know what kind of information is provided by the setup on the timing server.

and that it might also be difficult to estimate the difference in execution time between float and double on that server.

I guess that depends on what workflow you run.

But it's true that for Phase-2 studies the timing server is not the best setup, for various reasons.

@chrishanw

Copy link
Copy Markdown
Contributor

Thanks @fwyzard . I'll check which machine to use for the studies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants