Skip to content

Fix dest→source multithread chunk sizing and add single-vs-multithread parity coverage#4

Merged
dodu94 merged 3 commits into
mainfrom
copilot/bugfix-multithread-destination-to-source
Jun 9, 2026
Merged

Fix dest→source multithread chunk sizing and add single-vs-multithread parity coverage#4
dodu94 merged 3 commits into
mainfrom
copilot/bugfix-multithread-destination-to-source

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown

Destination→source interpolation could fail in multithread mode when worker count exceeded destination points, due to mismatched partial block shapes during assembly. This update scopes block outputs to the active slice and adds explicit parity coverage to ensure multithread and single-core paths produce identical results.

  • Root cause

    • In interpolate_block (dest→source mode), the block output buffer was allocated using full destination length instead of the current chunk length.
    • Empty/small trailing chunks then returned shapes incompatible with caller-side contiguous block writes.
  • Code change

    • Allocate dest→source block output strictly by active slice length:
    block_size = max(chunk_idx.stop - chunk_idx.start, 0)
    interpolated = np.zeros([block_size, config.num_components])
  • Regression coverage

    • Added a focused test that forces more threads than destination points and verifies dest→source interpolation no longer fails on empty trailing blocks.
    • Added a parity test asserting dest→source outputs (interpolated, unmapped) are exactly equal between multithread=False and multithread=True for the same input.

Copilot AI linked an issue Jun 9, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix multithread bug for destination to source mode Fix dest→source multithread chunk sizing in interpolation Jun 9, 2026
Copilot finished work on behalf of dodu94 June 9, 2026 13:21
Copilot AI requested a review from dodu94 June 9, 2026 13:21

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

seems ok, please add a test where it is demonstrated that multithread and single core interpolations yield exactly the same result

@dodu94 dodu94 marked this pull request as ready for review June 9, 2026 14:02
Copilot AI requested a review from dodu94 June 9, 2026 14:03
Copilot finished work on behalf of dodu94 June 9, 2026 14:03
Copilot AI changed the title Fix dest→source multithread chunk sizing in interpolation Fix dest→source multithread chunk sizing and add single-vs-multithread parity coverage Jun 9, 2026
Copilot finished work on behalf of dodu94 June 9, 2026 14:16
@dodu94 dodu94 merged commit f8d6680 into main Jun 9, 2026
8 checks passed
@dodu94 dodu94 deleted the copilot/bugfix-multithread-destination-to-source branch June 9, 2026 14:21
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.

[BUG] - Mulithread bugged for dest to source mode

2 participants