HPC & Scientific Computing (pointer restrictions, etc.) #2044
Replies: 3 comments 3 replies
-
@chandlerc I have a vague recollection that you had some thoughts about |
Beta Was this translation helpful? Give feedback.
-
Perhaps a special type of pointer, similar to |
Beta Was this translation helpful? Give feedback.
-
Or maybe Fortran18 could give some hints. It is similarly low-level. |
Beta Was this translation helpful? Give feedback.
-
Hello, I have a question/suggestion concerning pointer restrictions in Carbon.
Currently, the C99 standard implements the
restrict
keyword to prevent pointer aliasing. Althoughrestrict
is not part of the C++ standard, most compilers implement it as__restrict
, which has the same effect.This is a very important issue in High-Performance Computing (HPC), where the compiler's inability to determine if a pointer uniquely refers to a memory location prevents it from performing several valuable optimizations. This is often cited as the reason that naive C cannot be as efficient as Fortran.
A simple solution would be to re-implement the
restrict
keyword in Carbon. However, this would be very verbose and difficult to read in HPC applications. I give an example below.I am curious as to whether there are better methods of making such optimizations without introducing bugs. It would be an improvement to at least have shorter keywords.
Beta Was this translation helpful? Give feedback.
All reactions