Skip to content

Verify cold and warm index pages in the opt-in PyTorch loader - #476

Draft
nittin-murthi wants to merge 2 commits into
codex/pytorch-native-profile-c114-120from
codex/pytorch-loader-file-cache
Draft

nittin-murthi wants to merge 2 commits into
codex/pytorch-native-profile-c114-120from
codex/pytorch-loader-file-cache

Conversation

@nittin-murthi

@nittin-murthi nittin-murthi commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #458. Implements C-137 and C-138 from #353.

Summary

--cold-warm-cache makes the existing 33-anchor loader verify Linux page residency before each epoch. It conditions the same base index for fresh and reloaded fits, records the selected files and residency in each worker report, and lists files created later by materialization or iteration separately. Epoch timing starts after verification. An unmet condition fails the requested run and retains the observations.

Testing Done

Validation ran from the PyTorch package directory on disk-backed Linux scratch.

python -m pytest -q tests/e2e/test_runs.py --cold-warm-cache
python -m tests.e2e.runs loader --cold-warm-cache --e2e-dir /tmp/cache-measured
python -m tests.e2e.runs loader --repetitions 1 --e2e-dir /tmp/cache-control

The Linux validator module passed all five tests. The four-page validation file had 4, 0 and 4 resident pages in its warm/cold/warm cycle. All three loader workers completed two epochs for each fit, delivering 33 anchors per epoch across 84 batches. Each worker used the same 18 base-index files across both fits. All six cold boundaries had 0/18 resident pages and all six warm boundaries had 18/18. The one-worker control completed four epochs and recorded no cache measurements. With the flag omitted, the validator skipped. Ruff lint and formatting passed.

Change map

File-by-file changes and rationale

@copy-pr-bot

copy-pr-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nittin-murthi
nittin-murthi temporarily deployed to gha-kumo-workflow-tests November 22, 2026 05:25 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "tone_instructions" at "reviews"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review.

Walkthrough

Adds an optional Linux file-page cache check to loader timing runs. The check snapshots regular index files, then verifies that their pages are cold before epoch 0 and warm before epoch 1. It records per-file and aggregate cache data in epoch results and adds cache metadata to timing reports. Tests cover residency, file changes, writable mappings, and the loader test’s epoch cache modes.

Sequence Diagram(s)

sequenceDiagram
  participant TimingCLI
  participant Campaign
  participant PytestWorker
  participant LoaderTest
  participant TimeLoader
  participant IndexPageCache
  participant LinuxKernel
  TimingCLI->>Campaign: Enable cold_warm_cache
  Campaign->>PytestWorker: Pass --cold-warm-cache
  PytestWorker->>LoaderTest: Enable cache checks
  LoaderTest->>IndexPageCache: Snapshot index files
  LoaderTest->>TimeLoader: Pass cache
  loop Before each epoch
    TimeLoader->>IndexPageCache: Condition cold or warm
    IndexPageCache->>LinuxKernel: Apply conditioning and measure residency
    IndexPageCache-->>TimeLoader: Return cache record
  end
Loading
Merge Risk: Minimal · up to dbdac

This adds an opt-in Linux page-cache check to the loader timing tests. Default behavior is unchanged, and no merge-blocking risk was identified.

Security architecture risk: Minimal · up to dbdac

The new behavior is opt-in and targets index files created for the benchmark. If residency cannot be verified, the epoch is not timed and the run fails. The review found no material increase in security or failure-containment risk.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Normal benchmark runs use separate temporary fixture indexes. The operator-supplied report directory does not choose files to condition. File-cache effects are shared by inode, so another process using the same selected inode could observe a residency change; no such sharing was established for the normal benchmark path.

Trust Boundaries and Controls

  • observed — Selection uses regular-file metadata and deduplicates by device and inode. Each file open rechecks identity and ownership, and mapping advice is limited to matching entries in the current worker's mapping table. A writable matching mapping causes the check to fail.

Resilience and Maintainability Implications

  • observed — A failed check leaves the epoch incomplete and propagates the error after task cleanup and an attempt to write partial results. The campaign excludes failed workers from aggregation and exits unsuccessfully. It does not restore prior page residency or guarantee a report after abrupt process termination.
Pre-merge checks: Passed 2 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Change Map Design Review Warning (previously flagged, unaddressed) Details from the previous assessment are unavailable.
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR changes 5 files, below the failure threshold of 40. The changed-file inventory from git diff --name-status between the review-scoped base and head refs lists: - M packages/experimental/kumo-p…
Public Resource Access Passed The pull request changes five files under packages/experimental/kumo-pytorch/tests/ (conftest.py, e2e/file_cache.py, e2e/runs.py, e2e/test_runs.py, test_native_anchor_handoff.py). Scanning every added…
Full details: Pr Size

Explanation

The PR changes 5 files, below the failure threshold of 40. The changed-file inventory from git diff --name-status between the review-scoped base and head refs lists: - M packages/experimental/kumo-pytorch/tests/conftest.py - A packages/experimental/kumo-pytorch/tests/e2e/file_cache.py - M packages/experimental/kumo-pytorch/tests/e2e/runs.py - M packages/experimental/kumo-pytorch/tests/e2e/test_runs.py - M packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py --name-only confirms the count of 5. There are no renames or deletions. Line counts were ignored, as the check requires.

Full details: Public Resource Access

Explanation

The pull request changes five files under packages/experimental/kumo-pytorch/tests/ (conftest.py, e2e/file_cache.py, e2e/runs.py, e2e/test_runs.py, test_native_anchor_handoff.py). Scanning every added line of the committed diff for URLs, git or package sources, registries, and file:// or ssh:// locations found none. The added imports (ctypes, mmap, os, stat, sys, pathlib, time) are standard library, and the other references are local repository paths. The only new external URL is in the PR description: a link to a comment on this PR (github.com//pull/476#issuecomment-7074739670). The check covers references needed to understand, build, test, use, or contribute to the changed code. The description is not part of the changed code, so this link does not fall under the check. Even so, an unauthenticated request returned HTTP 200 for that link, for the PR page, and for the repository root, so it is publicly reachable. No added or modified external resource reference fails to resolve publicly, so the check passes.

Latest assessment: Change Map Design Review

Latest assessment: The latest assessment was inconclusive; the previous failure remains unresolved.

Latest explanation: The check reviews the PR conversation comment that starts with <!-- kumo-pr-change-map -->. That comment body is not in the repository checkout, and no tool returns PR conversation comments. A search of the working tree and git history found only the marker text in docs/development/review.md, .github/PULL_REQUEST_TEMPLATE.md, .coderabbit.yaml, and .github/scripts/pr-change-table.cjs. The PR description links to the comment (#issuecomment-7074739670) but does not reproduce its table. The pr_objectives section paraphrases the author's comments. It is not the Change map table, so it cannot show each row's rationale, existing-behavior inspection, or stopping condition. The repository diff is available and was inspected. It changes 5 files: tests/conftest.py, tests/e2e/file_cache.py (new), tests/e2e/runs.py, tests/e2e/test_runs.py, and tests/test_native_anchor_handoff.py. In file_cache.py, the cold path uses madvise(MADV_DONTNEED) on matching read-only worker mappings, then posix_fadvise(DONTNEED). The warm path reads the files. Verification uses mincore on a private ACCESS_COPY mapping and requires zero resident pages for cold and all pages resident for warm. This code is consistent with the paraphrased claims. The code does not, by itself, validate the table's design claims. Per the author's own notes, advisory eviction alone cannot prove a cold state. That is why residency verification exists, and the code implements it. Design questions I could not settle without the table: - Whether each row names the observed failure (#458 uncontrolled page residency, or C-137/C-138 requirements) and the smallest sufficient change. - Whether the conftest.py opt-in and the runs.py and test_native_anchor_handoff.py edits are each necessary, or whether the table justifies them. - Whether the table omits material behavior, such as the cold path changing shared mappings of the same inode outside the index, or the pass/fail effect on the existing results.json report. No proven defect was found in the diff. The earlier standing FAIL has no details, so I could not confirm or refute its claims. I did not issue a PASS over it.

Latest resolution: Provide the body of the PR conversation comment that starts with <!-- kumo-pr-change-map --> (comment issuecomment-7074739670, or the current marked comment) to the reviewer, or make it readable to this check. Re-run the check. The table must follow the template in .github/PULL_REQUEST_TEMPLATE.md. Each row should state: the observed failure or requested requirement, the inspected existing behavior, the smallest sufficient change, the focused verification, and the stopping condition. Optional refinements belong in a separate section. The previous FAIL explanation was unavailable. Its claims should be restated so the re-run can address them.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e43511c and dbdac5f.

Files selected for processing: 2

  • packages/experimental/kumo-pytorch/tests/e2e/runs.py
  • packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 5 remain after this review.

Finishing Touches
Fix failing CI checks

  • Commit to this branch
  • Create a new PR

@nittin-murthi

Copy link
Copy Markdown
Contributor Author

Change map

#458 reports loader timings with uncontrolled file-page residency. C-137–138 require an explicit, verified cold/warm pair on Linux. Acceptance uses the four-page validator and the original 33-anchor loader.

File Function / scope What changed Why
packages/experimental/kumo-pytorch/tests/conftest.py Pytest options Accept the loader's cache flag in the package suite. The standalone validator and loader worker use the same opt-in.
packages/experimental/kumo-pytorch/tests/e2e/file_cache.py IndexPageCache Freeze the base index selection, condition its owned files, verify residency with mincore, and record observations on success or failure. Advisory eviction alone cannot establish that an index was cold.
packages/experimental/kumo-pytorch/tests/e2e/runs.py Loader campaign and epoch loop Forward the opt-in to existing workers and attach cache evidence before timing each epoch. Both fit modes and the existing report can use the same comparison.
packages/experimental/kumo-pytorch/tests/e2e/test_runs.py Linux cache validator Verify warm/cold/warm residency, read-only refault, later-file exclusion, and refusal of writable mappings and changed files. Check the kernel behavior on the measurement host.
packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py 33-anchor native loader fixture Use the original index file selection for byte counts and both fits, and check the requested order of conditions. Fit-specific anchor files have a shorter lifetime than the base index.

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — dbdac5f7 Deployed Nov 23, 2026 by nittin-murthi via import #3043
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.

1 participant