[torch.compile] refactor config hashing to compile_factors and unify factor collection#29117
[torch.compile] refactor config hashing to compile_factors and unify factor collection#29117vnadathur wants to merge 88 commits intovllm-project:mainfrom
Conversation
Updated all config classes to support an optional 'return_factors' argument in their compute_hash methods, allowing retrieval of hash factors instead of just the hash string. Signed-off-by: vnadathur <glvikramn@gmail.com> Co-Authored-By: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com> Co-Authored-By: vnadathur <236933696+vnadathur@users.noreply.github.com>
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com> Co-Authored-By: vnadathur <236933696+vnadathur@users.noreply.github.com>
Signed-off-by: vnadathur <glvikramn@gmail.com> Co-Authored-By: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
allows us to stop handling passconfig specially. Signed-off-by: vnadathur <glvikramn@gmail.com> Co-Authored-By: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
Signed-off-by: vnadathur <glvikramn@gmail.com>
|
This pull request has merge conflicts that must be resolved before it can be |
There was a problem hiding this comment.
Code Review
This pull request is a large-scale refactoring that renames compute_hash to compile_factors across many configuration classes, aiming for a more uniform and consistent hashing mechanism. The changes introduce a standardized way to handle nested configurations and allow for either returning the hash factors or the final hash string. Overall, the refactoring improves code consistency. However, I've identified a critical issue in vllm/envs.py that will cause an infinite recursion and needs to be addressed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: vnadathur <glvikramn@gmail.com>
Signed-off-by: vnadathur <glvikramn@gmail.com>
compute_hash & fixing small bugs
Signed-off-by: vnadathur <glvikramn@gmail.com>
Signed-off-by: vnadathur <glvikramn@gmail.com>
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com>
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com>
New Generated Cache |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
|
Hi @vnadathur, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com>
|
Hi @vnadathur, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
Signed-off-by: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
|
Vllm serve: |
Signed-off-by: Vikram Nadathur <glvikramn@gmail.com>
|
Hi @vnadathur, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com>
|
Hi @vnadathur, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
|
This pull request has merge conflicts that must be resolved before it can be |
Motivation
After this PR: #26468 there were a couple follow-ups to add.
In this PR, the following are added/changed:
normalize_value&hash_factorsacross configs with a compute_hash functioncompute_hashtocompile_factorsthis is the reason for so many files changedcompute_hashisn’t the right name because real computation of the hash is actually done byutils.hash_factors.Additions:
normalize valueinget_compile_factors, it checks if .compile_factors exists on the subobject - based on Luka's suggestionPassConfigspecially as in the case for compilation.py_compute_code_hashandcompilation_config_hash_factorscache_key_factors.json
cc @ProExpertProg @hmellor @zou3519
Note
Unifies torch.compile cache key generation and factor collection.
CompileFactorsandget_compile_factors, replacingcompute_hashwithcompile_factorsacross config classes and compiler adaptors;VllmConfig.compile_factorsaggregates nested config factorsnormalize_valueandhash_factors, including nestedcompile_factorsfor subobjectscompute_env_and_config_hashesandget_code_factors; cache keys now combineenv/config/compiler/codefactors and persist tocache_key_factors.jsonget_compile_factorsand validates multimodal backend factor changes; minor enum import path fixWritten by Cursor Bugbot for commit 7fbc6a6. This will update automatically on new commits. Configure here.
Note
Unifies torch.compile cache key derivation and factor collection across the codebase.
CompileFactorsandget_compile_factors; migrates config classes and compiler adaptors fromcompute_hashtocompile_factors(opt-out factor collection, nested configs supported)normalize_valueandhash_factors;VllmConfig.compile_factorsaggregates nested config factorscompute_env_and_config_hashesandget_code_factors; backends now derive cache dirs from hashed{env, config, compiler, code}factors and persist them incache_key_factors.jsonget_compile_factorsand validate factor changes; fixes enum import forAttentionBackendEnum{}where configs don’t affect graphs; usePathfor traced files; consistent DP hash validation)Written by Cursor Bugbot for commit 929d2f7. This will update automatically on new commits. Configure here.
Note
Cursor Bugbot is generating a summary for commit a0b60a4. Configure here.
Note
Unifies torch.compile cache key derivation and factor collection across the codebase.
CompileFactorsandget_compile_factors; migrates configs and compiler adaptors fromcompute_hashtocompile_factors(opt‑out, nested configs supported)normalize_valueandhash_factors;VllmConfig.compile_factorsaggregates nested factorscompute_env_and_config_hashesandget_code_factors; backends now hash{env, config, compiler, code}to derive cache dirs and persistcache_key_factors.jsonPathusage, typing tweaks, pass manager UUID includes post‑cleanup)Written by Cursor Bugbot for commit a0b60a4. This will update automatically on new commits. Configure here.
Note
Standardizes torch.compile cache keys and factor collection across the codebase.
CompileFactorsandget_compile_factors; replacescompute_hashwithcompile_factorsin configs and compiler adaptors, and aggregates inVllmConfig.compile_factorscompute_env_and_config_hashesandget_code_factors; backends now build cache dirs from hashed{env, config, compiler, code}and persistcache_key_factors.jsonWritten by Cursor Bugbot for commit 8f3d1af. This will update automatically on new commits. Configure here.