Skip to content

Fix correctness of InvarianceCheck and other SSA slice walks. - #61

Draft
KFAFSP wants to merge 1 commit into
torch-spyre:mainfrom
KFAFSP:kfaf/ssa-dependence-analysis
Draft

Fix correctness of InvarianceCheck and other SSA slice walks.#61
KFAFSP wants to merge 1 commit into
torch-spyre:mainfrom
KFAFSP:kfaf/ssa-dependence-analysis

Conversation

@KFAFSP

@KFAFSP KFAFSP commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

This is a continuation of the pre-open-source issue with the following description:

The previous implementation of the InvarianceCheck did not properly examine the required MLIR interfaces, and did not consider dependencies carried through block arguments. In particular, it was not conservative enough. This can be done using built-in functionality provided in mlir/Analysis/SliceWalk.h.

This commit adds a new SliceAnalysis and LoopSliceAnalysis types that implement the correct behavior and a reusable cache as a managed MLIR analysis.

Unfortunately, there is a bug upstream that prevents the aforementioned MLIR utility from working correctly. Until the associated PR is merged in, the new SliceAnalysis is overly conservative.


There are now more uses for these analyses in the scheduler, and therefore we should hurry to centralize this key feature of IR analysis.

Provides a backport of llvm-project/pull/188758 which is used to
implement generic SSA slice analyses. In particular, provides a cached
control-flow aware `BackwardSliceAnalysis`, the `ForwardSlice` helper
and the `LoopSliceAnalysis`.

The `LoopSliceAnalysis` uses the `mlir::LoopLikeOpInterface` to
determine all fundamental loop-variant SSA values and constructs a
forward slice from them. This analysis is intended to replace the crude
invariance check currently used in the scheduler.

Signed-off-by: Karl F. A. Friebel <karl.friebel@ibm.com>
@KFAFSP
KFAFSP force-pushed the kfaf/ssa-dependence-analysis branch from 76a6108 to ebf4ac4 Compare August 6, 2026 15:48
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.

1 participant