[llvm] [DA] runtime predicates for delinearization bounds checks (PR #170713)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 10:18:08 PST 2025


kasuga-fj wrote:

Since I hadn't answered the questions, let me answer them here.

> IIRC these runtime predicates are not yet used anywhere, right? They only appear in the analysis output for now?

Yes, that's correct.

> On the other hand, I could see value in doing this now if this helps with testing somehow, e.g. because it allows us to easily test situations in DA that would otherwise be hard to test because of delinearization failures. Is something like this the case?

At least for this PR, this is not the case. This PR tries to add predicates to make the validation of delinearization succeed, but we already have the option `-da-disable-delinearization-checks` to skip the validation. For testing purpose, this option is sufficient. Also, I don't think that adding runtime predicates would make DA testing easier, not only for delinearization.

Basically, I agree with postponing the runtime predicates functionality. Even if it appears orthogonal to other DA works, I think that generally increasing code complexity can make those works more difficult. Also, it's unclear which predicates we should use in runtime checks. At least we need to think about the followings:

- Of course, it's better to have a small number of predicates to increase the possibility of passing them.
- It's not necessarily required to remove the dependency completely. For example, eliminating specific directions from the dependency (e.g., all directions `*` -> only positive direction `<`) would be sufficient for some loop transformations.
- Fixing the correctness issues will degrade the analysis precision. It may change the necessary runtime predicates to achieve the motivated transformations.
- With the current design, almost every loop transformation that uses DA will likely generate the same set of runtime predicates. This could easily lead to a code-size explosion. I think we need some mechanism to cache/share the results of DA, but it will be quite challenging.

https://github.com/llvm/llvm-project/pull/170713


More information about the llvm-commits mailing list