← Back to Pull requests

perf(packaging): build independent ROCm wheels concurrently #9598

Closed
unknown closed this pull request without merging on Nov 17, 2026 00:12 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 14:22 UTC
Author

Motivation

  • ROCm Python packaging builds each setup.py bdist_wheel one at a time. On a full Linux nightly the device batch is 30 wheels, and the host batch is core, profiler, and libraries. Those packages do not depend on each other, and zip DEFLATE inside one wheel stays single-threaded, so the wait is between packages.

  • This PR overlaps those independent setup tools processes. Default is 3 workers. Compression level, stored wheels, devel xz, and skipping the setuptools copy were measured and left unchanged.
  • Issue ID: https://github.com/ROCm/TheRock/issues/3161

    Technical Details

  • build_packages takes max_workers (default 3) and runs one setuptools process per staged package, capped by the number of packages in the batch. rocm stays an sdist and rocm-sdk-devel stays a single package, so those batches remain one worker. build_python_packages.py passes the same count through --wheel-build-workers. Workflows do not pass the flag, so Linux and Windows portable Python jobs pick up the default.

  • _build_package_worker is the single-package invocation. The one-package path calls it directly. Several packages submit it to a thread pool. A failure cancels the futures that have not started and re-raises.

  • Each setup.py writes to dest_dir/logs/<package>.log. A successful run no longer prints the setuptools -v text in the job log. On failure that package's log is printed, then the error is re-raised.
  • Test Plan

  • BuildPackagesConcurrencyTest.test_builds_independent_packages_concurrently — two packages, max_workers=2, both setup.py processes start before either finishes

  • test_rejects_nonpositive_workers — max_workers below 1 raises

  • test_split_batches_device_packages_for_parallel_build — the device batch receives wheel_build_workers

  • Replay the 2026-10-27 non-ASAN Linux nightly artifacts (ROCm/rockrel run 40423604075, 17 families) with this branch

  • Replay the 2026-10-28 ASAN nightly artifacts (ROCm/rockrel run 40607843845, gfx94X-dcgpu;gfx90a;gfx950-dcgpu) on a medium runner and on a larger runner
  • Test Result

  • Non-ASAN saved about 5 minutes. Thirty device wheels overlapped three at a time. gfx942 at 114 seconds was still the longest wheel.
  • ASAN on aws-linux-scale-rocm-prod finished. The wheel phase there was about 5 minutes shorter than one-at-a-time on that runner (host wall 131s vs 296s sequential, device wall 94s vs 221s).
  • Test Runs:

  • Non-ASAN nightly, Linux, 17 families: 14m 53s — https://github.com/ROCm/TheRock/actions/runs/40731037963

  • ASAN-debug nightly, 3 families (gfx94X, gfx90a, gfx950): Larger runner 37m 45s — https://github.com/ROCm/TheRock/actions/runs/40759367046

  • Non-debug ASAN CI, gfx94x only, prebuilt: 4m 12s — https://github.com/ROCm/TheRock/actions/runs/40914191765

  • After the log change, the same CI jobs stayed in the same range: Linux 10m 42s (42696937198), ASAN gfx94x 4m 26s (42696937357).

  • Local gfx942 Docker run: one log file per package, no setuptools text on the console, all six packages built.
  • <html xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
    xmlns="http://www.w3.org/TR/REC-html40">

    <head>

    <meta name=ProgId content=OneNote.File>
    <meta name=Generator content="Microsoft OneNote 15">
    </head>

    <body lang=en-US style='font-family:Calibri;font-size:11.0pt'>
    <!--StartFragment-->

    <div style='direction:ltr'>

    Optimization | What we tried | Result | Decision
    -- | -- | -- | --
    Overlap independent wheels | 1, 2, 4, and 8 package workers. One bdist_wheel is one zlib stream, so the tarball worker formula does not apply. | Local gfx942: 7m 18s at 1 worker, 6m 25s at 2, 4, and 8. Only the 3 host wheels overlap; device and devel stay one package. Early multi-arch CI: 13m 37s at 1 (35669455108), 11m 51s at 2, 10m 39s at 8. | Proceed with approach. Default is 3. More than 3 cannot beat the longest device wheel.
    Stored zip (--no-wheel-compression) | Workers 1, compression off. | Wall 3m 9s vs 7m 18s. Device / devel / core grew from 1.7 GiB / 673 MiB / 408 MiB to 2.4 GiB / 2.9 GiB / 1.4 GiB. | Approach not used. Pip wheels must stay zip DEFLATE.
    DEFLATE level 1 vs default ~6 | Forced compresslevel 1. Hook checked on text first. | Wall 7m 18s both. Wheel bytes identical, devel −3 KiB. | Do not add a level flag.

    </div>

    <!--EndFragment-->
    </body>

    </html>

    Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/CONTRIBUTING.md.
  • Diff: 584 lines (+438 / -146) across 7 files Reviewer: nunnikri Review duration: 26509m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 584 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.381
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #9598"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.9% (MEDIUM) · Higher = larger blast radius
    49.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.7% · Safe to merge
    19.7%
    Repository