Skip to content

Commit cb86d15

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Update LinearSolveAutotune preferences integration for dual preference system (#731)
* Update LinearSolveAutotune preferences integration for dual preference system This commit updates the preferences.jl integration in LinearSolveAutotune to support the dual preference system introduced in PR #730. The changes ensure complete compatibility with the enhanced autotune preference structure. ## Key Changes ### Dual Preference System Support - Added support for both `best_algorithm_{type}_{size}` and `best_always_loaded_{type}_{size}` preferences - Enhanced preference setting to record the fastest overall algorithm and the fastest always-available algorithm - Provides robust fallback mechanism when extensions are not available ### Algorithm Classification - Added `is_always_loaded_algorithm()` function to identify algorithms that don't require extensions - Always-loaded algorithms: LUFactorization, GenericLUFactorization, MKLLUFactorization, AppleAccelerateLUFactorization, SimpleLUFactorization - Extension-dependent algorithms: RFLUFactorization, FastLUFactorization, BLISLUFactorization, GPU algorithms, etc. ### Intelligent Fallback Selection - Added `find_best_always_loaded_algorithm()` function that analyzes benchmark results - Uses actual performance data to determine the best always-loaded algorithm when available - Falls back to heuristic selection based on element type when benchmark data is unavailable ### Enhanced Functions - `set_algorithm_preferences()`: Now accepts benchmark results DataFrame for intelligent fallback selection - `get_algorithm_preferences()`: Returns structured data with both best and always-loaded preferences - `clear_algorithm_preferences()`: Clears both preference types - `show_current_preferences()`: Enhanced display showing dual preference structure with clear explanations ### Improved User Experience - Clear logging of which algorithms are being set and why - Informative messages about always-loaded vs extension-dependent algorithms - Enhanced preference display with explanatory notes about the dual system ## Compatibility - Fully backward compatible with existing autotune workflows - Gracefully handles systems with missing extensions through intelligent fallbacks - Maintains all existing functionality while adding new dual preference capabilities ## Testing - Comprehensive testing with mock benchmark data - Verified algorithm classification accuracy - Confirmed dual preference setting and retrieval - Tested preference clearing functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Add comprehensive tests for dual preference system This commit adds extensive tests to ensure the dual preference system works correctly in LinearSolveAutotune. The tests verify that both best_algorithm_* and best_always_loaded_* preferences are always set properly. ## New Test Coverage ### Algorithm Classification Tests - Tests is_always_loaded_algorithm() function for accuracy - Verifies always-loaded algorithms: LU, Generic, MKL, AppleAccelerate, Simple - Verifies extension-dependent algorithms: RFLU, FastLU, BLIS, GPU algorithms - Tests unknown algorithm handling ### Best Always-Loaded Algorithm Finding Tests - Tests find_best_always_loaded_algorithm() with mock benchmark data - Verifies data-driven selection from actual performance results - Tests handling of missing data and unknown element types - Confirms correct performance-based ranking ### Dual Preference System Tests - Tests complete dual preference setting workflow with benchmark data - Verifies both best_algorithm_* and best_always_loaded_* preferences are set - Tests preference retrieval in new structured format - Confirms actual LinearSolve preference storage - Tests preference clearing for both types ### Fallback Logic Tests - Tests fallback logic when no benchmark data available - Verifies intelligent heuristics for real vs complex types - Tests conservative fallback for complex types (avoiding RFLU issues) - Confirms fallback selection based on element type characteristics ### Integration Tests - Tests that autotune_setup() actually sets dual preferences - Verifies end-to-end workflow from benchmarking to preference setting - Tests that always_loaded algorithms are correctly classified - Confirms preference validation and type safety ## Test Quality Features - Mock data with realistic performance hierarchies - Comprehensive edge case coverage (missing data, unknown types) - Direct verification of LinearSolve preference storage - Clean test isolation with proper setup/teardown These tests ensure that the dual preference system is robust and always sets both preference types correctly, providing confidence in the fallback mechanism for production deployments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: ChrisRackauckas <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent a6b6926 commit cb86d15

File tree

3 files changed

+443
-101
lines changed

3 files changed

+443
-101
lines changed

lib/LinearSolveAutotune/src/LinearSolveAutotune.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ function autotune_setup(;
345345

346346
# Set preferences if requested
347347
if set_preferences && !isempty(categories)
348-
set_algorithm_preferences(categories)
348+
set_algorithm_preferences(categories, results_df)
349349
end
350350

351351
@info "Autotune setup completed!"

0 commit comments

Comments
 (0)