[Tuner][Codegen] Add iree_codegen.constraints op and supporting infra#23687
[Tuner][Codegen] Add iree_codegen.constraints op and supporting infra#23687kuhar merged 2 commits intoiree-org:mainfrom
Conversation
ce9d314 to
a619486
Compare
Today, the tuner has to know a lot about the IREE compiler and its compilation pipelines, including what inputs they can compile, their configuration space, their lowering_config format, etc. This is partially encoded directly as Python logic and partially exposed through Python bindings. This is the first step towards moving the constraint generation responsibility from the tuner to the compiler. The constraints op encodes pipeline constraints over one or more root ops and can later be lowered to SMT-LIB for solving by the tuner, or verified against the selected lowering_config after dispatch configuration. See the discussion for the full proposal: iree-org#23521 Key design decisions: - The knobs dict structurally mirrors the lowering_config / translation_info attributes, with tunable leaves as `#iree_codegen.int_knob<"name">`. This makes it possible for the tuner to mechanically substitute solved knob values back into concrete attributes without understanding their structure. - Problem dimensions come in as index operands (from tensor.dim / constants), so that static sizes get constant-folded into the SMT body and dynamic shapes remain symbolic. - The body uses upstream SMT dialect ops, so that we can directly export to SMT-LIB without a custom lowering. - Pipeline attr accepts both DispatchLoweringPassPipelineAttr and the new PipelineAttrInterface (iree-org#23590) to support custom pipelines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2e85929 to
1a590b9
Compare
|
Is part of the implementation still missing? I know that none of these ops will be lowered, instead they are used by the tuner, but I'm a little bit curious where the tuner code that uses these knobs is. Is it on a different repo? |
I'm landing piecewise to limit the PR size. There are no consumers as of now. Check the discussion in the PR description for the e2e prototype. |
amd-eochoalo
left a comment
There was a problem hiding this comment.
I still need a bit of time to review the overall design a bit more, but this PR looks good.
I was thinking about suggesting a different target that includes the SMT dialect (since it is only useful for the tuner), but I think keeping the build system simple where the cost is only linking against the SMT dialect is a good trade off.
The plan is to also use it for verification after the usual compilation path decides the lowering config. But even if we did move it to a new target, I'm not sure what the benefit would be since everything is statically linked anyway. |
…anslationInfoAttr (#23868) Context: some changes happen from the IREE side: - #23590 - #23687 - #23816 and tuner CI error: https://github.com/nod-ai/amd-shark-ai/actions/runs/23314739415/job/67811065632?pr=2865#step:8:135 This PR fixes the C API assertion in `TranslationInfoAttr.get()` to accept `PipelineAttr` in addition to `DispatchLoweringPassPipelineAttr` Assisted-by: [Claude Code](https://claude.ai/code) Signed-off-by: Bangtian Liu <liubangtian@gmail.com>
Today, the tuner has to know a lot about the IREE compiler and its compilation pipelines, including what inputs they can compile, their configuration space, their lowering_config format, etc. This is partially encoded directly as Python logic and partially exposed through Python bindings. We want to move this to the compiler instead.
The constraints op encodes pipeline constraints over one or more root ops and can later be lowered to SMT-LIB for solving by the tuner, or verified against the selected lowering_config after dispatch configuration. See the discussion for the full proposal: #23521
Key design decisions:
#iree_codegen.int_knob<"name">. This makes it possible for the tuner to mechanically substitute solved knob values back into concrete attributes without understanding their structure.Issue: #23535