Skip to content

Fix GEMM tuner config restoration - #614

Open
Zhewen Tan (tandede) wants to merge 1 commit into
microsoft:mainfrom
tandede:fix/restore-gemm-config
Open

Fix GEMM tuner config restoration#614
Zhewen Tan (tandede) wants to merge 1 commit into
microsoft:mainfrom
tandede:fix/restore-gemm-config

Conversation

@tandede

Copy link
Copy Markdown

Summary

  • restore the original gemm-config.h when tuning produces no valid candidate
  • keep the selected configuration only after its final rebuild succeeds
  • centralize restoration and backup cleanup for cancellation and error paths

Problem

The tuner backs up gemm-config.h before testing candidates, but each candidate overwrites the live file. When every candidate fails to build or parse, find_best_config() returns no result and the old flow exits normally without restoring the backup. This leaves the last failed candidate in place and also leaves the backup file behind.

The same state could be retained when the user selected the best candidate but its final rebuild failed.

Validation

  • python -m pytest -q tests/test_tune_gemm_config.py (3 passed)
  • python -m py_compile utils/tune_gemm_config.py tests/test_tune_gemm_config.py
  • ruff check --select E9,F63,F7,F82 utils/tune_gemm_config.py tests/test_tune_gemm_config.py

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.

1 participant