Skip to content

feat(rocke): grouped conv dispatcher - #10393

Open
bartekxk wants to merge 9 commits into
developfrom
users/barkocot/dispconv2
Open

feat(rocke): grouped conv dispatcher#10393
bartekxk wants to merge 9 commits into
developfrom
users/barkocot/dispconv2

Conversation

@bartekxk

@bartekxk bartekxk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Motivation

Add possibility to use dispatcher for grouped conv and bench them

Technical Details

-dispatcher
-benchmark

Test Plan

CI

Test Result

Pass

Submission Checklist

JIRA ID: AICK-1750

@therock-pr-bot

therock-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new grouped-convolution dispatcher in rocke (forward + wgrad routing) and a corresponding benchmark harness + JSON case suites to exercise/compare dispatcher-selected kernels across common model shapes.

Changes:

  • Introduces dispatch/grouped_convolution.py with request/spec types, candidate registries, and dispatch entrypoints for grouped conv fwd + wgrad.
  • Adds benchmark_grouped_conv.py to compile/time dispatcher sweep-space candidates (with optional verification + ckProfiler comparison).
  • Adds forward/backward JSON case files to drive benchmark runs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py New dispatcher and candidate registry for grouped conv fwd/wgrad.
dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/benchmark_grouped_conv.py New benchmark CLI for dispatcher-driven grouped conv timing/verification.
dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/bench_cases_conv.json Forward benchmark case suite for grouped conv benchmarking.
dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/bench_cases_conv_bwd.json Backward (wgrad-focused) benchmark case suite.
Suppressed comments (1)

dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py:948

  • Same split_k=-1 issue as the gfx942 wgrad candidate: selection returns split_k=-1 and the dispatcher uses it in the launch grid/spec hash. Resolve split_k=-1 at select time so the returned spec/grid are concrete.
    def select(req: OperatorRequest) -> ConvGroupedSpec:
        ok, why = candidate.admits(req)
        if not ok:
            raise ValueError(f"{name} does not support request: {why}")
        assert isinstance(req, ConvGroupedRequest)

@bartekxk
bartekxk force-pushed the users/barkocot/dispconv2 branch from 46ac16c to 0720649 Compare August 5, 2026 11:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (10)

dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py:353

  • _request_errors() calls _problem(req) unguarded; ConvProblem.post_init raises ValueError for invalid group divisibility or partial 3D fields, which would crash candidate.supported()/admits() instead of returning a clean rejection message.
    p = _problem(req)
    if p.Ho <= 0 or p.Wo <= 0:

dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py:1005

  • This docstring also claims split-K is "forwarded from request", but there is no split_k field on ConvGroupedRequest and select_spec currently always uses split_k=-1. Keeping docs aligned avoids confusion for callers trying to force/disable split-K.
    """Backward-weight conv for gfx950: 64×64×64, 2×2, 32×32×16 MFMA.

    Epilogue derived from vec_size_c (cshuffle when >1, default otherwise).
    Split-K forwarded from request (1=disabled, -1=auto CK formula, >1=fixed).
    gfx1250 wgrad is not yet supported; use CDNA only.

dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/benchmark_grouped_conv.py:258

  • parse_json_case() treats pads_before as symmetric padding and ignores pads_after. This silently mis-parses asymmetric padding (e.g. causal conv3d cases with pads_before != pads_after in the provided JSON), producing an incorrect ConvProblem.
        pads_before = entry.get("pads_before", entry.get("pad", 0))
        if isinstance(pads_before, (list, tuple)):
            pD, pH, pW = int(pads_before[0]), int(pads_before[1]), int(pads_before[2])
        else:
            pD = pH = pW = int(pads_before)

dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/benchmark_grouped_conv.py:317

  • The conv2d pads_before/pads_after path also ignores pads_after. If a JSON case provides asymmetric pads, the benchmark will run a different problem than specified. Since ConvProblem only supports symmetric padding, it should reject cases where pads_after != pads_before.
    # Support both symmetric pad and pads_before/pads_after
    if "pads_before" in entry:
        pads_before = entry["pads_before"]
        pH = (
            int(pads_before[0])
            if isinstance(pads_before, (list, tuple))
            else int(pads_before)
        )
        pW = (
            int(pads_before[1])
            if isinstance(pads_before, (list, tuple))
            else int(pads_before)
        )
    else:

dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/benchmark_grouped_conv.py:540

  • The dispatcher (dispatch/grouped_convolution.py) rejects dtype=fp32, but this benchmark exposes --dtype fp32. That will deterministically produce "No dispatcher candidates" failures; better to remove fp32 here or explicitly skip/report it as unsupported by the grouped-conv dispatcher.
        "--dtype",
        default="fp16",
        choices=["fp16", "bf16", "fp32"],
        help="data type (default: fp16)",
    )

dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py:1196

  • conv_grouped_sweep_space() deduplicates by spec.kernel_name(), but wgrad select_spec currently returns split_k=-1, so the kernel_name becomes "spk-1" and does not match the actually built kernel (which resolves split_k from the problem). This can also collapse distinct configs and makes benchmark output misleading.
    for candidate in registry.supported(req):
        spec = candidate.select_spec(req)
        h = spec.kernel_name()
        if h not in seen:

dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py:1210

  • dispatch_conv_grouped() returns a wgrad spec with split_k=-1, but grid() resolves split_k on the fly. That means DispatchResult.spec / KernelId.spec_hash may not describe the actual kernel specialization used, which can break compile-key based caches and makes logs non-reproducible.
    registry = _registry_for(req)
    candidate = registry.select(req, ranker=ranker)
    spec = candidate.select_spec(req)
    kid = _kernel_id(req, candidate, spec)
    return DispatchResult(

dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py:897

  • The docstring says "Split-K forwarded from request", but ConvGroupedRequest has no split_k field and this candidate hard-codes split_k=-1. Either add a request field or update the docstring to describe the current auto-resolution behavior.

This issue also appears on line 1001 of the same file.

    """Backward-weight conv for gfx942: 64×64×64, 2×2, 16×16×16 MFMA.

    Epilogue derived from vec_size_c (cshuffle when >1, default otherwise).
    Split-K forwarded from request (1=disabled, -1=auto CK formula, >1=fixed).
    """

dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/benchmark_grouped_conv.py:202

  • parse_json_case() currently accepts fp32 cases, but the grouped-conv dispatcher only supports fp16/bf16. With the provided JSON files containing fp32 entries, this leads to benchmark runs that always fail at dispatch time instead of being skipped with a clear warning.

This issue also appears in the following locations of the same file:

  • line 254
  • line 304
    dtype = entry.get("dtype", "fp16")
    if dtype not in ("fp16", "bf16", "fp32"):
        raise ValueError(f"dtype={dtype!r} is not supported (only fp16, bf16, fp32)")

dnn-providers/hip-kernel-provider/rocke/library/benchmarks/common/grouped_conv/benchmark_grouped_conv.py:1079

  • The help text for --dump-fail says it implies --verify, and the code does run verification when dump_fail is set. However the summary table only shows the verify column when args.verify is true, so a --dump-fail run hides PASS/FAIL in the final results table.
    show_verify = args.verify
    width = 84 if show_verify else 72
    print(f"\n{'='*width}")

Comment thread dnn-providers/hip-kernel-provider/rocke/library/dispatch/grouped_convolution.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this to platform/dispatch?

@github-actions github-actions Bot added the rocke: platform Touches rocKE platform label Aug 7, 2026
@bartekxk
bartekxk enabled auto-merge (squash) August 8, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants