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

Extend "pdata" caching when using new SoA data structures #2312

Open
olupton opened this issue Mar 30, 2023 · 0 comments
Open

Extend "pdata" caching when using new SoA data structures #2312

olupton opened this issue Mar 30, 2023 · 0 comments
Labels
dev Developer Tickets enhancement improvement Improvement over existing implementation proposal

Comments

@olupton
Copy link
Collaborator

olupton commented Mar 30, 2023

Preamble

This refers to possible improvements to the work in #2027.
It doesn't make sense to tackle this before that work is reviewed and merged.

Overview

pdata ("pointer data", I believe) is represented by the Datum type.
In #2027 this is an alias for neuron::container::generic_data_handle, which is a generic type that can wrap handles to mechanism data values that are stable w.r.t. permutations and reallocation of the underlying data structures.

Part of the cost of this flexibility is that dereferencing a generic_data_handle to obtain the pointed-to value is relatively indirect and expensive, so we don't want to do that during the compute-intensive part of the simulation.

To achieve this, before running the compute-intensive part of the simulation we generate "cache vectors" of raw pointers (double*) for pdata fields that refer to double values, and use those when we run the simulation.

It may be possible to extend this logic for further performance gains. For example, if the pointed-to value is known to be constant during the simulation, then instead of caching a double* that refers to a constant value, we could cache the constant value itself and remove some more runtime indirection. @olupton suspects that pointers to area values might fall into this category.

Another example is pdata fields that hold literal values of types such as int. We may be able to gain more performance by moving these to be explicit int-typed data (like the double-typed data in data) instead of wrapping them inside pdata. Ion types are an example of int data that is stored inside pdata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Developer Tickets enhancement improvement Improvement over existing implementation proposal
Projects
None yet
Development

No branches or pull requests

1 participant