Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define HOST_DEVICE_CONSTANT to implement constexpr aggregate host/device constants #37159

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

fwyzard
Copy link
Contributor

@fwyzard fwyzard commented Mar 7, 2022

PR description:

The use of host-side consexpr constants in device code is limited to

  • scalars (other than long double)
  • scalar elements of aggregates used inside constexpr functions

In particular, it's not possible to use constexpr scalars by pointer or reference (e.g. std::min() takes arguments by reference), or pass constexpr arrays as pointers, or access elements of constexpr arrays outside of constexpr functions.

The workaround is to define a macro that evaluates to constexpr on the host, and to __device__ constexpr on the device. Such macro can be used to declare aggregate objects that are available both on the host and on the device.
Note these objects may be at different memory addresses on the host and device, so their pointers will be different -- but the actual values should be the same.

PR validation:

None.

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 7, 2022

please test

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 7, 2022

+heterogeneous

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 7, 2022

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-37159/28712

  • This PR adds an extra 12KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 7, 2022

A new Pull Request was created by @fwyzard (Andrea Bocci) for master.

It involves the following packages:

  • HeterogeneousCore/CUDAUtilities (heterogeneous)

can you please review it and eventually sign? Thanks.
@makortel, @rovere this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 7, 2022

-heterogeneous

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 7, 2022

This solution does not work for static class members

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 7, 2022

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-04ea6d/22897/summary.html
COMMIT: dbd639c
CMSSW: CMSSW_12_3_X_2022-03-06-2300/slc7_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/37159/22897/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-04ea6d/22897/git-recent-commits.json
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-04ea6d/22897/git-merge-result

Comparison Summary

Summary:

  • No significant changes to the logs found
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 21 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3982683
  • DQMHistoTests: Total failures: 1522
  • DQMHistoTests: Total nulls: 102
  • DQMHistoTests: Total successes: 3981037
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 1749.924 KiB( 48 files compared)
  • DQMHistoSizes: changed ( 11634.0,... ): 575.473 KiB HLT/JME
  • DQMHistoSizes: changed ( 11634.0,... ): -145.715 KiB HLT/TAU
  • DQMHistoSizes: changed ( 11634.0,... ): -54.248 KiB HLT/HIG
  • DQMHistoSizes: changed ( 11634.0,... ): -50.805 KiB HLT/EXO
  • DQMHistoSizes: changed ( 11634.0,... ): -35.098 KiB HLT/Objects
  • DQMHistoSizes: changed ( 11634.0,... ): 9.352 KiB HLT/HLTEgammaValidation
  • DQMHistoSizes: changed ( 11634.0,... ): -6.535 KiB HLT/Higgs
  • DQMHistoSizes: changed ( 11634.0,... ): -5.961 KiB HLT/Exotica
  • DQMHistoSizes: changed ( 11634.0,... ): 5.191 KiB HLT/Filters
  • Checked 204 log files, 45 edm output root files, 49 DQM output files
  • TriggerResults: found differences in 6 / 48 workflows

@fwyzard fwyzard force-pushed the implement_HostDeviceConstant branch from dbd639c to cae2de9 Compare March 7, 2022 22:11
@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 7, 2022

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 7, 2022

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-37159/28727

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 7, 2022

Pull request #37159 was updated. @makortel, @smuzaffar, @Dr15Jones can you please check and sign again.

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 8, 2022

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-04ea6d/22918/summary.html
COMMIT: cae2de9
CMSSW: CMSSW_12_3_X_2022-03-07-1100/slc7_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/37159/22918/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 7 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3984447
  • DQMHistoTests: Total failures: 7
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 3984417
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 48 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 204 log files, 45 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 8, 2022

+1

@makortel
Copy link
Contributor

makortel commented Mar 8, 2022

+core

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 8, 2022

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

perrotta commented Mar 8, 2022

+1

@cmsbuild cmsbuild merged commit 7394df0 into cms-sw:master Mar 8, 2022
@fwyzard fwyzard deleted the implement_HostDeviceConstant branch July 31, 2022 13:43
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.

4 participants