Open mppf opened 5 years ago
I'm really not a fan of extern blocks to begin with and adding this support seems like a huge mistake to me.
I do not like supporting arbitrary C and Chapel interop in this manner and I think this is an unreasonable extension that will be extremely difficult for any future Chapel implementations to support. I much prefer supporting things like c2chapel and sanity checks for non-local access.
@ronawho - is your concern about the usability or the implement-ability of this proposal / extern blocks?
Since extern blocks are compiled by a version of
clang
embedded in the Chapel compiler, we can control the dialect of C used there. In particular, with--llvm-wide-opt
compilation strategy, we can easily mark pointers in clang as referring to possibly-remote memory, since these simply need an attribute indicating that they are in a different address space. Since we use clang to generate LLVM IR, the existing LLVM pass we use to convert loads/stores on these special address spaces to GET and PUT will still function.The "extension" to C we would need for PGAS C
This would allow an alternative solution to issue #11288.
For example:
The chapel compiler could transparently handle converting
*ptr
into a GET with existing techniques.Additionally, we could consider automatically widening pointers when the Chapel compiler sees that as necessary, so that the following program could work: