Skip to content

Conversation

@CongMa13
Copy link
Collaborator

Refactor cd sequence_reverse_inclusive_scan from recursive template to constexpr for-loop.

This pull request improves the utility array functionality and its integration with sequence utilities, as well as adds comprehensive unit tests for the Array class. The main changes include refactoring the implementation of reverse inclusive scan for sequences, updating header dependencies, optimizing the Array assignment operator, and introducing a full test suite for Array.

Array and Sequence Utility Improvements:

  • Refactored the implementation of sequence_reverse_inclusive_scan in sequence.hpp to use a more efficient, array-based approach, encapsulated in a new impl namespace. This change simplifies the logic and should improve compile-time performance.
  • Updated header dependencies in both array.hpp and sequence.hpp to remove unused includes and ensure correct dependency order, notably including array.hpp in sequence.hpp to support the new scan implementation. [1] [2]
  • Optimized the assignment operator in the Array struct by replacing the static_for loop with a standard for-loop and adding a pragma for potential unrolling, improving both readability and performance.

Testing Enhancements:

  • Added a new unit test file unit_array.cpp with comprehensive tests covering construction, element access, assignment, iterators, the make_array helper, and different data types for the Array class.
  • Updated the CMakeLists.txt to build and link the new unit_array test executable.

Tracking issue: #3575

Comment on lines +34 to +38
#pragma unroll
for(int i = 0; i < NSize; i++)
{
mData[i] = a[i];
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the dependency on static_for. Hence, only need to include type.hpp.

And the code is easier to read.

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.

2 participants