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

Support extents with arbitrary value types #488

Merged
merged 1 commit into from
May 12, 2022

Conversation

bernhardmgruber
Copy link
Member

@bernhardmgruber bernhardmgruber commented May 9, 2022

Currently, LLAMA uses size_t in all index calculations as is the default in the STL. We knew already from previous experience in picongpu that this increases register usage for CUDA since size_t is 64bits in CUDA and CUDA registers are 32bits in size, so each index variable uses 2 registers. Registers are a scarce resource so it would be beneficial to have control over the type used in index calculations. This PR allows this.

We saw similar development in std::mdspan (https://wg21.link/P0009) with the proposal “Make mdspan size_type controllable” (https://wg21.link/P2553). The gist was adding an additional template parameter to std::extents which gives the type used in all index calculations:

template<class SizeT, size_t... Extents>
  class extents;

For LLAMA, the main change is that llama::ArrayExtents gains an additional template parameter defining the type to use for storing extents and performing index calculations in:

using AE = llama::ArrayExtents<IndexType, 5, llama::dyn, 2>;

This change is propagated downstream into llama::ArrayExtentsDynamic<IndexType, 3>, which is a breaking change. llama::NrAndOffset is now templated on the index type as well. Furthermore ArrayExtentsStatic is renamed to ArrayExtentsNCube, since this is a more accurate description of what it does.

@bernhardmgruber bernhardmgruber changed the title Int Support arbitrary size types May 9, 2022
@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #488 (d6cfa5a) into develop (50bac5f) will increase coverage by 0.00%.
The diff coverage is 99.87%.

❗ Current head d6cfa5a differs from pull request most recent head da970d8. Consider uploading reports for the commit da970d8 to get more accurate results

@@           Coverage Diff            @@
##           develop     #488   +/-   ##
========================================
  Coverage    99.23%   99.24%           
========================================
  Files           63       63           
  Lines         5392     5439   +47     
========================================
+ Hits          5351     5398   +47     
  Misses          41       41           

@bernhardmgruber bernhardmgruber changed the title Support arbitrary size types Support extents with arbitrary value types May 9, 2022
@bernhardmgruber
Copy link
Member Author

Just tested this one in AdePT and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant