)]}'
{
  "commit": "48c6baf87e11cf27e4f87f837c72630fbc3c7cad",
  "tree": "22aa31efe16aa481decefbf440a2f902ef89640c",
  "parents": [
    "53f046e6c73a23e46bc4ea986dc951c25fe33a21"
  ],
  "author": {
    "name": "Julian Brown",
    "email": "julian.brown@amd.com",
    "time": "Tue Nov 24 14:20:41 2026 +0000"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Tue Nov 24 06:27:34 2026 -0800"
  },
  "message": "[OpenMP] Honour memory-order clauses on the flush directive (#241295)\n\nAt present the acquire, release and acq_rel clauses on \u0027flush\u0027 are\naccepted but have no effect. Flushes are emitted as `__kmpc_flush`\nruntime calls, which implement a seq_cst fence.\n\nAMD have had a downstream patch for a while (by Carlo Bertolli) which\nadds per-ordering `__kmpc_flush_*` entry points to the device runtime.\nThis patch takes a slightly different approach: for the host, a seq_cst\nflush still calls `__kmpc_flush`, and a flush with any other ordering\ncalls the `__kmpc_flush_explicit` entry point from #133325, so it needs\na runtime that has that. For the GPU, it emits a fence directly.\n\nThis has mild benefits: OpenMPOpt already handles fences when it\nconverts kernels to SPMD mode, but has no knowledge of the new\n`__kmpc_flush` calls (either _explicit or Carlo\u0027s per-ordering flush\ncalls). Scope names differ per-GPU: they are determined using the\nmechanism introduced by #213810 (\"[LLVM] Unify atomic scope handling\nbetween LLVM and Clang\").\n\nThe lowering is done in OpenMPIRBuilder. The createFlush function now\ntakes an ordering and a scope, and is now used for every GPU flush. The\nOpenMPIRBuilder-disabled path is unaffected. Flang/MLIR call createFlush\nwith the defaults, so their host output is unchanged, but their GPU\nflushes now become fences instead of `__kmpc_flush` calls.\n\nSince e8e05de08bea (\"[OPENMP50]Add codegen for acq_rel clause in\natomic|flush directives\"), a flush with neither a list nor a\nmemory-order clause has been passed to emitFlush as acq_rel. That is\nonly right for OpenMP 5.0: from 5.1 it behaves as seq_cst, and before\n5.0 there were no memory-order clauses and it was a full flush. It is\nnow emitted as seq_cst except for OpenMP 5.0.\n\nThe flush that Clang keeps after a seq_cst atomic construct for OpenMP\n4.5 and earlier goes through the same lowering, so on a GPU it is a\nseq_cst fence too.\n\nCo-authored-by: Carlo Bertolli \u003cCarlo.Bertolli@amd.com\u003e\nAssisted-By: Claude\nGitOrigin-RevId: a2d52a5163b14e3cf75b6a390efcb964d28b6aaf\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "968b418e00a9655e60ece2534173ecf8c1fb03af",
      "new_mode": 33188,
      "new_path": "runtime/test/flush/omp_flush_memory_order.c"
    }
  ]
}
