LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting "inline subVI" seems to be disabling constant folding

I'm running this VI 100,000 times in a for loop. With "preallocated" on and "allow debug" off, it takes about 165 ms. As soon as I select "inline", it jumps up to ~4,000 ms. My guess is that it's disabling contant folding (which would cause more processing time in the for loop). I thought inlining was supposed to make things faster 😉

folding and inline.png

Here's the caller if it helps. Everything is normal (Debug on, non-reentrant, no inline)

Fold caller.png

 

CLED (2016)
0 Kudos
Message 1 of 21
(3,637 Views)

Can you attach the actual VIs instead of snippets? Thanks.

(snippets don't show VI settings and such).

0 Kudos
Message 2 of 21
(3,619 Views)

Sure. I'm toggling the inline option on Constant Folding.vi and checking the execution time on Performance test

CLED (2016)
Download All
0 Kudos
Message 3 of 21
(3,605 Views)

Interesting.

 

I can confirm the same under LabVIW 2013sp1. Seems like a bug.

0 Kudos
Message 4 of 21
(3,599 Views)

@altenbach wrote:

Interesting.

 

I can confirm the same under LabVIW 2013sp1. Seems like a bug.




Your caller inputs to the inline me vi are not constant!  how could the inlined vi be folded?

 

You can not fold a routine that gets a random array!  What if "Fold me" was replaced by sort array? (that is a really poor sort )


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 21
(3,582 Views)

Jeff·Þ·Bohrer wrote:

Your caller inputs to the inline me vi are not constant!  how could the inlined vi be folded?

 

You can not fold a routine that gets a random array!  What if "Fold me" was replaced by sort array? (that is a really poor sort )


No, but the FOR loop inside of the inlined VI should be folded since it gets a constant array as an input.  That is what is adding all of the time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 21
(3,542 Views)

Once the subVI is inlined, only the debug setting of the caller should matter. However after disabling debugging of the caller, we still don't get any folding advantage. This is not right.

 

In the subVI, everything except "index array" should get folded. The FOR loop only depends on diagram constants and thus can be computed at compile time and replaced by a single new diagram constant. In fact it is, as seen by the structure folding display:

 

 

 

The inline setting should be irrelevant, but it is apparently not. Somehow it forces the loop to be computed over and over with every call. (guessing from the long time it takes. Wht else could be slowng it down?!)

0 Kudos
Message 7 of 21
(3,523 Views)

Something is definatly not right.

 

Just because I suspected something odd with the clone pool checkout (which turned out to be moot since the sub-vi is inlined)

Then I configured loop parallism

 

x-y became 0

!1-1.png

but the vi still executed about as fast as expected (@2x speed)

 

That can't be right 0 ms!!!???????

Lets swap to a different timer

!2.png

MICROSECONDS! in x-y Yet the vi still took about 2.xx seconds to execute

 

Maybe the random gen loop took some time:  Nope about 7mSec

 

Somebody did something !

 

OK lets double down on the data flow.

Mind Blower!.png

 

Spooky.  Eerie

 yup I'll go find a hole to hide in 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 21
(3,508 Views)

@JÞB wrote:

Something is definatly not right.

 

Mind Blower!.png

 


Did you notice that your parallel FOR loop finished IN THE PAST!!!  Yeah, I'd say something got screwed up there.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 21
(3,498 Views)

@crossrulz wrote:

@JÞB wrote:

Something is definatly not right.

 


Did you notice that your parallel FOR loop finished IN THE PAST!!!  Yeah, I'd say something got screwed up there.


YUP.  That's when I went and hid.  

 

Then before Dr. K could arrive and make me look foolish

!1-1.png


"Should be" isn't "Is" -Jay
Message 10 of 21
(3,494 Views)