-
-
Notifications
You must be signed in to change notification settings - Fork 71
Update LinearSolveAutotune preferences integration for dual preference system #731
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
Update LinearSolveAutotune preferences integration for dual preference system #731
Conversation
…e system This commit updates the preferences.jl integration in LinearSolveAutotune to support the dual preference system introduced in PR SciML#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]>
🔄 CI Status and Implementation PlanCurrent Status✅ PR Created: #731 Implementation SummaryThis PR implements the LinearSolveAutotune side of the dual preference system to complement PR #730: Core Changes:
Key Test Areas:
Next Steps
⎿ Setting 2-hour timer for CI completion as per CLAUDE.md instructions... 🤖 This comment will be updated as CI progresses. |
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]>
✅ Comprehensive Test Suite AddedI've added extensive tests to ensure the dual preference system works correctly in all scenarios. The new test coverage includes: 🧪 New Test CategoriesAlgorithm Classification Tests
Data-Driven Selection Tests
Dual Preference System Tests
Fallback Logic Tests
Integration Tests
🎯 Test Quality Features✅ Mock data with realistic performance hierarchies 🔍 Key Test AssertionsThe tests specifically verify that:
This comprehensive test suite ensures the dual preference system is robust and reliable for production use, with confidence that both fallback mechanisms will work correctly across all deployment scenarios. All tests pass locally ✅ |
🔄 Integration Tests Added: Tuned Preferences Usage in Default SolverI've added comprehensive integration tests that verify the tuned preferences are actually used by the default solver algorithm selection system. This ensures the complete end-to-end workflow functions correctly. 🧪 New Integration Test Categories1. Tuned Preferences Usage in Default Solver
2. Preference-Aware Algorithm Selection Simulation
🎯 Critical Test ValidationsThe integration tests specifically verify:
🔧 Test Architecture QualityRealistic Problem Testing: Uses actual Algorithm Verification: Tests that preferred algorithms actually work by solving problems and verifying solution accuracy. Preference Storage Validation: Directly checks LinearSolve preference storage, not just function returns. Clean Isolation: Proper setup/teardown with ⚡ End-to-End Pipeline VerificationThese tests ensure the complete pipeline works: Ready for PR #730 Integration: When PR #730 (dual preference system consumer) is merged, these tests will verify the complete integration works seamlessly. All integration tests pass locally ✅ |
Summary
This PR updates the LinearSolveAutotune preferences integration to support the dual preference system introduced in PR #730. The changes ensure that autotune results now set both the best overall algorithm and the best always-loaded algorithm, providing robust fallback mechanisms when extensions are not available.
🔄 Enhanced Dual Preference System
New Preference Structure
LinearSolveAutotune now records:
best_algorithm_{type}_{size}
: Overall fastest algorithm from benchmarksbest_always_loaded_{type}_{size}
: Fastest among always-available methodsIntelligent Algorithm Classification
Smart Fallback Selection
🚀 Implementation Details
Core Functions Enhanced
set_algorithm_preferences(categories, results_df)
get_algorithm_preferences()
{"Float64_medium" => {"best" => "RFLUFactorization", "always_loaded" => "MKLLUFactorization"}}
show_current_preferences()
New Helper Functions
is_always_loaded_algorithm(algorithm_name)
find_best_always_loaded_algorithm(results_df, eltype, size_range)
🔧 Algorithm Selection Logic
Preference Setting Workflow
Intelligent Fallbacks
📊 Example Autotune Workflow
✅ Robustness Features
🧪 Testing Verification
✅ Algorithm classification accuracy verified
✅ Dual preference setting from benchmark results
✅ Intelligent always-loaded algorithm detection
✅ Proper fallback when benchmark data unavailable
✅ Enhanced preference display functionality
✅ Complete preference clearing for both types
✅ Integration with existing autotune workflows
🔄 Integration with Main PR #730
This PR complements the core LinearSolve.jl changes in PR #730:
Together, they provide a complete autotune → preference setting → intelligent algorithm selection pipeline.
📋 Migration Impact
Existing Users: Zero impact - all existing functionality preserved
New Features: Automatically available after package update
Performance: Enhanced algorithm selection with robust fallbacks
🎯 Expected Benefits
This implementation ensures that LinearSolveAutotune fully supports the enhanced preference system, providing production-ready autotune integration with enterprise-grade reliability across all deployment scenarios.
🤖 Generated with Claude Code