Skip to content

Pixelimage morphing#48343

Closed
Chirayu18 wants to merge 23 commits intocms-sw:masterfrom
CMSTrackerDPG:pixelimage_morphing
Closed

Pixelimage morphing#48343
Chirayu18 wants to merge 23 commits intocms-sw:masterfrom
CMSTrackerDPG:pixelimage_morphing

Conversation

@Chirayu18
Copy link
Copy Markdown
Contributor

PR description:
This PR implements a new data format for the clustering algorithm for the pixel digis. The new data format is a densely populated 2D image as compared to the 1D sparsely populated digi_view. Also this PR can optionally apply the morphing algorithm for adding fake digis before doing the clustering. This morphing feature proceeds with a dilation step followed by an erosion. In the config these kernels are defined as a 1D array which store the matrix elements for the 3x3 kernels. The following options can now be set in the EDProducer config.:
DoDigiMorphing = cms.bool(True), #Default False
DigiMorphing = cms.PSet(
kernel1 = cms.vint32(1, 1, 1, 1,1,1,1,1,1), # Example kernel values for the dilation kernel
kernel2 = cms.vint32(0, 1, 0, 1,1,1,0,1,1), # Example kernel values for the erosion kernel
)

Implementation details:

  • SiPixelMorphing.cc defined for storing configuration of morphing parameters
  • Two ImageSoA’s types are now available and depending on the doDigiMorphing flag, either one is used. For no morphing, the SoA with single layer padding is used and for morphing, 2 layer padding. This saves memory consumption in case morphing is disabled
  • The makePhase1ClustersAsync function is now templated with ImageType and TrackerTraits(default) and all templated function definitions are defined in SiPixelRawToClusterKernel.dev.cc file
  • The templated Image is passed to the FindClus kernel which is also templated with ImageType

PR validation:
The code compiles. Comparisions with the legacy CPU code and the current GPU code were also made here: https://indico.cern.ch/event/1555234/contributions/6567409/attachments/3087292/5466320/digimorphing_2%20(1).pdf

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 17, 2025

cms-bot internal usage

@cmsbuild
Copy link
Copy Markdown
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-48343/45226

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@Chirayu18 Chirayu18 marked this pull request as draft June 17, 2025 12:12
@Chirayu18 Chirayu18 marked this pull request as ready for review June 17, 2025 12:17
@cmsbuild
Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-48343/45227

@cmsbuild
Copy link
Copy Markdown
Contributor

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

It involves the following packages:

  • RecoLocalTracker/SiPixelClusterizer (reconstruction)

@cmsbuild, @jfernan2, @mandrenguyen can you please review it and eventually sign? Thanks.
@GiacomoSguazzoni, @VinInn, @VourMa, @dkotlins, @felicepantaleo, @ferencek, @gpetruc, @missirol, @mmusich, @mroguljic, @mtosi, @rovere, @threus, @tsusa, @tvami this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-48343/45518

@cmsbuild
Copy link
Copy Markdown
Contributor

Pull request #48343 was updated. @cmsbuild, @fwyzard, @jfernan2, @makortel, @mandrenguyen can you please check and sign again.

@fwyzard
Copy link
Copy Markdown
Contributor

fwyzard commented Jul 16, 2025

please test

@cmsbuild
Copy link
Copy Markdown
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-48343/45529

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Copy Markdown
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-48343/45553

Code check has found code style and quality issues which could be resolved by applying following patch(s)

alpaka::syncBlockThreads(acc);

for (uint32_t i : cms::alpakatools::independent_group_elements(acc, firstPixel, lastPixel - 1)) {
alpaka::syncBlockThreads(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.

you don;t need to syncBlockThreads one after the other

Suggested change
alpaka::syncBlockThreads(acc);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, will commit this change

for (uint32_t j : cms::alpakatools::independent_group_elements(acc, morphingsize)) {
uint16_t row = j / (pixelStatus::pixelSizeY + 2) + 1;
uint16_t col = j % (pixelStatus::pixelSizeY + 2) + 1;
for (int i = 0; i < 3 && image.clus()[col][row] == pixelStatus::fakeVal; i++) {
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.

shouldn't this be

Suggested change
for (int i = 0; i < 3 && image.clus()[col][row] == pixelStatus::fakeVal; i++) {
if (image.clus()[col][row] != pixelStatus::fakeVal) {
continue;
}
for (int i = 0; i < 3; i++) {

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.

otherwise the case i = 0 is performed also for the non-fake pixels.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, will commit this change

for (uint32_t j : cms::alpakatools::independent_group_elements(acc, morphingsize)) {
uint16_t row = j / (pixelStatus::pixelSizeY + 2) + 1;
uint16_t col = j % (pixelStatus::pixelSizeY + 2) + 1;
for (int i = 0; i < 3 && image.clus()[col][row] == pixelStatus::empVal; i++) {
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.

I think this should be

Suggested change
for (int i = 0; i < 3 && image.clus()[col][row] == pixelStatus::empVal; i++) {
if (image.clus()[col][row] != pixelStatus::empVal) {
continue;
}
for (int i = 0; i < 3 && image.clus()[col][row] == pixelStatus::empVal; i++) {

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes indeed. I missed the i=0 cases

@fwyzard
Copy link
Copy Markdown
Contributor

fwyzard commented Aug 22, 2025

I assume this should be closed in favour of #48734 ?

@fwyzard
Copy link
Copy Markdown
Contributor

fwyzard commented Aug 22, 2025

-heterogeneous

Assuming this should be superseded by #48734.

@cmsbuild
Copy link
Copy Markdown
Contributor

Milestone for this pull request has been moved to CMSSW_16_0_X. Please open a backport if it should also go in to CMSSW_15_1_X.

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Oct 31, 2025

@cmsbuild, please close

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.

7 participants