← Back to Pull requests

fix(hip-kernel-provider): keep conv dgrad AOT plan build and destroy off the device #16591

Open
unknown opened this pull request with 301 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 23, 2026 22:34 UTC
Author

Fixes #16569.

hipkernel:Gfx950ConvDgradAot (and Gfx1250ConvDgradAot) allocated the implicit-GEMM
sub-GEMM tables with hipMalloc and a blocking hipMemcpy at plan build, and released them
with hipFree at destroy. When anot stream capture (PyTorch's
default), those calls fail ("operation not permitted when stream is capturing") and
invalidate that thread's capture.

Changes

  • The SUB_GEMM tables now live in thaceBytes() reports the

  • region, so the workspace grows by 480 B for a 3x3 stride-2 problem).
  • The prepared plan keeps only a hosh() uploads it with

  • ConvDgradTableUpload, a small pebuilds alongside the
    implicit-GEMM kernels: it takes upvalue kernel argument and
    writes them into the workspace. lnk on the launch stream
    ahead of the GEMM; the arguments aost never waits and a
    captured graph replays the upload.
    prepare() refuses an implicit-GEMM instance whose
    engine lacks the kernel. Every launch re-uploads, because the caller may reuse its
    workspace between launches.
  • Plan build and destroy make no hipMalloc, hipFree or blocking copy calls for the tables.

  • DeviceTables is removed.

    Limitation

    A HIP graph captured from launch()d, so it keeps restoring
    the plan's tables from its by-value kernel arguments on every replay rather than reading
    device memory the caller could have me guarantee the kernels
    the plan launches already give. Thisrchitecture the pack
    serves (gfx950_conv_dgrad_aot_table_aot_table_upload),
    built and shipped alongside the exisernels.

    Tests

  • New BuildingAPlanKeepsAnotherThre1250): builds and destroys an

  • implicit-GEMM plan while another tture. It fails on
    develop
    with the allocation error and pass
  • TestGfx950ConvDgradDispatch.WorkseachesCodeLoading: the

  • implicit-GEMM workspace expectation is now the table size instead of 0.
  • ACapturedPlanRestoresItsTablesOnE: captures an

  • implicit-GEMM execution, poisons two replays, and checks
    dX against the CPU reference.

    Verified on gfx950 (ROCm 10.2 SDK, OR=ON-DHIPKERNELPROVIDER_ENABLE_ROCKE=ON

    | | develop | this PR |
    |---|---|---|
    | Reproducer from #16569 | FAIL (ted) | PASS |
    | hip_kernel_provider_integration_tnvDgrad* | 1 new test fails |
    173/173 pass |
    | `hip_kernel_provider_tests --gtest pass, 2 skipped (gfx1250) |

    JIRA ID: AICK-2562

    🤖 Generated with [Claude Code](http

    Diff: 301 lines (+225 / -76) across 3 files Reviewer: BrianHarrisonAMD Review duration: 10749m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 301 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.342
    Real PR Conversation Timeline
    1 comments
    "Review active on #16591"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 40.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 21.4% · Safe to merge
    21.4%