Skip to content

kernel: synchronize autotuner cache updates#4554

Open
nascheme wants to merge 1 commit into
pytorch:mainfrom
nascheme:ft-audit-autotuner-cache
Open

kernel: synchronize autotuner cache updates#4554
nascheme wants to merge 1 commit into
pytorch:mainfrom
nascheme:ft-audit-autotuner-cache

Conversation

@nascheme

@nascheme nascheme commented Jul 3, 2026

Copy link
Copy Markdown

get_best_config_fn in torchao/kernel/autotuner.py had a lazy-init-then-read-modify-write on the module-level BEST_CONFIGS dict, followed by _save_best_configs(BEST_CONFIGS) pickling it directly. Under free-threaded Python this is a check-then-act race on init, plus pickle.dump can iterate the dict while another thread is still inserting into it.

Guard lazy init and the miss-path write with a lock, and pickle a snapshot taken under that same lock rather than the live dict.

Protect the autotuner cache lazy load and miss-path writes with an explicit
lock, and save a snapshot so pickle never iterates a dict while another
thread mutates it.

Assisted-by: Claude Opus 4.7
@pytorch-bot

pytorch-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4554

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants