iree: error: failed to solve for affinity analysis on sharded toy llama model

What happened?

Compilation of a sharded toy-sized llama model fails to compile with

toy.mlir:3:1: error: failed to solve for affinity analysis

Steps to reproduce your issue

  1. Download and extract sharded-toy-llama-affinity-analysis-bug.zip
  2. Run ./compile.sh.

What component(s) does this issue relate to?

Compiler

Version information

I have bisected and found the bad commit e2f3565c310f0455a76e6c147b73f7ec38a3cc4c. Note that at that point the failure message is a bit different

toy.mlir:3:1: error: affinity analysis failed to converge (input program may have invalid affinities assigned); use`--iree-stream-annotate-input-affinities` to help identify the invalid affinities

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 41 (36 by maintainers)

Commits related to this issue

Most upvoted comments

I think I got confused about what we’re trying to fix in this issue because there are two models(?) in the issue. I suggest creating a different one for the deepseek model, because it has its own issues. E.g., increasing maxFixpointIterations does not fix your deepseek model issues.

After reading through all the discussion, I think the problem is straightforward in the original lamma issue – it can compile if we increase the maxIterations default value. I.e., we need to understand why and provide a proper fix (or do we just increase the default value?)

The deepseek issue here led me to debug something different, and I suggest filing another issue to investigate that. They may have the same issue, and you can say that the deepseek issue may depend on this issue.

It could be my problem. The current situation is that we have a messy state, and I don’t know what we’re actual looking for in the next steps. I can see that you want everything working as the end goal, but it is not easy to track the discussion for me. I think the advantage of having two issues is that others won’t get confused when they read through all the comments, and the focus area of this issue can be investigating maxFixpointIterations problem.

Do you mean that if we fix the test by explicitly assigning affinities it still fails after 20250520?

Yes. More precisely it fails after 556785784814d95ee1fce52bae8738b3541fb3dd.

@Alex-Vasile thank you sharing this failure. In this test we actually did not assign proper argument device affinities as it was written before IREE Turbine had support for this. But there is still a regression with fixed affinities. It seems maybe not related to the issue here. I opened an new issue https://github.com/iree-org/iree/issues/20870.

@MaheshRavishankar, yes reverting that commit makes the reproducer code above compile.

However, the issue I have in https://github.com/nod-ai/shark-ai/pull/1238 does not get fixed by reverting it. I opened a seperate issue for that here: #20551.

I am trying a few things. I haven’t been able to fix it yet