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

Performance Enhancements #150

Conversation

auto-differentiation-dev
Copy link
Collaborator

This update introduces significant performance improvements, with some applications now achieving up to 2x faster execution.

Key Enhancements

  • Optimised OperationsContainer: Unified handling of slots and multipliers to reduce capacity and indexing overheads
  • Efficient iteration in computeAdjoints: Removed redundant chunk indexing for faster computation
  • Batch taping of operations: Consolidate multipliers and slots into stack-based arrays before appending them to tape
  • Eliminated std::fma overhead: Replaced unnecessary calls to std::fma for multiply-adds
  • Tape existence pre-check: Skips derivative calculations when tape is unused, lowering overhead in non-derivative scenarios
  • Branch prediction optimisation: Introduced XAD_LIKELY and XAD_UNLIKELY macros for better compiler-level branch prediction
  • Paired operation storage: Added OperationsContainerPaired for faster access, trading slight memory increase for speed
  • Configurable memory usage: Added the XAD_REDUCED_MEMORY CMake flag, allowing users to toggle between faster paired storage (default) and memory-efficient separated arrays

Contributors

The following contributors collaborated on this pull request:

- Removed std::fma in rollback, enhancing iteration speed
- Refactored tape container for efficient joint operations
- Combined pushing full statements to tape at once
- Added pre-checks for tape existence, reducing overhead

Co-authored-by: Zakaria Farini <[email protected]>
Co-authored-by: Abdelhay Bouramdane <[email protected]>
Co-authored-by: Zakaria Sabri <[email protected]>
Co-authored-by: Mouad El Mekaoui <[email protected]>
Co-authored-by: El Mokhtar Ouhrich <[email protected]>
Co-authored-by: Abderrahim Indjaren <[email protected]>
Co-authored-by: Salaheddine Ouahidi <[email protected]>
Co-authored-by: Yasser Ait Nasser <[email protected]>
Co-authored-by: Ayoub Ben hamou <[email protected]>
Co-authored-by: Oussama Khiar <[email protected]>
Co-authored-by: Omar Belaizi <[email protected]>
Co-authored-by: Reda Ghouzraf <[email protected]>
Co-authored-by: Yahya Rhiba <[email protected]>
Co-authored-by: Abdelouahed Rabiai <[email protected]>
Co-authored-by: Othmane Rekabe <[email protected]>
Co-authored-by: Othmane Chouikhane <[email protected]>
Co-authored-by: Mohamed Khames <[email protected]>
Co-authored-by: Mouad El Asri <[email protected]>
Co-authored-by: Hasnaa Et-Taleby <[email protected]>
Co-authored-by: Jawad Chakir <[email protected]>
Co-authored-by: Hamza Barrak <[email protected]>
Co-authored-by: Mohammed Berroukham <[email protected]>
Co-authored-by: Soufiane essarhir <[email protected]>
Co-authored-by: Ibrahim Esseddyq <[email protected]>
Co-authored-by: Rida Rhnizar <[email protected]>
Co-authored-by: Mohammed Zeroual <[email protected]>
@coveralls
Copy link
Collaborator

coveralls commented Nov 25, 2024

Pull Request Test Coverage Report for Build 12087374967

Details

  • 447 of 451 (99.11%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 98.959%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/OperationsContainer.hpp 180 181 99.45%
src/XAD/OperationsContainerPaired.hpp 155 156 99.36%
src/XAD/ChunkContainer.hpp 44 46 95.65%
Totals Coverage Status
Change from base Build 11917078641: 0.2%
Covered Lines: 2757
Relevant Lines: 2786

💛 - Coveralls

@auto-differentiation-dev auto-differentiation-dev force-pushed the feature/performance-improvements branch from 9f40e9e to 59515e3 Compare November 25, 2024 23:56
@auto-differentiation-dev auto-differentiation-dev force-pushed the feature/performance-improvements branch from 59515e3 to 0e8e885 Compare November 26, 2024 00:03
Copy link

github-actions bot commented Nov 26, 2024

Test Results

    29 files  ±    0      29 suites  ±0   17m 12s ⏱️ + 2m 21s
 1 388 tests +   69   1 388 ✅ +   69  0 💤 ±0  0 ❌ ±0 
39 275 runs   - 9 280  39 275 ✅  - 9 280  0 💤 ±0  0 ❌ ±0 

Results for commit 6f2df65. ± Comparison against base commit aaf5626.

This pull request removes 1 and adds 70 tests. Note that renamed tests count towards both.
TapeContainer.basic ‑ TapeContainer.basic
ChunkContainer.append_without_new_chunk ‑ ChunkContainer.append_without_new_chunk
ChunkContainer.emplace_back ‑ ChunkContainer.emplace_back
ChunkContainer.non_pod_type_full_chunk_destruct ‑ ChunkContainer.non_pod_type_full_chunk_destruct
ChunkContainer.non_pod_type_single_chunk_destruct ‑ ChunkContainer.non_pod_type_single_chunk_destruct
ChunkContainer.push_back_no_check ‑ ChunkContainer.push_back_no_check
ChunkContainer.resize_fills_with_values ‑ ChunkContainer.resize_fills_with_values
ChunkContainer.resize_fills_with_values_full_chunk ‑ ChunkContainer.resize_fills_with_values_full_chunk
ChunkContainer.resize_with_same_size_has_no_effect ‑ ChunkContainer.resize_with_same_size_has_no_effect
ChunkContainer.too_large_throws_bad_alloc ‑ ChunkContainer.too_large_throws_bad_alloc
OperationsContainerPairedTestHuge.throwsBadAlloc ‑ OperationsContainerPairedTestHuge.throwsBadAlloc
…

♻️ This comment has been updated with latest results.

@auto-differentiation-dev auto-differentiation-dev force-pushed the feature/performance-improvements branch 2 times, most recently from f095bb5 to f33b1d7 Compare November 28, 2024 00:02
@auto-differentiation-dev auto-differentiation-dev force-pushed the feature/performance-improvements branch from ba068fc to 6f2df65 Compare November 29, 2024 14:48
@auto-differentiation-dev auto-differentiation-dev merged commit bbee306 into auto-differentiation:main Nov 29, 2024
109 checks passed
@auto-differentiation-dev auto-differentiation-dev deleted the feature/performance-improvements branch November 29, 2024 16:00
This was referenced Nov 29, 2024
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.

4 participants