This patch adds lowering support for atomic read and write constructs.
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Differential D122725
[flang][OpenMP] Added lowering support for atomic read and write constructs NimishMishra on Mar 30 2022, 5:16 AM. Authored by
Details This patch adds lowering support for atomic read and write constructs. Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Diff Detail
Event TimelineComment Actions @rriddle @ftynse Could you please look at the MLIR side of this patch? Concretely, without the changes done there, atomic read and write constructs were giving builtin.unrealized_conversion_cast for the variables used within them. An example I give below: program sample use omp_lib integer::x,v !$omp atomic read x = v end program sample llvm.func @_QQmain() { %0 = llvm.mlir.constant(1 : i64) : i64 %1 = llvm.alloca %0 x i32 {bindc_name = "v", in_type = i32, operand_segment_sizes = dense<0> : vector<2xi32>, uniq_name = "_QFEv"} : (i64) -> !llvm.ptr<i32> %2 = builtin.unrealized_conversion_cast %1 : !llvm.ptr<i32> to !fir.ref<i32> %3 = llvm.mlir.constant(1 : i64) : i64 %4 = llvm.alloca %3 x i32 {bindc_name = "x", in_type = i32, operand_segment_sizes = dense<0> : vector<2xi32>, uniq_name = "_QFEx"} : (i64) -> !llvm.ptr<i32> %5 = builtin.unrealized_conversion_cast %4 : !llvm.ptr<i32> to !fir.ref<i32> omp.atomic.read %5 = %2 : !fir.ref<i32> llvm.return } We technically allowed the conversion for these operations (having no region attached to them).
Comment Actions LGTM
Comment Actions Addressed comments.
Comment Actions The CI fails. Can this be at high priority? The threadprivate directive lowering needs some code of this PR. The default clause lowering needs some code from the threadprivate directive lowering.
Comment Actions LGTM. Please wait for approval from @clementval/@schweitz for the location of attaching the OpenMP interface and any outstanding comments from the other reviewers.
|
Nit: I think this can just be PointerModels.h or Tools/PointerModels.h.