heir icon indicating copy to clipboard operation
heir copied to clipboard

Add integration test for layout optimization with multiple kernel alternatives

Open bon-cdp opened this issue 2 months ago • 0 comments

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

bon-cdp avatar Oct 28 '25 14:10 bon-cdp