[PATCH] D111992: [MLIR][OpenMP] Added omp.atomic.read and omp.atomic.write

Shraiysh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 20 02:35:27 PDT 2021


shraiysh added a comment.

Hi @kiranchandramohan. Thanks for the review.

>   %8 = omp.atomic.read %addr : memref<i32> -> i32 hint(speculative, contended) memory_order(seq_cst)

This cannot be done because the statement ends at optional clauses. This is dangerous in the following situation where parser will try to match `return` as a clause instead of a new instruction. I had first actually tried it this way. Let me know if there is something that can be done to avoid this problem with this syntax.

  %8 = omp.atomic.read %addr : memref<i32> -> i32 memory_order(seq_cst)
  return

We can try one of remaining two. I do not have a preference between these three:

>   %8 = omp.atomic.read %addr hint(speculative, contended) memory_order(seq_cst) : memref<i32> -> i32 
>
>   %8 = omp.atomic.read %addr {hint(speculative, contended) memory_order(seq_cst)} : memref<i32> -> i32

  %8 = omp.atomic.read hint(speculative, contended) memory_order(seq_cst) %addr : memref<i32> -> i32 // current syntax


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111992/new/

https://reviews.llvm.org/D111992



More information about the cfe-commits mailing list