llvmlite icon indicating copy to clipboard operation
llvmlite copied to clipboard

`fanout_raise` in `refpruning` algorithm doesn't work on this subtle case

Open dlee992 opened this issue 2 years ago • 1 comments

Continue from https://github.com/numba/numba/issues/9213 Tested with 0.39.1. I feel latest version still has this issue.

I found a subtle case for refcounting, which our refpruning algorithm under ffi can't prune it. However, it should be in theory, since I think any path reaching raise block can be ignored?

image

Just want to make sure that you also think this's prunable. I do have a real case having this kind of pattern and have a workaround for this. Removing these refcounting calls can boost 5%~10% performance for my benchmark.

cc @sklam

dlee992 avatar Dec 16 '23 00:12 dlee992

However, it should be in theory, since I think any path reaching raise block can be ignored?

Yes, that's right. In other words, we pretend that the raise block has corresponding decrefs. The effect is that we allow the raise block to leak.

sklam avatar Jan 18 '24 23:01 sklam