Thread overview | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 13, 2016 core.intrinsics | ||||
---|---|---|---|---|
| ||||
Hi, while working on a faster auto-decoding it became oblivous that branch-prediction primitives such as the llvm_expect or builtin_expect are quite useful and should be avilable in a cross-platform compatible way. I propose to add a new module to to druntime called core.intrinsics that would have functions like bool likely (bool expr); bool unlikely (bool expr); and maybe void prefetch(void* mem) Please share your thoughts and tell me what other intrincic functions could/should be added. |
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Thursday, 13 October 2016 at 19:35:08 UTC, Stefan Koch wrote:
>
> Please share your thoughts and tell me what other intrinsic functions could/should be added.
I think the name should be different from "intrinsics", so that it can also contain functions like "likely-functionptr" / "likely-class" optimization functions (e.g. the is_likely template from the other thread).
-Johan
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On Thursday, 13 October 2016 at 19:49:42 UTC, Johan Engelen wrote:
> On Thursday, 13 October 2016 at 19:35:08 UTC, Stefan Koch wrote:
>>
>> Please share your thoughts and tell me what other intrinsic functions could/should be added.
>
> I think the name should be different from "intrinsics", so that it can also contain functions like "likely-functionptr" / "likely-class" optimization functions (e.g. the is_likely template from the other thread).
>
> -Johan
What name would you suggest then ?
also do you happen to know where llvm_expect is implemented in ldc ?
I cannot seem to find it.
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Thursday, 13 October 2016 at 19:52:57 UTC, Stefan Koch wrote:
>
> also do you happen to know where llvm_expect is implemented in ldc ? I cannot seem to find it.
It's at the bottom of druntime/src/ldc/intrinsics.di (note the extension).
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Thursday, 13 October 2016 at 19:52:57 UTC, Stefan Koch wrote:
>
> What name would you suggest then ?
Yeah, that's the problem isn't it... :(
Something with "optimize"?
(I'm thinking the module would combine functions with no observable effects, and for which the default implementation does nothing.)
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On Thursday, 13 October 2016 at 21:52:22 UTC, Johan Engelen wrote:
> On Thursday, 13 October 2016 at 19:52:57 UTC, Stefan Koch wrote:
>>
>> also do you happen to know where llvm_expect is implemented in ldc ? I cannot seem to find it.
>
> It's at the bottom of druntime/src/ldc/intrinsics.di (note the extension).
I saw that one, but I cannot find the place where ldc checks for this template being instantiated.
And then applies the intrinsic.
Which is what I need to see in order to define a sensible way in dmd to use those intrinsics.
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Thursday, 13 October 2016 at 19:52:57 UTC, Stefan Koch wrote:
> On Thursday, 13 October 2016 at 19:49:42 UTC, Johan Engelen wrote:
>> On Thursday, 13 October 2016 at 19:35:08 UTC, Stefan Koch wrote:
>>>
>>> Please share your thoughts and tell me what other intrinsic functions could/should be added.
>>
>> I think the name should be different from "intrinsics", so that it can also contain functions like "likely-functionptr" / "likely-class" optimization functions (e.g. the is_likely template from the other thread).
>>
>> -Johan
>
> What name would you suggest then ?
how about "fuzzylogic"?
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dominikus Dittes Scherkl | On Thursday, 13 October 2016 at 22:44:13 UTC, Dominikus Dittes Scherkl wrote:
> On Thursday, 13 October 2016 at 19:52:57 UTC, Stefan Koch wrote:
>> On Thursday, 13 October 2016 at 19:49:42 UTC, Johan Engelen wrote:
>>> On Thursday, 13 October 2016 at 19:35:08 UTC, Stefan Koch wrote:
>>>>
>>>> Please share your thoughts and tell me what other intrinsic functions could/should be added.
>>>
>>> I think the name should be different from "intrinsics", so that it can also contain functions like "likely-functionptr" / "likely-class" optimization functions (e.g. the is_likely template from the other thread).
>>>
>>> -Johan
>>
>> What name would you suggest then ?
> how about "fuzzylogic"?
It has nothing todo with fuzzy logic.
AFAIK fuzzy-logic deals with optimizing boolean logic in order to by represented by smaller transistor networks.
core.optimize suggests that there is some functionality that optimises things for you which is not the case.
The only thing this should provide are compiler-specific low-level tools to affect code-gen.
in as protable a manner as possible.
I am especially intrested in being able to provide hints for code-layout.
That does not only affect basic block-placement but also the which functions will be placed next to each other if possble.
If anyone has good suggestions as to how such facilites may be named I am all ears.
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On 10/13/16 12:52 PM, Stefan Koch wrote:
> On Thursday, 13 October 2016 at 19:49:42 UTC, Johan Engelen wrote:
>> On Thursday, 13 October 2016 at 19:35:08 UTC, Stefan Koch wrote:
>>>
>>> Please share your thoughts and tell me what other intrinsic functions
>>> could/should be added.
>>
>> I think the name should be different from "intrinsics", so that it can
>> also contain functions like "likely-functionptr" / "likely-class"
>> optimization functions (e.g. the is_likely template from the other
>> thread).
>>
>> -Johan
>
> What name would you suggest then ?
As an ignorant bystander I like core.intrinsics, but if not then perhaps core.compilerhints or something to that effect?
|
October 13, 2016 Re: core.intrinsics | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On 10/13/2016 06:55 PM, Stefan Koch wrote:
> If anyone has good suggestions as to how such facilites may be named I
> am all ears.
The best way is to find 2-3 planned artifacts that have a common theme. Then a name comes up naturally. -- Andrei
|
Copyright © 1999-2021 by the D Language Foundation