03-28-2013 01:34 PM
I can see the argument for the poly VI being able to handle this, as I said I would give the idea kudos!
For your specific case, it seems to me like you might be better off using two poly VIs (one for packing and one for unpacking). It seems like the more logical grouping and it would also function without the conditional disable structures.
Regarding your statement about dynamic dispatch and FPGA, Nick knows more about that than I do, but this article from the help indicates you can do dynamic dispatch on FPGA. This devzone states "You can use dynamic dispatching with certain restrictions when creating FPGA VIs." I am not sure offhand what those restrictions are, but it looks like it definitely is supported.
Regards,
Jeff
03-28-2013 02:16 PM
Shane,
To answer your question on what happens with unused polymorphic instances during FPGA compilation:
You are correct that there is no option for remove unused polymorphic instances in the build specification, this is because this is handled automatically in code generation for FPGA. Since that instance of the polymorph never changes on FPGA, the unused instances are removed by default.
In order for us to reach that point in code generation (between finishing your LV block diagram and running FPGA compilation), LabVIEW must detect that the block diagram is executable. When polymorphic VIs are used, that decision is made based on all polymorphic instances (even though for FPGA the unused instances aren't included for compilation).
I agree with both you and Jeff that allowing broken polymorphic instances (not used) would be an intersting topic for the idea exchange in consideration for a future release. It would definitely alleviate some programming headaches when building VIs for multiple targets. If you choose to post the idea, post a link here so we can give kudos to the idea.
03-29-2013 05:14 AM
Before I make a new idea, I'd first like to ask a couple more questions.
What use cases are there NOT to remove unused polymorphic instances from an executable? Dynamically loading code after compiling?
I would propose that a setting to remove unused polymorphic instances in code should lead to the compiler NOT breaking the code when the unused instances are not being used. Is such a thing even feasible?
Shane.
03-29-2013 09:34 AM
Hi Shane,
As you said, the main use case is dynamically calling those instances at runtime. Having that checkbox in the app builder also gives more flexibility during troubleshooting in case app builder has incorrectly removed unused instances (although I have never seen a case where this has happened).
Regarding your proposal, there is a distinction to be made here between the compiler and the app builder. Currently the setting to remove unused polymorphic instances resides in the app builder. The check to see if any instances of the polymorphic VIs are not executable happens in the compiler, and breaks the main VI. This means that when the app builder goes to build, the main VI is not executable, and the app builder will fail, independant of removing unused polymorphic instances. I spoke to the developer for the poly VIs, and I think the most feasible approach would be to change the way that a poly VI determines it is broken. Instead of the poly VI breaking when any of its instances are broken, it should only check the instances which are being used. The change is possible, but non-trivial, which is why I am suggesting an idea on the idea exchange, since this would be considered as a feature.
I hope that answers your question!
Jeff Peacock
Product Support Engineer | LabVIEW R&D | National Instruments
03-29-2013 02:32 PM
That very well answers my question. I appreciate you taking the time to answer them for me.
I'll create the idea soon as soon as I have the time.
Again, thanks.
Shane.
03-29-2013 02:39 PM
No problem! Glad to hear it was helpful!
Jeff Peacock
Product Support Engineer | LabVIEW R&D | National Instruments