(from Codegen Dialect Overview)
First, I am curious about the payload part.
If I want to make the conversion between standard(math) and standard(scalar), how could I do that? (I think I could convert MHLO to standard(math) by --mhlo-legalize-to-std )
I am confused about the conversion in the same dialect.

Second, if I make the conversion in the payload part and the structure part, I should get LLVM(core) and LLVM(CFG).
How could I merge them together or use them together to convert to LLVM IR file?

This figure starts to get dated, many of the things evolved since it was created.

Math dialect is now a separate thing. It can be converted to LLVM if desired with -convert-math-to-llvm. Some of the remaining “standard” operations are still applicable to elementwise tensors, e.g. addf. You need a combination of -convert-elementwise-to-linalg, bufferization passes including but not necessarily limited to -linalg-bufferize (depending on the mix of dialects in the input), and -convert-linalg-to-loops to get to scalar “standard” operations from tensor equivalents.

Absolutely nothing in the infrastructure prevents you from converting a set of operations A to a set of operations B, whether they belong to a dialect or not. Dialects are essentially libraries and decisions on what belongs to which dialect may be quite arbitrary. The conversion infrastructure (mostly) doesn’t care about dialects, only operations.

As noted in the figure, these are two parts of the same and one dialect. At no point they are emitted in different code units so there must be zero need to “merge them together”. Even if they had been different dialects, MLIR is specifically designed to work with a mix of dialects. It is incorrect to think of MLIR as “being expressed in a dialect”, it is a mix of dialects in the overwhelming majority of non-trivial cases.

mlir-translate -mlir-to-llvmir translates the set of supported operations to LLVMIR. This set includes the LLVM dialect and associated “intrinsic” dialects, and OpenMP.