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

Change encoding of variable and lookup indices to allow for arbitrary number of subscripts #506

Closed
chrispcampbell opened this issue Aug 17, 2024 · 0 comments · Fixed by #507 or #476

Comments

@chrispcampbell
Copy link
Contributor

When I originally implemented support for the outputIndices buffer, the encoding for the buffer had a hardcoded limit of 3 subscripts per variable. For variables without subscripts, this was wasteful, and for variables with more than 3 subscripts, it would throw an error. This also required extra care and communication between the runtime and the generated model code (see the indicesPerVariable and INDICES_PER_OUTPUT constants).

Now that we have the RunModelParams implementations and can test things more easily, this would be a good time to refactor the encoding/decoding to handle arbitrary numbers of subscripts.

We can change the format of the indices buffer to include the subscript count for each variable, and then include the minimum amount of subscript indices for each variable. The new encoding would look like this:

  //   variable count
  //   varN index
  //   varN subscript count
  //   varN sub1 index
  //   varN sub2 index
  //   ...
  //   varN subM index
  //   ... (repeat for each var spec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment