[all-commits] [llvm/llvm-project] ec50f5: [MLIR][Support] A cache for cyclical replacers/map...
Billy Zhu via All-commits
all-commits at lists.llvm.org
Thu Jul 11 22:08:49 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ec50f5828f25ae8b494475c6e151d9849800da7c
https://github.com/llvm/llvm-project/commit/ec50f5828f25ae8b494475c6e151d9849800da7c
Author: Billy Zhu <billyzhu at modular.com>
Date: 2024-07-11 (Thu, 11 Jul 2024)
Changed paths:
A mlir/include/mlir/Support/CyclicReplacerCache.h
M mlir/unittests/Support/CMakeLists.txt
A mlir/unittests/Support/CyclicReplacerCacheTest.cpp
Log Message:
-----------
[MLIR][Support] A cache for cyclical replacers/maps (#98202)
This is a support data structure that acts as a cache for replacer-like
functions that map values between two domains. The difference compared
to just using a map to cache in-out pairs is that this class is able to
handle replacer logic that is self-recursive (and thus may cause
infinite recursion in the naive case).
This class provides a hook for the user to perform cycle pruning when a
cycle is identified, and is able to perform context-sensitive caching so
that the replacement result for an input that is part of a pruned cycle
can be distinct from the replacement result for the same input when it
is not part of a cycle.
In addition, this class allows deferring cycle pruning until specific
inputs are repeated. This is useful for cases where not all elements in
a cycle can perform pruning. The user still must guarantee that at least
one element in any given cycle can perform pruning. Even if not, an
assertion will eventually be tripped instead of infinite recursion (the
run-time is linearly bounded by the maximum cycle length of its input).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list