Expressing parallelism/concurrency in MLIR

Hello,

Are there ways to express concurrency/parallelism in MLIR? I’m not thinking of data parallelism (identifying loops where iterations can be executed in parallel) but thread/task parallelism, things like forking (giving control to two blocks at the same time).

If they do not exist, are there plans to support them in the future? Or any discussion threads on this topic I may have missed?

This discussion is probably related to the one on relaxing SSA dominance. This is because people who would benefit from relaxing SSA dominance are exactly those that need to define new DSLs, and concurrency is important.

Best regards,
Dumitru

Hi Dumutru,

There’s not really anything along these lines yet, but this is exactly why I’m interested in the SSA dominance question. We’ve built some internal dialects along these lines, but there’s not really anything in the open repository today. I’d encourage you to attend the open design meeting this week if you can, which will discuss how hardware description languages could be represented in MLIR. I’d love to see peoplee interested in this area working together to build such abstractions in MLIR.

Steve

Hello Stephen, hello all,

I’m coming back to my post after Fabian Schuiki’s presentation (and some time to think about it). Is there a thread discussing it?

If not: I noted that the entity level - the only one to allow the expression of concurrency - is the least MLIR-like. This is probably normal, because the semantics is provided by a library of standard cells, and llhd does not want to make choices (it would be difficult, given that it can target both synchronous and asynchronous logic).

My feeling, however, is that the behavioral level could allow some representation of concurrency - and more precisely deterministic concurrency.

What do you think?

Dumitru

It seems to me like the behavioral level in LLHD is specifically trying to describe the elements in a Verilog/VHDL type of concurrency model. I think that there will need to be a variety of dialects describing different types of structured concurrency, and many of them are deterministic as well. As an example, Kahn Process Networks are a semantic model where processes communicate by unbounded single reader/single writer fifos and can only perform blocking operations on those fifos. KPN’s are provably deterministic. Synchronous languages can also be viewed as a having an underlying concurrency model where at each time step components exchange messages until they ‘agree’ on the state of the system, at which point execution can proceed to the next time step. These models don’t necessarily fit exactly into the behavioral model of LLHD, although they could certainly be related to it through lowering transformations.