[Mlir-commits] [flang] [mlir] [Flang][OpenMP] Support lowering of simd reductions (PR #112194)

Kiran Chandramohan llvmlistbot at llvm.org
Tue Oct 15 06:12:06 PDT 2024


kiranchandramohan wrote:

> > If you do not want to change for already implemented lowering, it is fine. But going forward we should try to error out in Flang vs translation.
> 
> What is the reason for this preference? In my opinion, it has the disadvantage that we wouldn't be able to independently work on Flang lowering before the translation to LLVM IR for that operation/clause is implemented.

This is to present a uniform way in the flang compiler to message to the user that a feature is not implemented. As you know the user does not care about which part of the compiler does not support the feature. Lowering is currently the place where this is implemented for all features including OpenMP features and we have full control over this.

> I understand that we don't want to silently ignore clauses by lowering them to MLIR and then not taking them into account in the LLVM IR translation pass. But if we emit an error and return early when we find these operations/clauses there, the result from a user perspective would be the same. At the moment the error message is different, but if that's important it wouldn't take much to add a similar TODO macro to the MLIR to LLVM IR translation as well. Either way we should trigger errors there because if another dialect or frontend decides to introduce operations/clauses for which we have no translation to LLVM IR implemented, we should emit errors instead of crashing/ignoring them.

Yes, we should provide appropriate errors in translation if a feature/clause/directive/option is not supported. Adding a similar TODO macro to the MLIR to LLVM IR translation would also work. But I am not sure whether it will be accepted since it is not the way things are done in MLIR. But since at the moment it is only Flang work that uses this it might be OK. Would it be possible to catch this in the call to the translation and issue a TODO in Flang codegen or Driver?


We can see the worst-case issue in this distribute construct translation issue where it presents as a crash.
https://github.com/llvm/llvm-project/issues/109755

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


More information about the Mlir-commits mailing list