Skip to content

[AIROCMLIR-668] Add tests for gaps in rocmlir-gen LIT coverage#2392

Merged
justinrosner merged 3 commits into
developfrom
justinr-port-rocmlir-gen-LIT
May 29, 2026
Merged

[AIROCMLIR-668] Add tests for gaps in rocmlir-gen LIT coverage#2392
justinrosner merged 3 commits into
developfrom
justinr-port-rocmlir-gen-LIT

Conversation

@justinrosner
Copy link
Copy Markdown
Contributor

@justinrosner justinrosner commented May 29, 2026

Motivation

This is a port of https://github.com/ROCm/rocmlirTriton/pull/250 from rocmlirTriton.

This PR adds tests for existing rocmlir-gen features that were missing direct test coverage in our LIT tests.

Technical Details

The following is a list of what changed relative to the rocmlirTriton version:

  • Removed LIT tests for features that don't exist in rocMLIR
    • `--cpu-timers
  • Updated verifier ABI differences (gemm-misc-options.mlir)
    • mcpuVerifyFloat in rocMLIR takes two trailing i1 args, so the expected signature is now (memref<?xf32>, memref<?xf32>, f32, f32, f32, i8, i1, i1)
      instead of (..., i8, i1)
    • The integer verifier helper is mcpuVerifyInt32Int64 with an i64 reference operand (memref<?xi32>, memref<?xi64>, i8), not mcpuVerifyInt32Int32 / memref<?xi32>.
  • Updated conv kernel signature & op syntax (conv-bwd-data.mlir)
  • Updated attention output transpose (attention-kernel.mlir)
    • -transO surfaces a tr prefix on the second-gemm result inside rock.attention (tr %N = softmax(qk) * %M : ... -> memref<1x64x128xf16>), not an oTransposed attribute.

Test Plan

  • Run the PR CI

Test Result

Submission Checklist

@justinrosner justinrosner requested a review from causten as a code owner May 29, 2026 16:22
Copilot AI review requested due to automatic review settings May 29, 2026 16:22
@justinrosner justinrosner added the claude-review Trigger automated PR review by claude[bot]; auto-removed after the run. label May 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds direct LIT coverage for existing rocmlir-gen and driver option behavior, especially validation/error paths and previously untested command-line feature combinations.

Changes:

  • Adds negative option-validation tests for rocmlir-gen.
  • Expands GEMM, conv, attention, random-data, and padding option coverage.
  • Verifies ABI/signature expectations for verifier calls and current Rock op assembly syntax.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mlir/test/rocmlir-gen/options.mlir Adds negative tests for invalid/unsupported option combinations and padding warnings.
mlir/test/rocmlir-gen/gemm-misc-options.mlir Adds tests for tuning keys, print inputs, verifier result levels, and device selection.
mlir/test/rocmlir-gen/conv-bwd-data.mlir Adds mixed-output dtype and 3-D backward conv coverage.
mlir/test/rocmlir-gen/attention-kernel.mlir Adds IR checks for attention transpose flags.
mlir/test/rocmlir-gen/attention-kernel-f16.mlir Adds softmax intermediate dtype coverage.
mlir/test/rocmlir-driver/populate_random_data.mlir Adds integer random bounds and selective integer-random input tests.
mlir/test/rocmlir-driver/populate_padding.mlir Adds asymmetric depth-padding coverage for 3-D backward-data conv.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// RUN: not rocmlir-gen -operation gemm -t f32 -out_datatype f32 --arch %arch -g 1 -m 1024 -k 1024 -n 1024 -transA=False -transB=False --kernel-repeats=100 2>&1 | FileCheck %s --check-prefix=ERR_KERNEL_REPEATS
// ERR_KERNEL_REPEATS: --kernel-repeats is only supported with host harness (-ph) or CPU validation (-pv).

// --verifier=cpp is not implemented for any of the in-tree operations.
@rocmlir-pr-reviewer
Copy link
Copy Markdown

Reviewed 7 files, all test-only .mlir additions covering previously untested rocmlir-gen options (asymmetric depth padding for 3-D bwd-data conv; integer random-data bounds and -rand_type_int_for_inputs; --softmax_dtype; per-tensor attention transpose flags; 3-D bwd-data/bwd-weight kernel signatures; forward conv mixed dtypes; bwd-data/bwd-weight tuning keys; -pi, --print-verify-results, --device; and several negative validation cases). Tests follow existing file conventions, use FileCheck prefixes/COUNT/NOT cleanly, and explanatory comments precisely match the asserted IR. CI is green except for the in-progress review check. Posted 0 inline comments (0 critical, 0 major, 0 minor). Verdict: APPROVE.

@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot removed the claude-review Trigger automated PR review by claude[bot]; auto-removed after the run. label May 29, 2026
// RUN: not rocmlir-gen -operation gemm -t f32 -out_datatype f32 --arch %arch -g 1 -m 1024 -k 1024 -n 1024 -transA=False -transB=False --kernel-repeats=100 2>&1 | FileCheck %s --check-prefix=ERR_KERNEL_REPEATS
// ERR_KERNEL_REPEATS: --kernel-repeats is only supported with host harness (-ph) or CPU validation (-pv).

// --verifier=cpp is not implemented for any of the in-tree operations.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wording overstates the behavior: regular convolution still goes through createCPUConvFunc for --verifier=cpp; only the GEMM and attention paths reject it (and those are what the two RUN lines below actually exercise). Narrow the comment so it doesn't imply conv is rejected too — e.g. "--verifier=cpp is not implemented for the GEMM or attention paths."

Suggested change
// --verifier=cpp is not implemented for any of the in-tree operations.
// --verifier=cpp is not implemented for the GEMM or attention paths.

Copy link
Copy Markdown

@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVE -- submitted as COMMENT (automated reviews are advisory)  ·  Findings: 1 (0 Critical, 0 Major, 1 Minor)


Scope

Test-only PR porting rocmlir-gen LIT coverage from rocmlirTriton. Adds positive checks for 3-D backward-data/-weight conv kernels, asymmetric depth padding, mixed-dtype forward conv, attention transpose flags (-transQ/-transV/-transO), softmax dtype override, integer rand bounds & selective -rand_type_int_for_inputs, --emit-tuning-key for bwd kernels, -pi print-inputs, --print-verify-results levels (float + int verifier ABI), and --device/-dev. Adds negative tests in options.mlir for --verifier=cpp/clone, missing --arch/-t, missing GEMM dims, mixed-dtype without output dtype, flash-decoding without return_lse, and padding-flag conflicts.

Findings

One minor wording nit on a test-file comment in mlir/test/rocmlir-gen/options.mlir:7. Otherwise no blocking issues; the FileCheck directives, prefixes, and the updated mcpuVerifyFloat/mcpuVerifyInt32Int64 ABIs line up with the changes the PR description calls out.

Notes

  • populate_random_data.mlir uses COUNT-N followed by -NOT: for the same call; that idiom asserts "exactly N matches, none after," which is the intended check.
  • Negative tests in options.mlir rely on stable diagnostic substrings (e.g. Value for: m not specified, External gemm validator is not available); if those messages are reworded in the driver later, these LIT lines will need to track the new text — worth keeping in mind but not a blocker.
  • All new tests use // RUN: + FileCheck prefixes consistently; no mlir/test/.../CMakeLists.txt change is needed since these files are already under lit.cfg-discovered directories.

CI status

Self/Anthropic check aside, all reportable checks are still pending (Jenkins, Build and Test, MIGraphX, etc.); no fail/cancel buckets to flag.

Copy link
Copy Markdown

@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVE -- submitted as COMMENT (automated reviews are advisory)  ·  New findings: 0 (0 Critical, 0 Major, 0 Minor)


Scope

Pure test-coverage PR: adds LIT cases for previously untested rocmlir-gen features across attention transposes, conv mixed-dtype / 3-D bwd-data / bwd-weight, integer-randomness bounds and the -rand_type_int_for_inputs selector, --emit-tuning-key for bwd-data / bwd-weight, -pi print-inputs, --print-verify-results levels (float + int), --device / -dev ctor emission, and a batch of negative options.mlir validations. No production code touched.

Findings

No blocking issues. The previously-flagged wording at mlir/test/rocmlir-gen/options.mlir:7 (// --verifier=cpp is not implemented for any of the in-tree operations.) is still inaccurate -- the RUN lines below only exercise the gemm and attention rejection paths, while regular convolution still goes through createCPUConvFunc for --verifier=cpp. Tracking on the existing inline thread (no developer reply yet); not re-posted to avoid duplicate inline comments.

Notes

  • The WARN_PADDING_H / WARN_PADDING_W cases at options.mlir:42-45 intentionally run without not because rocmlir-gen only warns; combining 2>&1 with FileCheck on the warning text is the right shape.
  • BWD_DATA_3D / BWD_WEIGHT_3D sizes (filter 432, in/out 512) are consistent with g=1,k=4,c=4,fil_d/h/w=3 and n=2,c=4,d/h/w=4; padding-[h,h,w,w,d,d] ordering matches the documented layout convention in the new populate_padding.mlir block.
  • RAND_INT_BOUNDS correctly uses i16 for the bound constants (matches existing populate_random_data.mlir patterns above the diff for the 8-bit codepath).

CI status

No CI failures on the pinned SHA. Both Python lint and Python perf-script jobs are still in progress; the auto-review job's own check is expected to be in-progress and is not a CI failure.

@justinrosner justinrosner merged commit 30abb90 into develop May 29, 2026
16 checks passed
@justinrosner justinrosner deleted the justinr-port-rocmlir-gen-LIT branch May 29, 2026 21:51
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.

3 participants