[AIROCMLIR-668] Add tests for gaps in rocmlir-gen LIT coverage#2392
Conversation
There was a problem hiding this comment.
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. |
|
Reviewed 7 files, all test-only |
| // 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. |
There was a problem hiding this comment.
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."
| // --verifier=cpp is not implemented for any of the in-tree operations. | |
| // --verifier=cpp is not implemented for the GEMM or attention paths. |
There was a problem hiding this comment.
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.mlirusesCOUNT-Nfollowed by-NOT:for the same call; that idiom asserts "exactly N matches, none after," which is the intended check.- Negative tests in
options.mlirrely 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:+FileCheckprefixes consistently; nomlir/test/.../CMakeLists.txtchange is needed since these files are already underlit.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.
There was a problem hiding this comment.
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_Wcases atoptions.mlir:42-45intentionally run withoutnotbecauserocmlir-genonly warns; combining2>&1with FileCheck on the warning text is the right shape. BWD_DATA_3D/BWD_WEIGHT_3Dsizes (filter 432, in/out 512) are consistent withg=1,k=4,c=4,fil_d/h/w=3andn=2,c=4,d/h/w=4; padding-[h,h,w,w,d,d]ordering matches the documented layout convention in the newpopulate_padding.mlirblock.RAND_INT_BOUNDScorrectly usesi16for the bound constants (matches existingpopulate_random_data.mlirpatterns 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.
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:
gemm-misc-options.mlir)mcpuVerifyFloatin rocMLIR takes two trailingi1args, so the expected signature is now(memref<?xf32>, memref<?xf32>, f32, f32, f32, i8, i1, i1)instead of
(..., i8, i1)mcpuVerifyInt32Int64with ani64reference operand(memref<?xi32>, memref<?xi64>, i8), notmcpuVerifyInt32Int32/memref<?xi32>.conv-bwd-data.mlir)attention-kernel.mlir)-transOsurfaces atrprefix on the second-gemm result insiderock.attention(tr %N = softmax(qk) * %M : ... -> memref<1x64x128xf16>), not anoTransposedattribute.Test Plan
Test Result
Submission Checklist