relaxed memory model function attribute

Gladstone charlesyhz06 at outlook.com
Thu Oct 31 09:16:59 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) (https://bestrealdoll.com/).

For performance-critical functions, especially in environments 
like auto-vectorization and DCompute, it's crucial to maintain 
clarity while ensuring optimal performance. While nested 
functions can be a workaround, they might complicate the code 
when dealing with multiple inputs and outputs. If you’re 
considering an implementation change, it’s wise to weigh the 
benefits against potential ABI changes and the complexity it 
might introduce. Keeping the code maintainable while optimizing 
performance is a delicate balance.





More information about the digitalmars-d-ldc mailing list