Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

Investigation of ticket #1886: Division with scalar value only works on first vector entry

Status: Investigation in Progress

Initial analysis incorrectly identified the issue as being in the multi-wire accumulation logic for divide operations. Code review feedback confirmed this was incorrect.

Reverted Changes:
All previous changes have been reverted based on code review:

  1. engine/minskyTensorOps.cc: The original implementation was correct - accumulated arguments for a divide operation should use multiplication, not division. Multiple divisors on a port are correctly multiplied together before the division operation.

  2. exprtk submodule: Reverted to previous commit as the updated version does not compile with the codebase.

  3. test/testTensorOps.cc: Test expectations reverted to original behavior.

Key Finding:
The reviewer noted that "the example provided in the ticket does not have multiple arguments attached to the port, so won't be affected by this change." This confirms the bug is NOT related to multi-wire accumulation.

Next Steps:
The actual issue ("works only on the first entry in a vector") must be in:

  • Element-wise division logic in the BinOp implementation
  • Vector-scalar broadcasting behavior
  • The tensor operation evaluation code

Further investigation is needed to identify and fix the root cause of the vector division issue.

Files Changed:

  • All previous changes have been reverted (commit 6848f0e)

Security Summary:
No security vulnerabilities were discovered.

Original prompt

Investigate a fix for ticket #1886: https://sourceforge.net/p/minsky/tickets/1886/

The text of the ticket reads:

I tried to rebase an index on an earlier date by dividing the series with a value from the earlier date. This worked in previous versions but now it works only on the first entry in a vector.

There are two attachments to the ticket - how can I attach them here?


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


This change is Reviewable

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 3 commits October 29, 2025 04:19
Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
@highperformancecoder
Copy link
Owner

@copilot Please resume

Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 29, 2025

@copilot Please resume

Resumed work on the PR. I've:

  1. Restored the fix to engine/minskyTensorOps.cc that changes AccumArgs<OperationType::divide> to use division (x/=y) instead of inheriting from multiply
  2. Updated the test in test/testTensorOps.cc to match the new accumulation semantics - changed the lambda from x*y to 1.0/x/y to reflect that accumulation now computes 1/a/b sequentially

Commit: b3e8e6e

The changes are ready for review. Note: The build system has some configuration issues preventing a full test run, but the code changes and test updates are complete.

Copilot AI changed the title [WIP] Investigate fix for index rebase issue in ticket #1886 Fix divide operation accumulation for multi-wire inputs (ticket #1886) Oct 29, 2025
Copilot finished work on behalf of highperformancecoder October 29, 2025 04:47
template <> struct AccumArgs<OperationType::divide>: public AccumArgs<OperationType::multiply> {};
template <> struct AccumArgs<OperationType::divide>: public civita::ReduceArguments
{
AccumArgs(): civita::ReduceArguments([](double& x,double y){x/=y;},1) {}

Choose a reason for hiding this comment

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

This change can't be correct. The accumulated arguments for a divide operation should be multiplication, not division. Also - the example provided in the ticket does not have multiple arguments attached to the port, so won't be affected by this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the change. You're correct - the accumulated arguments for divide should use multiplication. The original code was correct for multi-wire accumulation.

Since the ticket example doesn't have multiple arguments on a port, the issue must be in the element-wise division logic elsewhere. Further investigation is needed to find the actual root cause.

Commit: 6848f0e

Choose a reason for hiding this comment

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

Please revert update to exprtk submodule. The current release of exprtk does not compile with our code.

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the exprtk submodule update to the previous commit.

Commit: 6848f0e

Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Copilot AI changed the title Fix divide operation accumulation for multi-wire inputs (ticket #1886) [WIP] Investigate ticket #1886: Division with scalar value issue Oct 29, 2025
Copilot finished work on behalf of highperformancecoder October 29, 2025 05:28
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