google / google/heir

Add integration test for layout optimization with multiple kernel alternatives

Open
#2,352 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
MLIR
Stars
906
Forks
171
Avg merge
4d 12h
Merged PRs (30d)
32

Description

## Summary
Add an integration test that verifies layout optimization correctly selects between multiple kernel alternatives based on the cost model.

## Background
PR #2347 implemented a DAG-based cost model that counts rotations for kernel selection. However, as noted in the PR review, the current integration tests don't actually exercise kernel selection behavior because there are no alternative kernels to choose from for the test cases.

The unit tests in `KernelCostTest.cpp` verify that rotation counting works correctly, but we need an integration test that demonstrates the cost model influencing actual kernel selection decisions in the layout optimization pass.

## Proposed Test
Create an integration test where:
1. An operation has multiple valid kernel implementations (e.g., different matrix-vector kernels)
2. The kernels have measurably different costs (rotation counts)
3. The test verifies that the layout optimization pass selects the lower-cost kernel
4. The test confirms the selection changes if costs are artificially modified

This test should be added once there are multiple kernel alternatives available for the same operation.

## Related
- #2347: PR that implemented the cost model
- #2316: Original issue for cost model implementation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.