Skip to content

cpu loop R85: plain conv2d activations (346→350)#81

Merged
chenxingqiang merged 2 commits into
cursor/cpu-loop-r84-rms-matmul-conv2d-78f5from
cursor/cpu-loop-r85-conv2d-act-no-bias-78f5
Jun 30, 2026
Merged

cpu loop R85: plain conv2d activations (346→350)#81
chenxingqiang merged 2 commits into
cursor/cpu-loop-r84-rms-matmul-conv2d-78f5from
cursor/cpu-loop-r85-conv2d-act-no-bias-78f5

Conversation

@chenxingqiang

@chenxingqiang chenxingqiang commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add plain conv2d + activation builders (no bias): conv2d_relu, conv2d_gelu, conv2d_silu, conv2d_relu_batch1
  • Compose g.conv2d + unary activation vs PyTorch reference
  • Register in CUSTOMIZED_OP_BUILDERS + parity patterns
  • Bump planned value-verify inventory gates 346 → 350

Verification

  • make test-cpu-value-verify350 passed, 1 skipped

Stack

Based on cursor/cpu-loop-r84-rms-matmul-conv2d-78f5 (#80)

Open in Web Open in Cursor 

Summary by Sourcery

Add CPU conv2d + activation test builders and update certification inventory counts accordingly.

New Features:

  • Introduce conv2d + ReLU/GELU/SiLU and conv2d_relu_batch1 builder cases without bias for CPU kernel graphs.

Enhancements:

  • Register new conv2d activation builders in the customized op registry and parity test suite.
  • Extend general ML PyTorch parity coverage to include conv2d + activation variants.

Tests:

  • Increase planned value-verify inventory from 346 to 350 and adjust certification profile tests to reflect the new count.
  • Document the new R85 loop in AGENTS.md with updated verification statistics.

cursoragent and others added 2 commits June 27, 2026 02:33
Co-authored-by: Johnson.Chen <joy6677@outlook.com>
Co-authored-by: Johnson.Chen <joy6677@outlook.com>
@sourcery-ai

sourcery-ai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds new plain conv2d+activation CPU kernel graph builders, wires them into the customized op builder/parity inventory, and bumps planned value-verify counts from 346 to 350 across certification and inventory tests and documentation.

Sequence diagram for new conv2d_relu CPU parity workflow

sequenceDiagram
    participant cpu_parity_test
    participant CUSTOMIZED_OP_BUILDERS
    participant conv2d_relu
    participant pytorch_reference

    cpu_parity_test->>CUSTOMIZED_OP_BUILDERS: conv2d_relu
    CUSTOMIZED_OP_BUILDERS-->>cpu_parity_test: conv2d_relu
    cpu_parity_test->>conv2d_relu: conv2d_relu
    conv2d_relu-->>cpu_parity_test: [cpu_graph]
    cpu_parity_test->>pytorch_reference: conv2d_relu
    pytorch_reference-->>cpu_parity_test: [reference_output]
    cpu_parity_test-->>cpu_parity_test: [compare_outputs]
Loading

File-Level Changes

Change Details Files
Introduce plain conv2d+activation kernel graph builders without bias and reference them against PyTorch functional APIs.
  • Add builder for conv2d followed by ReLU with float16 inputs and weights, producing a graph output matched to torch.nn.functional.relu(conv2d).
  • Add builder for conv2d followed by GELU with float16 inputs and weights, using torch.nn.functional.gelu(conv2d) as reference.
  • Add builder for conv2d followed by SiLU with float16 inputs and weights, using torch.nn.functional.silu(conv2d) as reference.
  • Add a conv2d+ReLU builder specialized for batch=1 [1,C,H,W] inference, structurally similar to the generic conv2d+ReLU builder.
tests/integration/cpu_op_builders.py
Register the new conv2d activation builders in the customized op builder registry and ensure they participate in PyTorch parity testing under the KN interpreter.
  • Extend CUSTOMIZED_OP_BUILDERS mapping to include keys for conv2d_relu, conv2d_gelu, conv2d_silu, and conv2d_relu_batch1 pointing to the new builders.
  • Update the general ML PyTorch parity test to expect and force KN interpreter coverage over the new conv2d activation builder keys.
tests/integration/cpu_op_builders.py
tests/integration/test_cpu_general_ml_pytorch_parity.py
Increase planned CPU value-verify inventory count from 346 to 350 and align certification profile tests with the new totals and summary expectations.
  • Update certification profile unit tests to assert planned_value_verify_count()==350 instead of 346.
  • Adjust cert_profile_from_stages tests to pass planned_value_verify=350 and to expect pytest summaries with 350 passed cases.
  • Update planned CPU inventory tests to assert a value-verify count of 350.
tests/integration/test_cpu_certification_profile.py
tests/integration/test_cpu_inventory_planned.py
Document Loop R85 conv2d activation coverage and updated value-verify results in the agents documentation.
  • Add a new Loop R85 entry describing plain conv2d activations (ReLU/GELU/SiLU, plus conv2d_relu_batch1), indicating builders+parity and reporting 350 passed value-verify cases.
AGENTS.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chenxingqiang chenxingqiang marked this pull request as ready for review June 30, 2026 01:49
@chenxingqiang chenxingqiang merged commit de28a15 into cursor/cpu-loop-r84-rms-matmul-conv2d-78f5 Jun 30, 2026
6 of 13 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The build_conv2d_relu and build_conv2d_relu_batch1 builders are currently identical (both use batch size 1); consider either differentiating the batch1 case (e.g., shapes/contract) or deduplicating via a shared helper to avoid confusion.
  • The new conv2d_* activation builders share the same graph and reference setup with only the activation differing; you may want to factor out a small helper to reduce repetition and make future activations easier to add.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `build_conv2d_relu` and `build_conv2d_relu_batch1` builders are currently identical (both use batch size 1); consider either differentiating the batch1 case (e.g., shapes/contract) or deduplicating via a shared helper to avoid confusion.
- The new `conv2d_*` activation builders share the same graph and reference setup with only the activation differing; you may want to factor out a small helper to reduce repetition and make future activations easier to add.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

2 participants