Skip to content

fix omp scan bug - #6560

Merged
bernhardmgruber merged 17 commits into
NVIDIA:mainfrom
charan-003:fix_omp_scan_bug
Nov 20, 2025
Merged

bernhardmgruber merged 17 commits into
NVIDIA:mainfrom
charan-003:fix_omp_scan_bug

Conversation

@charan-003

Copy link
Copy Markdown
Contributor

using the first element of each block as the init value

closes #6317

@charan-003
charan-003 requested a review from a team as a code owner November 9, 2025 09:05
@charan-003
charan-003 requested a review from davebayer November 9, 2025 09:05
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Nov 9, 2025
@copy-pr-bot

copy-pr-bot Bot commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Nov 9, 2025
Comment thread thrust/thrust/system/omp/detail/scan.h Resolved
Comment thread thrust/thrust/system/omp/detail/scan.h Resolved
Comment thread thrust/thrust/system/omp/detail/scan.h Resolved
Comment thread thrust/thrust/system/omp/detail/scan.h Resolved
@github-project-automation github-project-automation Bot moved this from In Review to In Progress in CCCL Nov 10, 2025
@bernhardmgruber

Copy link
Copy Markdown
Contributor

@charan-003 I added a few more tests.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test ae2c2c7

@github-actions

This comment has been minimized.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test f549d50

@github-actions

This comment has been minimized.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test b0d8c74

@github-actions

This comment has been minimized.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test 9ea6902

@github-actions

This comment has been minimized.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

@charan-003 I will review this next week.

@bernhardmgruber bernhardmgruber 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.

This is looking good! A few nits, otherwise LGTM!

Comment thread thrust/testing/transform_scan.cu Resolved
Comment thread thrust/testing/transform_scan.cu Resolved
Comment thread thrust/thrust/system/omp/detail/scan.h Resolved
Comment thread thrust/thrust/system/omp/detail/scan.h Resolved
Comment thread thrust/testing/transform_scan.cu Resolved
@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test a8df5c0

@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test 9a7675d

@github-actions

This comment has been minimized.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

Thank you so much for taking the time to push the fix through!

@bernhardmgruber

Copy link
Copy Markdown
Contributor

@dkolsen-pgi please re-review and unblock. Thx!

Comment thread thrust/thrust/system/omp/detail/scan.h Outdated
{
::cuda::std::exclusive_scan(block_sums.begin(), block_sums.end(), block_sums.begin(), accum_t{}, wrapped_binary_op);
// For no init inclusive scan: exclusive_scan starting at second element with first element as init
if (num_threads > 1)

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 added the assertion as suggested, but forgot to remove this now unnecessary check for num_threads > 1.

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.

Right, thanks for bringing this up.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

/ok to test 0b1e611

@bernhardmgruber
bernhardmgruber enabled auto-merge (squash) November 20, 2025 00:05

@dkolsen-pgi dkolsen-pgi 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.

I only looked at scan.h, not at the tests. That file now looks good.

@github-project-automation github-project-automation Bot moved this from In Progress to In Review in CCCL Nov 20, 2025
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 30m: Pass: 100%/84 | Total: 14h 28m | Max: 42m 40s | Hits: 88%/116157

See results here.

@bernhardmgruber
bernhardmgruber merged commit bb8a5b9 into NVIDIA:main Nov 20, 2025
97 of 98 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Nov 20, 2025
github-actions Bot pushed a commit that referenced this pull request Nov 20, 2025
Co-authored-by: Bernhard Manfred Gruber <bernhardmgruber@gmail.com>
(cherry picked from commit bb8a5b9)
@github-actions

Copy link
Copy Markdown
Contributor

Successfully created backport PR for branch/3.2.x:

elstehle added a commit that referenced this pull request Nov 20, 2025
(cherry picked from commit bb8a5b9)

Co-authored-by: charan-003 <yadavcharan003@gmail.com>
Co-authored-by: Bernhard Manfred Gruber <bernhardmgruber@gmail.com>
Co-authored-by: Elias Stehle <3958403+elstehle@users.noreply.github.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 26, 2026
…l#6560) (NVIDIA/cccl#6704)

Upstream: NVIDIA/cccl@26c79ca

HIP counterpart (system/hip): none (rocPRIM scan unaffected). Ported OMP scan fix in system/omp/detail/scan.h: blocks reduce with their first element as init (no accum_t{} identity assumption), no-init inclusive path seeds from block_sums[0] and thread 0 scans without prefix, serial fallback when n < max(threshold, num_threads); _CCCL_ASSERT dropped (not available locally; replaced by a comment). testing/scan.cu and testing/transform_scan.cu gain the new tests (THRUST_HOST_DEVICE spelling; kept local include guards, added <numeric>). test/ counterpart: mirrored in test/test_scan.cpp (Int with friend ops, TestScanWithUserDefinedTypeAndInit replacing TestInclusiveScanWithUserDefinedType, TestScanBug6317 using get_random_data, TestScanEdgeCases) and test/test_transform_scan.cpp (TransformInt, TestTransformScanEdgeCases). Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 29, 2026
…l#6560) (NVIDIA/cccl#6704)

Upstream: NVIDIA/cccl@26c79ca

HIP counterpart (system/hip): none (rocPRIM scan unaffected). Ported OMP scan fix in system/omp/detail/scan.h: blocks reduce with their first element as init (no accum_t{} identity assumption), no-init inclusive path seeds from block_sums[0] and thread 0 scans without prefix, serial fallback when n < max(threshold, num_threads); _CCCL_ASSERT dropped (not available locally; replaced by a comment). testing/scan.cu and testing/transform_scan.cu gain the new tests (THRUST_HOST_DEVICE spelling; kept local include guards, added <numeric>). test/ counterpart: mirrored in test/test_scan.cpp (Int with friend ops, TestScanWithUserDefinedTypeAndInit replacing TestInclusiveScanWithUserDefinedType, TestScanBug6317 using get_random_data, TestScanEdgeCases) and test/test_transform_scan.cpp (TransformInt, TestTransformScanEdgeCases). Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 29, 2026
…l#6560) (NVIDIA/cccl#6704)

Upstream: NVIDIA/cccl@26c79ca

HIP counterpart (system/hip): none (rocPRIM scan unaffected). Ported OMP scan fix in system/omp/detail/scan.h: blocks reduce with their first element as init (no accum_t{} identity assumption), no-init inclusive path seeds from block_sums[0] and thread 0 scans without prefix, serial fallback when n < max(threshold, num_threads); _CCCL_ASSERT dropped (not available locally; replaced by a comment). testing/scan.cu and testing/transform_scan.cu gain the new tests (THRUST_HOST_DEVICE spelling; kept local include guards, added <numeric>). test/ counterpart: mirrored in test/test_scan.cpp (Int with friend ops, TestScanWithUserDefinedTypeAndInit replacing TestInclusiveScanWithUserDefinedType, TestScanBug6317 using get_random_data, TestScanEdgeCases) and test/test_transform_scan.cpp (TransformInt, TestTransformScanEdgeCases). Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Naraenda pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 30, 2026
…l#6560) (NVIDIA/cccl#6704)

Upstream: NVIDIA/cccl@26c79ca

HIP counterpart (system/hip): none (rocPRIM scan unaffected). Ported OMP scan fix in system/omp/detail/scan.h: blocks reduce with their first element as init (no accum_t{} identity assumption), no-init inclusive path seeds from block_sums[0] and thread 0 scans without prefix, serial fallback when n < max(threshold, num_threads); _CCCL_ASSERT dropped (not available locally; replaced by a comment). testing/scan.cu and testing/transform_scan.cu gain the new tests (THRUST_HOST_DEVICE spelling; kept local include guards, added <numeric>). test/ counterpart: mirrored in test/test_scan.cpp (Int with friend ops, TestScanWithUserDefinedTypeAndInit replacing TestInclusiveScanWithUserDefinedType, TestScanBug6317 using get_random_data, TestScanEdgeCases) and test/test_transform_scan.cpp (TransformInt, TestTransformScanEdgeCases). Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
Beanavil pushed a commit to ROCm/rocm-libraries that referenced this pull request Oct 30, 2026
…l#6560) (NVIDIA/cccl#6704)

Upstream: NVIDIA/cccl@26c79ca

HIP counterpart (system/hip): none (rocPRIM scan unaffected). Ported OMP scan fix in system/omp/detail/scan.h: blocks reduce with their first element as init (no accum_t{} identity assumption), no-init inclusive path seeds from block_sums[0] and thread 0 scans without prefix, serial fallback when n < max(threshold, num_threads); _CCCL_ASSERT dropped (not available locally; replaced by a comment). testing/scan.cu and testing/transform_scan.cu gain the new tests (THRUST_HOST_DEVICE spelling; kept local include guards, added <numeric>). test/ counterpart: mirrored in test/test_scan.cpp (Int with friend ops, TestScanWithUserDefinedTypeAndInit replacing TestInclusiveScanWithUserDefinedType, TestScanBug6317 using get_random_data, TestScanEdgeCases) and test/test_transform_scan.cpp (TransformInt, TestTransformScanEdgeCases). Not compiled, tests not run (per human)

Co-Authored-By: Claude <noreply@anthropic.com>
amd-jmahovsky added a commit to ROCm/rocm-libraries that referenced this pull request Nov 4, 2026
…l#6560)

Upstream: NVIDIA/cccl@bb8a5b9

- already ported — identical to its `branch/3.2.x` backport 26c79caf60e (NVIDIA/cccl#6704; `+`/`-` lines compared, no difference), ported in ad694ae plus parity fix 5bdd5a9; `thrust/system/omp/detail/scan.h`, `testing/scan.cu` and `testing/transform_scan.cu` already match
- HIP counterpart: none (no `thrust/system/cuda/` change)
- test/ counterpart: `test/test_scan.cpp` / `test/test_transform_scan.cpp` handled when the backport was ported (ad694ae); no further change
- Not compiled, tests not run (autonomous no-build mode)

Co-Authored-By: Claude <noreply@anthropic.com>
amd-jmahovsky added a commit to ROCm/rocm-libraries that referenced this pull request Nov 4, 2026
…l#6560)

Upstream: NVIDIA/cccl@bb8a5b9

- already ported — identical to its `branch/3.2.x` backport 26c79caf60e (NVIDIA/cccl#6704; `+`/`-` lines compared, no difference), ported in ad694ae plus parity fix 5bdd5a9; `thrust/system/omp/detail/scan.h`, `testing/scan.cu` and `testing/transform_scan.cu` already match
- HIP counterpart: none (no `thrust/system/cuda/` change)
- test/ counterpart: `test/test_scan.cpp` / `test/test_transform_scan.cpp` handled when the backport was ported (ad694ae); no further change
- Not compiled, tests not run (autonomous no-build mode)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG]: stdpar multicore scan tests fail at runtime after commit 1238f287f4f654bff12e4d4a29b7dfa1c40a12fe

3 participants