nimi-python icon indicating copy to clipboard operation
nimi-python copied to clipboard

Fixing size parameter handling in len-mechanism to handle function parameters with different size parameters

Open batzuu opened this issue 4 months ago • 4 comments

  • [x] This contribution adheres to CONTRIBUTING.md.
  • [ ] ~~I've updated CHANGELOG.md if applicable.~~
  • [x] I've added tests applicable for this pull request

What does this Pull Request accomplish?

Fixes the codegen to properly handle functions with multiple array parameters that reference different size parameters:

  • Updates metadata_filters.py: Refactors the filter_parameters function to collect all size parameter names referenced by len-sized parameters into a len_size_parameter_names, replacing the previous single len_size_parameter approach. Removed assert to check if all size parameters are same from filter_len_parameters. Following this updated var names in default_method.py.mako and initialization_method.py.mako to reflect multiple possible size params.

  • Updates to nifake to enable testing: Details covered in testing section

Previously, it was assumed all len-mechanism arrays in a function shared the same size parameter. This change enables functions like CreateDeembeddingSparameterTableArray in NI-RFSG where frequencies uses frequenciesSize and sparameterTable uses sparameterTableSize.

List issues fixed by this Pull Request

Issue 2137: Fix size parameter handling for functions with parameters referencing multiple size parameters. Additional PR needs to be raised to update NI-RFSG function metadata (CreateDeembeddingSparameterTableArray) to consume these changes.

What testing has been done?

  • Added MultipleArraysDifferentSize function to nifake metadata with two arrays (valuesArray using valuesArraySize, and dataArray using dataArraySize) to test the change in filter param logic
  • Added unit test test_multiple_arrays_different_size in test_library_interpreter.py that verifies correct handling of multiple arrays with independent size parameters
  • Test validates that each array's length is properly calculated and passed with its corresponding size parameter (3 elements for valuesArray with valuesArraySize, and 5 elements for dataArray with dataArraySize)
  • All existing tests continue to pass.

batzuu avatar Nov 07 '25 13:11 batzuu