clementval wrote: > Thanks @skatrak and @bhandarkar-pranav for the approval. > > @kiranchandramohan @clementval I think there is a pretty simple solution that > enables us to mark multi-range loop nests. I think we can add an optional > attribute to the `fir::DoLoopOp` to store the loop nest depth: > `nest_depth(n)`. So for the following input: > > ```fortran > do concurrent (i=1:10, j=1:10) > end do > ``` > > The MLIR would look like this: > > ```mlir > fir.do_loop %arg0 = %10 to %11 step %c1 unordered nest_depth(2) { > %14 = fir.convert %arg0 : (index) -> i32 > fir.store %14 to %3#1 : !fir.ref<i32> > fir.do_loop %arg1 = %12 to %13 step %c1_2 unordered { > %15 = fir.convert %arg1 : (index) -> i32 > fir.store %15 to %1#1 : !fir.ref<i32> > .... > } > } > ``` > > So the new attribute would be attached only to the outermost loop op in the > nest. I think this is a non-distruptive change to the op that enables us to > model loop nests more easily. So this is similar to what @kiranchandramohan > suggested above but I think more self-contained: one attribute to tie the > whole nest together. WDYT?
I would prefer a proper operation than trying to patch the current one. We have plenty of example of loop operation with multiple ranges so let's model it the proper way. https://github.com/llvm/llvm-project/pull/127595 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits