Skip to content

Fix invalid codegen for #7451. - #7456

Merged
sklam merged 2 commits into
numba:masterfrom
stuartarchibald:fix/7451
Oct 5, 2021
Merged

sklam merged 2 commits into
numba:masterfrom
stuartarchibald:fix/7451

Conversation

@stuartarchibald

Copy link
Copy Markdown
Contributor

As title.

Fixes #7451

@stuartarchibald

Copy link
Copy Markdown
Contributor Author

6562250 extends a current unit test to include prescribing a negative axis value to trigger the bug described here: #7451 (comment). This will manifest as not being able to broadcast.

@stuartarchibald stuartarchibald added this to the Numba 0.55 RC milestone Oct 5, 2021
As title. Adds wraparound logic.
@stuartarchibald

Copy link
Copy Markdown
Contributor Author

The addition of f3755f2 fixes the problem demonstrated in 6562250.

@stuartarchibald

Copy link
Copy Markdown
Contributor Author

Buildfarm ID: numba_smoketest_cpu_yaml_50.

@gmarkall

gmarkall commented Oct 5, 2021

Copy link
Copy Markdown
Member

This fixes this particular issue, but should we instead change tuple_setitem so that it supports negative indexing? What if there are other latent instances of this issue in the codebase?

@gmarkall

gmarkall commented Oct 5, 2021

Copy link
Copy Markdown
Member

This fixes this particular issue, but should we instead change tuple_setitem so that it supports negative indexing? What if there are other latent instances of this issue in the codebase?

Or maybe "also", since I see why the change is needed to allow broadcasting here.

@stuartarchibald

Copy link
Copy Markdown
Contributor Author

This fixes this particular issue, but should we instead change tuple_setitem so that it supports negative indexing? What if there are other latent instances of this issue in the codebase?

Thanks for checking the patch. Suggest talking about this at the public meeting today. The function is "unsafe" by design, I guess the question is how unsafe that should be.

@stuartarchibald

Copy link
Copy Markdown
Contributor Author

Buildfarm ID: numba_smoketest_cpu_yaml_50.

Passed on f3755f2

@stuartarchibald stuartarchibald added the BuildFarm Passed For PRs that have been through the buildfarm and passed label Oct 5, 2021
@gmarkall

gmarkall commented Oct 5, 2021

Copy link
Copy Markdown
Member

The function is "unsafe" by design, I guess the question is how unsafe that should be.

I think at the moment it's a bit of a footgun, because a user would reasonably expect it to handle negative indexing (consistent with lots of other indexing use cases) but its documentation makes no mention of it not supporting negative indexing. If we decide not to support negative indexing, then I think it would be good to mention that it doesn't support negative indexing in the docs.

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

Looks good!

@stuartarchibald

Copy link
Copy Markdown
Contributor Author

The function is "unsafe" by design, I guess the question is how unsafe that should be.

I think at the moment it's a bit of a footgun, because a user would reasonably expect it to handle negative indexing (consistent with lots of other indexing use cases) but its documentation makes no mention of it not supporting negative indexing. If we decide not to support negative indexing, then I think it would be good to mention that it doesn't support negative indexing in the docs.

Agree, it either needs the checks or some big warning about what "in-bounds" means, i.e. not the Python version.

I think given the current PR backlog, as this fixes the immediate issue it should be merged in as it makes mainline stable again and permits merges of other PRs. However, I'll raise the question of "how safe is numba.*.unsafe.*?" at the public meeting today. This also makes me wonder if there should be a "safe" mode where things like this are checked.

@stuartarchibald

Copy link
Copy Markdown
Contributor Author

Looks good!

Thanks for the review @gmarkall

@sklam

sklam commented Oct 5, 2021

Copy link
Copy Markdown
Member

I see all unsafe intrinsics as the same level of safety as inlineasm; thus, no safety checks at all. We can provide a "safe" version of it though but leave dev a choice to opt into the unsafe and faster one.

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

LGTM

@sklam sklam added 5 - Ready to merge Review and testing done, is ready to merge and removed 3 - Ready for Review labels Oct 5, 2021
@sklam
sklam merged commit 4a3d575 into numba:master Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge BuildFarm Passed For PRs that have been through the buildfarm and passed Effort - short Short size effort needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Corruption on ppc64le/arm64 (potential codegen/LLVM opt bug)

3 participants