Support `@llvm.nvvm.membar` intrinsic
It looks like Nvidia added a new nvvm intrinsics as part of hopper and deprecated the old format.
https://docs.nvidia.com/cuda/nvvm-ir-spec/index.html#barrier-and-memory-fence
https://godbolt.org/z/hvqPTb5eq
cc: @maleadt
@llvm/issue-subscribers-julialang
General caveat: NVVM != LLVM and LLVM does not match the intrinsics provided by NVVM. Whether LLVM will end up using the same signature if/when it's implemented will depend on whether it's suitable for LLVM.
To provide more specifics for this feature request.
Currently we provide a subset of membar intrinsics for cta/gl/sys variants:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/NVPTX/NVPTXIntrinsics.td#L302
NVVM has introduced a unified variant which accepts an integer constant which selects a particular instruction variant.
declare void @llvm.nvvm.membar(i32 %flags)

Can I ask the dumb question of why these aren't spelled fence syncscope?
That's an excellent question in particular due to the fact that there are also now are scoped atomics (which you currently need to implement by embedding assembly) for NVPTX.
Naming is hard. Once particular name is used, it becomes pretty hard to change or undo it. The initial choices, even when they turn out to be suboptimal later, often continue to live on.
@Artem-B I am looking for easy tasks to work on I am new to the backend, but I am interested in GPUs. Is this an easy one? If not, can you suggest some? and please suggest ones that don't require GPUs.
Thanks
@Artem-B Ping. I got an Nvidia GPU. Is this an easy issue to start with?
The first question is whether we should do this. 1:1 match with NVVM is not LLVM's goal. Doing it for the sake of doing does not make a lot of sense. If there's a specific use case where it's needed, then we can consider it. Otherwise, I'd suggest picking something else as a starter project.
@justinfargnoli -- do you have anything on your TODO list which would work as a self-contained starter project?
Thanks for the ping @Artem-B.
@elhewaty, I'm happy to hear that you are interested in contributing!
I wrote down some ideas I've had in the back of my head in these two issues: #116695 and #116697.
Another simple first issue is #114339. However, that's currently assigned to @Quark-69. I'll leave it to him to update you on whether he will continue working on it or if he has put it down to focus on other things.
@durga4github or @schwarzschild-radius may know other good starter issues related to intrinsic support.
I also regularly file bugs based on improvements that @Artem-B suggests during reviews. So, if the current set of good first issues doesn't appeal, I'll continuously add more.
Also, @elhewaty, is there a particular area you are interested in contributing to? I can watch for work that crops up in that area.
@elhewaty i am still working on the issue it's just that sem exams are going on. I'll get back on track after 3-4 days.
@justinfargnoli, thank you for your reply. Anyarea is fine but GPU compilers or backends will be great for me.