relaxed memory model function attribute

Bruce Carneal bcarneal at gmail.com
Wed Jul 31 15:32:48 UTC 2024


On Wednesday, 31 July 2024 at 10:16:57 UTC, kinke wrote:
> On Tuesday, 30 July 2024 at 16:50:05 UTC, Bruce Carneal wrote:
>> Would an @restrict function attribute that applied to all ptr 
>> and slice arguments be hard to implement?
>
> I don't think it'd be a good idea in general, and it wouldn't 
> simplify the implementation of `@restrict` for slices at all, 
> which would most likely need an ABI change 
> (https://forum.dlang.org/post/vgfxycegiagawfxaenwg@forum.dlang.org).

Not a good idea eh?  Well, using the alternative available today 
extensively I disagree.  The use case is for @safe performance 
critical programming where the compiler can not readily determine 
the aliasing (you'll see some code expansion in current LDC for 
very simple cases where the generated code first proves 
independence).

Still, thanks for the response.  I'll stick with the 
manual/@trusted nested functions workaround.  It is *much* better 
than nothing, having allowed me to ditch my entire explicit SIMD 
code base.  Well, almost everything.  I still have need for an 
efficient mapping of conditionals to bit vectors and don't know 
how to do that without dropping into SIMD land.



More information about the digitalmars-d-ldc mailing list