Skip to content

Added incremental stamp/hash check for aiter checkout - #5

Open
Micky774 wants to merge 2 commits into
mainfrom
zain/incremental
Open

Added incremental stamp/hash check for aiter checkout#5
Micky774 wants to merge 2 commits into
mainfrom
zain/incremental

Conversation

@Micky774

Copy link
Copy Markdown
Collaborator

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

@Micky774
Micky774 requested a review from wangye805 as a code owner July 20, 2026 15:59
@Micky774
Micky774 requested a review from ipanfilo July 20, 2026 15:59
Micky774 added a commit that referenced this pull request Jul 23, 2026
* Initial implementation of floating commit

* Updated to use only transient checkout of AITER (gitignored)

* Update to patch-based build

* Updated transient checkout staging area

* Offset patch

* Include third_party spec for AITER API

* Add temporary CK patch

* Added QoLA checkout CLI command

* Updated patch

* Added apply non-3way bypass for CK submodule patches

* Rebased patches

* Added gfx-1250 changes

* Updated fwd path w/ stream guard

* Cherry-pick from Disentangle AITER subcommit from QoLA commit (#5)
* Add skip checkout option

* Let override hsa_sbdirs

* Added entrypoint for workspace calc

* Updated guards for CK-free build

* Add AITER top-left mask to bottom-right patch

* Add device-side workspace prep kernel

* Update zeroing policy for dq_acc

* Corrected memory zeroing from AITER side

* Corrected patch

---------

Co-authored-by: Ilya Panfilov <ipanfilo@amd.com>

@ipanfilo ipanfilo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed change will skip re-sync even if aiter tree manually updated after writing stamp key. On one hand it it is flaw that does not guarantee tree state. On the other hand it gives developer flexibility to run build with local AITER changes. What is desired goal of thi change?

@Micky774

Micky774 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

The proposed change will skip re-sync even if aiter tree manually updated after writing stamp key. On one hand it it is flaw that does not guarantee tree state. On the other hand it gives developer flexibility to run build with local AITER changes. What is desired goal of thi change?

Main intent is to enable a more generalized caching of build for TE's cmake build system to be able to skip redundant checkouts. The ability to mutate without forcing a new checkout is something that can be mediated via QOLA_FORCE_AITER_CHECKOUT=1.

tracked, patched, or clobbered by ``git reset``/``git submodule update``.
``git rev-parse --absolute-git-dir`` resolves both a real ``.git``
directory (fresh clone) and a ``.git`` file pointing elsewhere (worktree
or submodule-style checkout).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say it is disadvantage that he stamp is not clobbered by git reset, git clean, etc. Those operations will make stamp invalid but QoLA won't detect it. Storing it in AITER tree where it is seen by git commands alongside to applied patches may be more straightforward

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You make a good point, but even in the worktree it'll be vulnerable to surviving git reset --hard despite the patches vanishing. Instead, maybe we keep it where it is and add a separate invariant/check for determining whether the patches have been correctly applied? I've done so in the latest commit, let me know what you think.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are few issues with stamp scheme despite where it is stored:

  • it does not take into account QoLA itself (for ex. registry) and manifest parameters except aiter commit;
  • it may interfere with CK-JIT: either always rebuild because of CK-JIT touches CK codegen, or opposite - skip rebuild on CK-JIT update

As for tree validity detection. Despite desire not to have local AITER/CK modifications it is extremely useful for debugging so there should be a way to forcibly skip AITER source tree preparation but perform build. And it may be OK to ignore local AITER changes and require user to force rebuild in such case. In this case combination of AITER commit + patches hash should be good enough and even detection with 'git apply -R' is not required because any discrepancy is result of 'manual modification'.
So while local modifications are needed source preparation should be suppressed and build either forced or naturally follow files timestamps updates, and returning to clean tree will require one run with force update

def _patches_applied(aiter_root: str, patches: list[Path]) -> bool:
"""Return True iff every patch in *patches* is present in the working tree.

``git apply --reverse --check`` succeeds only when a patch's post-image is

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it works this way. Instead it verifies that patch can be applied (reverted) clean. i.e. any non-conflicting modifications are ignored.

forward path falls back off it — ``--3way`` rejects submodule paths upfront,
while plain apply reads them from the working tree.

Costs one ``git apply`` per patch, each reading only the handful of files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing to build cost git status or git diff are not expensive. On the other hand git rev-parse HEAD + git diff HEAD should give clean signature of the tree state.

tracked, patched, or clobbered by ``git reset``/``git submodule update``.
``git rev-parse --absolute-git-dir`` resolves both a real ``.git``
directory (fresh clone) and a ``.git`` file pointing elsewhere (worktree
or submodule-style checkout).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are few issues with stamp scheme despite where it is stored:

  • it does not take into account QoLA itself (for ex. registry) and manifest parameters except aiter commit;
  • it may interfere with CK-JIT: either always rebuild because of CK-JIT touches CK codegen, or opposite - skip rebuild on CK-JIT update

As for tree validity detection. Despite desire not to have local AITER/CK modifications it is extremely useful for debugging so there should be a way to forcibly skip AITER source tree preparation but perform build. And it may be OK to ignore local AITER changes and require user to force rebuild in such case. In this case combination of AITER commit + patches hash should be good enough and even detection with 'git apply -R' is not required because any discrepancy is result of 'manual modification'.
So while local modifications are needed source preparation should be suppressed and build either forced or naturally follow files timestamps updates, and returning to clean tree will require one run with force update

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.

2 participants