[JIT] [Bugfix] Make blob codegen cache publication transactional - #4800
[JIT] [Bugfix] Make blob codegen cache publication transactional#4800Ruye-aa wants to merge 12 commits into
Conversation
Signed-off-by: aiyang.ay <aiyang.ay@alibaba-inc.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
|
Hi @zufayu and @valarLip, could you please help move #4800 forward? @zufayu, the required GitHub Actions workflows are still awaiting maintainer approval. Could you approve the pending runs, or point me to a maintainer who can? @valarLip, when you have time, could you please review this change? This PR fixes interrupted CK MHA JIT code generation leaving an incomplete persistent cache and causing repeated I also applied the patch to the current Thanks! |
Signed-off-by: aiyang.ay <aiyang.ay@alibaba-inc.com>
|
Follow-up: I pushed d3c26cf to fix all three Ruff findings from the previous Checks run:
Local verification now passes for ruff 0.16.0 on the changed file, Black, all five CPU regression tests, py_compile, and git diff --check. The new push dismissed the previous approval and created a fresh set of workflow runs that are awaiting maintainer approval. @junhaha666, could you please re-approve the updated commit? @zufayu, could you please approve the pending workflows? |
|
Hello, it failed the CI test. |
Signed-off-by: aiyang.ay <aiyang.ay@alibaba-inc.com>
|
Thanks @junhaha666 for flagging the CI failure. I fixed the reported issue in The full Aiter Test was delayed while the workflows were awaiting maintainer approval, so this compatibility gap was detected later than it should have been. The branch also had to be kept in sync with a fast-moving The failure was caused by a valid header-only HSA code generator: it produces Local validation for the new head:
@zufayu, could you please approve the current pending workflow runs as soon as possible so this fix can be validated by the upstream Python 3.12 wheel/GPU CI? Prompt approval would avoid another long feedback cycle and another branch sync resetting the runs. @valarLip, could you please review the updated change once the workflows are available and pass? Thank you. |
Summary
source cache if publication fails;
healthy
.so;Problem
build_module()currently writes codegen output directly into the canonicalblob/directory and ignores the
os.system()return code. It also removes the installedmodule before a replacement has compiled. A failed or interrupted generator can
therefore leave partial sources that are compiled or reused, while also destroying the
last known-good binary.
This was observed on the CK MHA JIT path as a truncated
fmha_fwd_api.cppwith nomatching dispatch branch, followed by persistent
invalid argument for fmha_fwdfailures until the cache was deleted.
Implementation
The change moves generator execution into
aiter/jit/utils/jit_cache.py:subprocess.run(..., check=True)propagates generator failure;.cppor.cusource;blob/after successful compilation, withrollback if directory publication fails;
os.replace().Tests
The regression tests are CPU-only and cover:
.sowhen copying the replacement fails.GPU compilation and CK MHA runtime validation are left to the upstream CI because the
local development host has no ROCm GPU.
Closes #4799