Skip to content

[Codegen][NFC] Move DropSchedulePass into Codegen/Common - #24501

Merged
AGindinson merged 5 commits into
iree-org:mainfrom
Alex-Wengg:alex-wengg/24466-move-drop-schedule-pass
May 27, 2026
Merged

AGindinson merged 5 commits into
iree-org:mainfrom
Alex-Wengg:alex-wengg/24466-move-drop-schedule-pass

Conversation

@Alex-Wengg

@Alex-Wengg Alex-Wengg commented May 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Relocate DropSchedulePass from the soon-to-be retired llvm-external-projects/iree-dialects/ subproject into the in-tree iree::compiler::Codegen::Common library, alongside the transform-dialect interpreter pass that always pairs with it.

this is Sub-task #3 of #24466 (retire transform.iree.match_callback and the broader iree-dialects project.

Tested in a M2 Mac

  • bazel_to_cmake regeneration reports 0 updates needed across all modified directories (Bazel↔CMake parity).
  • Repo-wide grep clean of IREELinalgTransformDialectPasses, mlir::linalg::transform::registerDropSchedulePass , and iree-dialects/Dialect/LinalgTransform/Passes.h.
  • Local Release build of iree-opt on macOS arm64 (cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ... → ninja iree-opt) succeeded; 5136/5136 edges, exit 0.
  • iree-opt --help-list shows the pass registered with the preserved --transform-dialect-drop-schedule argument and original description "Drop the schedule from the operation".

 sub-task)

Relocates the `transform-dialect-drop-schedule` pass from the soon-to-be
retired `iree-dialects` project into the in-tree `iree::compiler::Codegen::Common`
library, alongside the transform-dialect interpreter pass that always
follows it in the pipeline. This is a pure refactor; the pass argument
string is preserved so existing lit tests continue to work.

* The pass implementation is moved verbatim (PassWrapper-style) into
  `compiler/src/iree/compiler/Codegen/Common/DropSchedulePass.cpp`, with
  the namespace changed from `mlir::linalg::transform` to
  `mlir::iree_compiler` to match the surrounding codegen pass code.
* Registration is now performed by `registerCodegenCommonPasses` rather
  than by an explicit call in `IREEOptToolEntryPoint`, so the pass
  becomes available everywhere the codegen common passes are
  registered.
* All four production caller sites (Codegen/Common, Codegen/SPIRV,
  Codegen/LLVMGPU, API/Internal IREEOptToolEntryPoint) drop their
  include of `iree-dialects/Dialect/LinalgTransform/Passes.h`. Two
  additional callers (Codegen/LLVMCPU/Passes.cpp,
  Codegen/SPIRV/Passes.cpp) had stale includes of the same header that
  were no longer referencing any symbol; those are dropped as well.
* `Tools/init_iree_dialects.h` drops the include too.
* The corresponding `IREELinalgTransformDialectPasses` Bazel/CMake
  library is deleted, along with all link-deps that pointed at it from
  the IREE compiler tree.
* The CAPI entry points `mlirIREELinalgTransformRegisterPasses` and
  `mlirIREETransformRegisterPasses` are kept as no-ops to preserve ABI
  for downstream Python bindings; comments explain the new
  registration path.
* The old in-tree lit test
  `llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/drop-schedule.mlir`
  is removed; its coverage is provided by the existing in-tree
  `iree-opt --transform-dialect-drop-schedule` lit tests under
  `compiler/src/iree/compiler/Codegen/...`.

This is sub-task iree-org#3 of issue iree-org#24466 (retire `transform.iree.match_callback`
and the broader `iree-dialects` project). Continues the cleanup
started in iree-org#24500.

Verified locally with a Release `cmake -G Ninja` build of `iree-opt` on
macOS arm64; `iree-opt --help-list` shows the pass registered with the
preserved `--transform-dialect-drop-schedule` argument and the original
description string.

Signed-off-by: Alex-Wengg <[email protected]>
Comment on lines 44 to 48
void mlirIREETransformRegisterPasses() {
mlir::linalg::transform::registerDropSchedulePass();
// DropSchedulePass moved into the IREE codegen common pass library and is
// registered via `registerCodegenCommonPasses`. This entry point is kept for
// ABI compatibility with existing CAPI / Python consumers.
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is redundant comment, because people don't need to understand this in codebase. If they are interested in it, they should find a corresponding commit.

And we can delete this function.

Comment on lines 26 to 30
void mlirIREELinalgTransformRegisterPasses() {
mlir::linalg::transform::registerDropSchedulePass();
// DropSchedulePass moved into the IREE codegen common pass library and is
// registered via `registerCodegenCommonPasses`. This entry point is kept for
// ABI compatibility with existing CAPI / Python consumers.
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto, same here

Comment on lines +100 to +109
/// Creates a pass that drops the transform dialect schedule (and any empty
/// modules) from the operation it is run on. Used after the transform
/// interpreter has applied its sequence.
std::unique_ptr<Pass> createDropSchedulePass();

/// Registers the drop-schedule pass with the global pass registry. Called from
/// `iree-opt` tool setup so that `-transform-dialect-drop-schedule` is
/// available on the command line and in lit RUN lines.
void registerDropSchedulePass();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

They are not needed in modernized pass infrastracture. Please check how other passes are doing here. E.g., 3483893

The pass should be registered in Passes.td.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since you are here, it is better to follow the naming convention. We don't have Pass suffix in filename.

@Alex-Wengg
Alex-Wengg requested a review from hanhanW May 21, 2026 22:35
@hanhanW

hanhanW commented May 26, 2026

Copy link
Copy Markdown
Contributor

LGTM, can you fix the DCO issue? Thanks

- Delete now-empty mlirIREELinalgTransformRegisterPasses and
  mlirIREETransformRegisterPasses CAPI entry points, their declarations
  in iree-dialects-c/Dialects.h, the no-op call in IREEDialectsModule.cpp,
  and the matching entries in the api_exports.* artifacts.
- Rename Codegen/Common/DropSchedulePass.cpp to DropSchedule.cpp to match
  the directory's naming convention (no Pass suffix on filenames).

Tablegen-ification of the pass registration is deferred to a follow-up.

Signed-off-by: Alex-Wengg <[email protected]>
Declare the pass in Passes.td and switch the .cpp to inherit from the
generated impl::DropSchedulePassBase, dropping the hand-written
createDropSchedulePass / registerDropSchedulePass declarations in
Passes.h and the manual register call in Passes.cpp. The pass argument
name, description, factory, and registration are now produced by the
existing GEN_PASS_DECL / GEN_PASS_REGISTRATION machinery.

Pass logic (runOnOperation, canScheduleOn) is unchanged, and the public
flag remains `--transform-dialect-drop-schedule` so existing lit tests
and downstream consumers are unaffected.

Signed-off-by: Alex-Wengg <[email protected]>
…op-schedule

The pass argument is renamed from `transform-dialect-drop-schedule` to
`iree-transform-dialect-drop-schedule` so it matches the convention
used by the rest of Codegen/Common/Passes.td. Before this change it was
the only entry in the file (out of ~100) with no `iree*` prefix at all.

The new name aligns with the companion pass
`iree-transform-dialect-interpreter`, which is always invoked
immediately before drop-schedule in lit RUN lines.

Updates the Passes.td def and all 28 lit tests that reference the old
flag. No behavior change.

Signed-off-by: Alex-Wengg <[email protected]>
…edule

Fixes a Bazel strict-deps failure in the linux_x64_bazel CI job:

  error: module //compiler/src/iree/compiler/Codegen/Common:Common does
  not depend on a module exporting
  'mlir/Dialect/Transform/Interfaces/TransformInterfaces.h'

DropSchedule.cpp includes that header to use TransformOpInterface, but
the move into Codegen/Common didn't carry the matching dep over from
the previous IREELinalgTransformDialectPasses target. CMake didn't
flag this because it doesn't enforce header->dep correspondence;
Bazel does. Adding the same dep to the CMake side keeps both build
systems in sync.

Signed-off-by: Alex-Wengg <[email protected]>
@Alex-Wengg
Alex-Wengg force-pushed the alex-wengg/24466-move-drop-schedule-pass branch from 44f3598 to 7c5313f Compare May 26, 2026 01:14
@Alex-Wengg

Copy link
Copy Markdown
Contributor Author

@hanhanW i have updated the DCO, i suspect the jobs: Test AMD MI355, windows_x64_msvc and ci_summary might not be related to my change here

@AGindinson
AGindinson enabled auto-merge (squash) May 26, 2026 16:23
@AGindinson
AGindinson merged commit 0edf1fd into iree-org:main May 27, 2026
122 of 125 checks passed
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