[torch.compile] split shared compilation hash helpers#29057
[torch.compile] split shared compilation hash helpers#29057vnadathur wants to merge 7 commits intovllm-project:mainfrom
Conversation
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com> Co-Authored-By: vnadathur <236933696+vnadathur@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request does a good job of refactoring the compilation hashing logic into shared helpers, which improves code reuse and maintainability. However, I've found a critical issue where the hashing algorithm for code hashing was changed from sha256 to md5, which could lead to cache inconsistencies and collisions. I've also identified a performance issue due to a redundant function call. Please see my detailed comments for suggestions on how to address these points.
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com> Co-Authored-By: vnadathur <236933696+vnadathur@users.noreply.github.com>
ProExpertProg
left a comment
There was a problem hiding this comment.
Can we instead refactor the decorator to use the new & cleaner approach instead of restoring the older code?
…e the logic inline Signed-off-by: vnadathur <glvikramn@gmail.com>
|
@zhxchen17 i tried to hit ur concern here:
|
|
Thanks for the fix! I think this looks ok to me as well. |
@vnadathur Deleted my original comment there since I think that's not accurate. @ProExpertProg I like this fix slightly better because it shares the code for code hashing. I think in the short term it's okay to remove compilation_config_hash_factors tho. I wonder whether it will be a problem if in the future we decide to introduce a new common source of hashing (in addition to env+compiler config) that only got added to one path but not the other one. If we think it's unlikely, I think it's fine to have small duplication. |
per discussion on slack Signed-off-by: vnadathur <glvikramn@gmail.com>
ProExpertProg
left a comment
There was a problem hiding this comment.
I think if we're cleaning this up, let's really clean it up. I would prefer to land #29058 for now. I agree it would be good to keep the two cache hashes in sync but they are already different and the only common part is hash of config and envs, both of which come from the same member methods on the config and envs already.
Signed-off-by: vnadathur <glvikramn@gmail.com> Co-Authored-By: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
ProExpertProg
left a comment
There was a problem hiding this comment.
This looks fine as well, @zou3519 @drisspg @zhxchen17 can you check this works for you, happy to merge as is and improve structure later
ProExpertProg
left a comment
There was a problem hiding this comment.
Let's merge #29058 for now. After that we can properly restructure the config, including pulling out the compile cache factors so they can be stored with other cache artifacts
Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com> Co-Authored-By: vnadathur <236933696+vnadathur@users.noreply.github.com>
Signed-off-by: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
|
Let's just do this in #29117, can we close this? |
PR: vllm-project#29057 Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com> Co-Authored-By: vnadathur <236933696+vnadathur@users.noreply.github.com>
Motivation
PR: #26468 removed
envs.compute_hashwhich was being used by compilation_config_hash_factors, which decorators.py relies on for aot cache keys.Both
_compute_code_hashandcompilation_config_hash_factorsexist to keep aot and jit hashing consistent.backends.pyhad a duplicate of their logicThe Fix
This pr creates a shared helper instead of inlining them and updates the helper itself to call the new
envs.compile_factors().Thanks for pointing this out @zhxchen17
Test
@zhxchen17 does this fix the issue with pytorch nightly?
cc @ProExpertProg @WorldExplored