[cfe-dev] [RFC] Support synchronisation scope in Clang atomic builtin functions
Zhuravlyov, Konstantin via cfe-dev
cfe-dev at lists.llvm.org
Wed Jan 18 22:06:12 PST 2017
From: Anastasia Stulova [mailto:Anastasia.Stulova at arm.com]
Sent: Tuesday, January 17, 2017 1:55 PM
To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>; cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>
Cc: Sumner, Brian <Brian.Sumner at amd.com>; Tye, Tony <Tony.Tye at amd.com>; Zhuravlyov, Konstantin <Konstantin.Zhuravlyov at amd.com>; Bader, Alexey (alexey.bader at intel.com) <alexey.bader at intel.com>; nd <nd at arm.com>
Subject: RE: [RFC] Support synchronisation scope in Clang atomic builtin functions
FYI, reference to the relevant part of the OpenCL spec: https://www.khronos.org/registry/OpenCL/specs/opencl-2.0-openclc.pdf#105
>From the OpenCL side this proposal seems to make sense generally. I am not quite clear though what would happen with the scopes other than synch_scope_single_thread.
Do you need to extend the IR language to accommodate that too in addition to 'singlethread' flag you already use?
We have the review/RFC for this posted here: https://reviews.llvm.org/D21723. But did not get a chance to follow up yet.
Konstatnin
Cheers,
Anastasia
From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com]
Sent: 17 January 2017 17:16
To: cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>)
Cc: Sumner, Brian; Tye, Tony; Zhuravlyov, Konstantin; Anastasia Stulova; Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>)
Subject: [RFC] Support synchronisation scope in Clang atomic builtin functions
OpenCL 2.0 atomic builtin functions have a scope argument which is ideally represented as synchronization scope argument in LLVM atomic instructions.
Clang supports translating Clang atomic builtin functions to LLVM atomic instructions. However it currently does not support synchronization scope of LLVM atomic instructions. Without this, users have to use LLVM assembly code to implement OpenCL atomic builtin functions.
I have a patch (https://reviews.llvm.org/D28691 ) which allows Clang atomic builtin functions to accept an optional synchronization scope argument, so that they can be used to implement OpenCL atomic builtin functions.
This patch will not just benefits OpenCL. It will benefit any languages which need to generate atomic instructions with synchronization scopes. For languages not using synchronization scopes there is no functional change, since the synchronization scope argument is optional, and its default value generates the same LLVM instruction as before.
Your comments are welcome.
Thanks.
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170119/7ba9374c/attachment.html>
More information about the cfe-dev
mailing list