Skip to content

Add opt-in page-elements CPU pre/post split (BatchTuningParams.page_elements_cpu_split) - #2819

Closed
jioffe502 wants to merge 3 commits into
mainfrom
devin/1793411247-pe-cpu-split
Closed

jioffe502 wants to merge 3 commits into
mainfrom
devin/1793411247-pe-cpu-split

Conversation

@jioffe502

@jioffe502 jioffe502 commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Local page-element detection does image decode, resize/pad and box fusion inside the GPU actor, so GPU actors get added just to cover CPU work. With page_elements_cpu_split=True, the single PE node becomes three:

PageElementPreprocessCPU >> PageElementDetectionActor(split_mode=True) >> PageElementPostprocessCPU
  • Preprocess (CPU): decode, resize/pad to 1024x1024, uint8.
  • GPU: inference plus the model's raw postprocess.
  • Postprocess (CPU): conversion, fusion, filtering and the existing page_elements_v3* columns.

Worker counts default to 2x / 1x the GPU count. Preflight can shrink these defaults; explicit counts stay fixed. Set it with BatchTuningParams, ingest.extract.batch.*, or --page-elements-cpu-split.

Scope: 3 tuning fields (params, plan, CLI), split.py / split_actors.py, the graph gate and overrides, and the performance guide.
Unchanged:

  • With the flag off (the default), the graph and overrides are identical to main.
  • Remote PE (page_elements_invoke_url) ignores the flag.
  • The CPU PE actor raises if split is requested.

Measured on 8x RTX PRO 6000, ~213k pages, cold cache:

config pages/s steady GPU util
unsplit, 4 PE/GPU 319.6 96.8%
unsplit, 2 PE/GPU 301.2 —
split, 2 PE/GPU 316.1 94.7%

Parity on 48 pages: identical detections. Recall on a 20-file set was within run-to-run noise.

Tests:

  • tests/test_page_elements_split.py: split vs unsplit equivalence.
  • tests/test_ingest_plans.py:
    • graph on/off and remote;
    • default and explicit workers;
    • preflight shrink;
    • no-GPU error;
    • plan propagation.
  • CLI propagation and field validation.

Checklist

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

Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/7d9c7cab9ad1422dacf44cd4fd5c715d
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/7d9c7cab9ad1422dacf44cd4fd5c715d?variant=devin
Requested by: @jioffe502


Devin Review

@jioffe502
jioffe502 requested a review from a team as a code owner October 31, 2026 01:59
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@jioffe502
jioffe502 requested a review from a team as a code owner October 31, 2026 01:59
@jioffe502
jioffe502 requested a review from jdye64 October 31, 2026 01:59
devin-ai-integration[bot]

This comment was marked as resolved.

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with all previous findings addressed and no new actionable issues found.

Summary

Adds an opt-in split that moves page-image preparation and final detection cleanup to CPU workers while keeping inference on the GPU.

  • Local page-element detection can prepare images and assemble results in separate CPU stages.
  • Batch settings let callers enable the page-element split and size its CPU worker pools.

Review checks were based on source and test inspection; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[PDF extraction] --> B{Local CPU split enabled?}
  B -->|Yes| C[CPU decode and resize]
  C --> D[GPU inference]
  D --> E[CPU box cleanup and filtering]
  B -->|No| F[Existing page-element actor]
  E --> G[Existing downstream stages]
  F --> G
Loading

Reviews (3) · Last reviewed commit: "Handle missing values in PE split interm..." · Reviewed by Greptile

greptile-apps[bot]

This comment was marked as resolved.

@devin-ai-integration
devin-ai-integration Bot marked this pull request as draft October 31, 2026 21:16
@devin-ai-integration

Copy link
Copy Markdown
Contributor

Moving to draft. On the current stack (main + #2785 + eager embed engine build), 16 CPUs per GPU, one run per arm, the split at 2 page-element workers per GPU never beat the unsplit layout at 4 per GPU:

GPUs unsplit pps split pps change
1 37.6 37.7 +0.1%
2 71.5 69.8 −2.4%
4 175.3 171.6 −2.1%
8 315.0 309.4 −1.8%

With the split, page-element detection becomes the slowest stage, and object-store peak rises by about 20 GiB at 8 GPUs. Combined with NRL_CUDA_BLOCKING_SYNC=1 (#2818), it frees no more CPU than #2818 does alone. The option may still help on hosts with much less CPU per GPU, which hasn't been tested.

Written by Devin

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Closing: the split measured 316 pps vs 320 pps for the current layout (4 page-element workers per GPU), and #2824 now sizes workers from the hardware. Not worth ~900 lines and a new toggle. Branch kept for reference.

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