Skip to content

Fix output offsets in threaded complete reductions - #85

Merged
lkdvos merged 2 commits into
mainfrom
ld-fix-reduction-offset
Oct 7, 2026
Merged

lkdvos merged 2 commits into
mainfrom
ld-fix-reduction-offset

Conversation

@lkdvos

@lkdvos lkdvos commented Oct 7, 2026

Copy link
Copy Markdown
Member

Respect the destination offset in threaded complete reductions and use the scratch buffer's own offset.

Regression tests pass with 1, 2, and 4 threads.

@lkdvos

lkdvos commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

macOS failure should be unrelated since that code is not touched here. Probably pre-existing on main after one of the upstream updates, it seems like the GPU kernel can't fully inline and therefore not compile, not sure if this is something we really can do a lot about

Comment thread src/mapreduce.jl
threadedout = similar(arrays[1], spacing * get_num_threads())
a = arrays[1][ParentIndex(1)]
iout = ParentIndex(offsets[1] + 1)
a = arrays[1][iout]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was an actual bug? Interesting that it hadn't caused havoc yet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I'm also unclear where this came from, I can confirm it was a bug and failed before, but I also didn't bump into it myself 🤷

@Jutho Jutho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved, but some tests with Metal arrays seem to be failing.

@lkdvos
lkdvos merged commit 1122248 into main Oct 7, 2026
9 of 12 checks passed
@lkdvos
lkdvos deleted the ld-fix-reduction-offset branch October 7, 2026 14:16
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/mapreduce.jl 93.65% <100.00%> (+0.27%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

lkdvos referenced this pull request Oct 8, 2026
* Skip layout planning for single-element arrays

* Skip stride ranking when the memory estimate fits (#92)

* Fix single-element GPU tests on Metal and CUDA

The `map!` closure captured the loop variable `T`, which is not isbits
and so cannot be passed to a GPU kernel; use `one(x)` instead. The
in-place reduction check compared GPU and CPU `cos` results exactly,
which can differ by an ulp; compare approximately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants