Add warnings and fallback for unassigned devices in infer_auto_device_map (#3066)
* feat: feat: Add warning for unassigned main devices
* refactor: Improve warning for unassigned main devices
* feat: impl fallback_allocate; fix output format
* fix: include last dot index in the iteration
* feat: incorporate fallback allocation into infer_auto_device_map
* Revert "feat: incorporate fallback allocation into infer_auto_device_map"
This reverts commit d607bfb530517478b90aa89c2a87a03c318a2e58.
* refactor: add helper functions and eliminate redundant variables
The fallback allocation will be reintroduced once the branching logic is fully refactored. This commit prepares the function infer_auto_device_map for further refactoring.
* refactor: simplify allocation logic by removing duplicates and reducing nesting
* feat: incorporate fallback allocation into infer_auto_device_map
Implemented fallback allocation to allow modules to be allocated to devices using BFS when regular allocation fails. This enhancement improves the allocation process by ensuring that at least one module is assigned to the device, even under tight memory constraints.
* fix: fix module splitting logic
* styles: fix styling errors
* test: add test coverage for no-warning cases
test_infer_auto_device_map and test_infer_auto_device_map_with_fallback_allocation now each have a no-warning test case.
Simplified and rewrote code sections that were made unreadable by the linter.
* refactor: simplify control flow in infer_auto_device_map
Added complete return type hinting for _init_infer_auto_device_map
* refactor: replace warnings.warn with logger.info for allocation failures
* fix: use assertLogs to capture no allocation warning messages correctly