Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$x .= $x->index(...) leads to "Not physical but doesn't have parent at ufunc.pd" when used later #467

Closed
djerius opened this issue Mar 11, 2024 · 3 comments

Comments

@djerius
Copy link
Contributor

djerius commented Mar 11, 2024

Howdy,

The following code used to work back in the day (2.016?), but now fails.

Loaded PDL v2.084 (supports bad values)
pdl> $x = sequence(1000)

pdl> $idx = random( $x->nelem) * $nelem

pdl> $x .= $x->index($idx);

pdl> p $x->min
PDL Not physical but doesn't have parent at ufunc.pd line 564.
        PDL::min(PDL=SCALAR(0x1fffdc8)) called at (eval 218) line 4
        main::__ANON__() called at /home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-mst/bin/perldl line 682
        eval {...} called at /home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-mst/bin/perldl line 682
        main::eval_and_report("p \$x->min\x{a}") called at /home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-mst/bin/perldl line 618
        main::process_input() called at /home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-mst/bin/perldl line 638
        eval {...} called at /home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-mst/bin/perldl line 638
@mohawk2
Copy link
Member

mohawk2 commented Mar 11, 2024

I just tried this with latest master. It worked fine. Can you confirm which version of PDL you tried this with?

mohawk2 added a commit that referenced this issue Mar 12, 2024
@mohawk2
Copy link
Member

mohawk2 commented Mar 12, 2024

The error shown did happen while I was fixing the DATACHANGED propagation, and was caused by that being propagated to the output (aka child) of a non-flowing operation (like here, .= aka assgn). The fix was to not propagate to non-flowing output transes:

if (!(trans->flags & PDL_ITRANS_DO_DATAFLOW_F)) continue;

That worked because make_physical shortcuts if the ndarray doesn't have DATACHANGED set, as there's nothing to do.

@mohawk2
Copy link
Member

mohawk2 commented Mar 12, 2024

You can prove this yourself by updating to the latest master, which includes the test you show here, and deleting line 870 of pdlapi.c, as I just tried, and seeing the test fail, as I just saw. It looks like you are reporting a bug that doesn't exist. Please be careful about that.

@mohawk2 mohawk2 closed this as completed Mar 12, 2024
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

No branches or pull requests

2 participants