Skip to content

fix offload_try_wait - #415

Merged
shijieliu merged 5 commits into
NVIDIA:mainfrom
Clebrate:liuyl_fix_try_wait
Jun 16, 2026
Merged

shijieliu merged 5 commits into
NVIDIA:mainfrom
Clebrate:liuyl_fix_try_wait

Conversation

@Clebrate

@Clebrate Clebrate commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR commit fix try_wait logic.
Changes:

  • offload_kvcache_wait / try_wait handling
    • Return READY immediately when there are no remaining task IDs.
    • Treat task IDs missing from non-blocking try_wait responses as UNREADY instead of failing the wait logic.
    • Keep wait-state handling consistent for partial / non-blocking try_wait results.
  • finish_task handling
    • Only call blocking wait() on task IDs that are not yet SUCCESS in handle.responses.
    • Avoids FlexKV "not submitted" / NOTFOUND errors when tasks were already completed and released during earlier try_wait polling.
  • Submodule URL
    • Update third_party/FlexKV in .gitmodules from SSH to HTTPS for easier clone/CI setup.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@Clebrate Clebrate mentioned this pull request Jun 5, 2026
1 of 3 tasks
Clebrate added a commit to Clebrate/recsys-examples that referenced this pull request Jun 8, 2026
Cherry-pick from PR NVIDIA#415 (liuyl_fix_try_wait):
- Return READY when no remaining task IDs in offload_kvcache_wait
- Treat missing try_wait responses as UNREADY
- Only blocking-wait pending tasks in finish_task
- Use HTTPS FlexKV submodule URL
@shijieliu
shijieliu marked this pull request as ready for review June 9, 2026 01:20
@shijieliu

Copy link
Copy Markdown
Collaborator

/build

@greptile-apps

greptile-apps Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two bugs in the FlexKV offload wait logic and makes a submodule/Docker housekeeping update. The core fixes ensure try_wait polling correctly surfaces "not ready" when the server returns a partial/empty response, and that finish_task avoids redundant blocking waits on tasks already confirmed as SUCCESS.

  • offload_kvcache_wait: Adds an early READY return when all tasks are already tracked, and treats task IDs absent from a non-blocking try_wait response as UNREADY — fixing a prior bug where an empty try_wait response would incorrectly return READY.
  • finish_task: Filters pending_task_ids to skip tasks already recorded as SUCCESS in handle.responses, preventing FlexKV NOTFOUND errors on already-released task IDs.
  • Housekeeping: Changes the FlexKV submodule URL from SSH to HTTPS and adds a rm -rf pre-step in the Dockerfile for clean rebuilds.

Confidence Score: 4/5

Safe to merge with minor risk: the try_wait polling fix is clearly correct, but finish_task's guard against re-waiting on completed tasks only exempts SUCCESS, potentially leaving FAILED/CANCELLED task IDs exposed to the same NOTFOUND error the PR is fixing.

The finish_task change guards against NOTFOUND errors by skipping tasks with a cached SUCCESS response, but FAILED and CANCELLED are also terminal states that FlexKV may release. If FlexKV releases resources on any terminal outcome, calling wait() on a previously-FAILED/CANCELLED task ID will reproduce the exact error being fixed here.

corelib/recsys_kvcache_manager/recsys_kvcache_manager/flex_kvcache_manager.py — specifically the pending_task_ids filter in finish_task

Important Files Changed

Filename Overview
corelib/recsys_kvcache_manager/recsys_kvcache_manager/flex_kvcache_manager.py Core fix for try_wait/finish_task logic: empty try_wait response now correctly returns UNREADY, early exit when all tasks tracked, and finish_task skips already-SUCCESS tasks. finish_task may still NOTFOUND on FAILED/CANCELLED terminal task IDs.
.gitmodules SSH → HTTPS URL for FlexKV submodule to allow CI clone without SSH key setup.
docker/Dockerfile Added RUN rm -rf /workspace/recsys-examples before WORKDIR+COPY to ensure a clean rebuild.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant offload_kvcache_wait
    participant FlexKV Client
    participant handle.responses

    Caller->>offload_kvcache_wait: poll(task_handle)
    offload_kvcache_wait->>handle.responses: compute remain_task_ids (exclude known)
    alt remain_task_ids is empty
        offload_kvcache_wait-->>Caller: READY (early return)
    else remain_task_ids non-empty
        offload_kvcache_wait->>FlexKV Client: try_wait(remain_task_ids) [non-blocking]
        FlexKV Client-->>offload_kvcache_wait: partial/full responses dict
        offload_kvcache_wait->>offload_kvcache_wait: "missing IDs → has_unready=True (not stored)"
        offload_kvcache_wait->>handle.responses: store returned responses
        alt any FAILED or CANCELLED
            offload_kvcache_wait-->>Caller: FAILED / CANCELLED
        else any UNREADY or missing
            offload_kvcache_wait-->>Caller: LAUNCHED (not ready)
        else all SUCCESS
            offload_kvcache_wait-->>Caller: READY
        end
    end

    Caller->>offload_kvcache_wait: finish_task(task_handle)
    offload_kvcache_wait->>handle.responses: "filter pending (status != SUCCESS)"
    alt pending_task_ids non-empty
        offload_kvcache_wait->>FlexKV Client: wait(pending_task_ids, completely=True) [blocking]
        FlexKV Client-->>offload_kvcache_wait: done
    end
    offload_kvcache_wait-->>Caller: [1, 1, ..., 1]
Loading

Reviews (4): Last reviewed commit: "fix ci" | Re-trigger Greptile

@JacoCheung

JacoCheung commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator

❌ Pipeline #54135999 -- failed

Job Status Log
pre_check ❌ failed view
train_build ✅ success view
inference_build ✅ success view
tritonserver_build ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ❌ failed view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ✅ success view

Result: 9/14 jobs passed

View full pipeline

@Clebrate

Clebrate commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

/build

@JacoCheung

JacoCheung commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator

❌ Pipeline #54156290 -- failed

Job Status Log
pre_check ❌ failed view
train_build ✅ success view
inference_build ✅ success view
tritonserver_build ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ✅ success view

Result: 10/14 jobs passed

View full pipeline

@Clebrate

Copy link
Copy Markdown
Collaborator Author

/build

@JacoCheung

JacoCheung commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

❌ Pipeline #54276811 -- failed

Job Status Log
pre_check ❌ failed view
train_build ❌ failed view
inference_build ❌ failed view
tritonserver_build ❌ failed view
build_whl ❌ failed view
dynamicemb_test_fwd_bwd_8gpus ❌ failed view
dynamicemb_test_load_dump_8gpus ❌ failed view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ❌ failed view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ❌ failed view
inference_unit_test_1gpu ❌ failed view
inference_test_1gpu ❌ failed view

Result: 0/14 jobs passed

View full pipeline

@Clebrate

Copy link
Copy Markdown
Collaborator Author

/build

1 similar comment
@Clebrate

Copy link
Copy Markdown
Collaborator Author

/build

@JacoCheung

JacoCheung commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

▶️ Pipeline #54293149 -- running

Job Status Log
pre_check ❌ failed view
train_build ✅ success view
inference_build ✅ success view
tritonserver_build ✅ success view
build_whl ❌ failed view
dynamicemb_test_fwd_bwd_8gpus ▶️ running view
dynamicemb_test_load_dump_8gpus ▶️ running view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ❌ failed view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ▶️ running view

View full pipeline

Clebrate added 4 commits June 11, 2026 19:37
…wait path

Fix black formatting in offload_kvcache_wait, drop commented debug prints,
and simplify finish_task to use handle.responses directly.
@Clebrate
Clebrate force-pushed the liuyl_fix_try_wait branch from 716a700 to 46918b1 Compare June 12, 2026 02:38
@Clebrate

Copy link
Copy Markdown
Collaborator Author

/build

@JacoCheung

JacoCheung commented Jun 12, 2026 •

Copy link
Copy Markdown
Collaborator

❌ Pipeline #54514879 -- failed

Job Status Log
train_build ✅ success view
inference_build ✅ success view
tritonserver_build ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
pre_check ❌ failed view
build_whl ❌ failed view
dynamicemb_test_fwd_bwd_8gpus ❌ failed view
inference_test_1gpu ❌ failed view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view

Result: 7/14 jobs passed

View full pipeline

@Clebrate

Copy link
Copy Markdown
Collaborator Author

/build

@JacoCheung

JacoCheung commented Jun 12, 2026 •

Copy link
Copy Markdown
Collaborator

❌ Pipeline #54532880 -- failed

Job Status Log
pre_check ❌ failed view
train_build ✅ success view
inference_build ✅ success view
tritonserver_build ✅ success view
dynamicemb_test_fwd_bwd_8gpus ❌ failed view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ✅ success view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ✅ success view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ✅ success view
build_whl ✅ success view
unit_test_tp_4gpu ❌ failed view

Result: 10/14 jobs passed

View full pipeline

@shijieliu
shijieliu merged commit 90b62d6 into NVIDIA:main Jun 16, 2026
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.

3 participants