Jump to page: 1 218  
Page
Thread overview
To help LDC/GDC
Apr 06, 2013
bearophile
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Timon Gehr
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
deadalnix
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Manu
Apr 08, 2013
John Colvin
Apr 08, 2013
Manu
Apr 08, 2013
Dicebot
Apr 08, 2013
Dicebot
Apr 08, 2013
Jesse Phillips
Apr 09, 2013
Walter Bright
Apr 09, 2013
Jacob Carlborg
Apr 09, 2013
Dicebot
Apr 09, 2013
Manu
Apr 09, 2013
Dicebot
Apr 09, 2013
Manu
Apr 09, 2013
Dicebot
Apr 09, 2013
Manu
Apr 09, 2013
Dicebot
Apr 10, 2013
Walter Bright
Apr 10, 2013
Walter Bright
Apr 09, 2013
Timon Gehr
Apr 09, 2013
deadalnix
Apr 09, 2013
Daniel Murphy
Apr 09, 2013
deadalnix
Apr 09, 2013
Timon Gehr
Apr 09, 2013
Manu
Apr 09, 2013
Timon Gehr
Apr 09, 2013
Timon Gehr
Apr 09, 2013
deadalnix
Apr 10, 2013
Walter Bright
Apr 10, 2013
Timon Gehr
Apr 10, 2013
Walter Bright
Apr 10, 2013
Walter Bright
Apr 11, 2013
Timon Gehr
Apr 11, 2013
Walter Bright
Apr 11, 2013
Timon Gehr
Apr 11, 2013
deadalnix
Apr 08, 2013
Manu
Apr 08, 2013
Timon Gehr
Apr 08, 2013
Manu
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Manu
Apr 08, 2013
David Nadlinger
Apr 08, 2013
David Nadlinger
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Johannes Pfau
Apr 08, 2013
Johannes Pfau
Apr 09, 2013
Walter Bright
Apr 09, 2013
Walter Bright
Apr 09, 2013
Manu
Apr 09, 2013
Dicebot
Apr 09, 2013
Manu
Apr 09, 2013
Dicebot
Apr 09, 2013
Timon Gehr
Apr 09, 2013
Jacob Carlborg
Apr 09, 2013
ixid
Apr 09, 2013
tn
Apr 09, 2013
Manu
Apr 10, 2013
Walter Bright
Apr 11, 2013
Zach the Mystic
Apr 09, 2013
Simen Kjærås
Apr 09, 2013
Dicebot
Apr 09, 2013
Pelle Månsson
Apr 09, 2013
Dicebot
Apr 09, 2013
Simen Kjærås
Apr 09, 2013
Dicebot
Apr 09, 2013
Simen Kjaeraas
Apr 10, 2013
Walter Bright
Apr 09, 2013
kenji hara
Apr 09, 2013
Jesse Phillips
Apr 09, 2013
Simen Kjærås
Apr 10, 2013
Walter Bright
Apr 11, 2013
deadalnix
Apr 11, 2013
Walter Bright
Apr 11, 2013
Timon Gehr
Apr 11, 2013
deadalnix
Apr 11, 2013
Walter Bright
Apr 11, 2013
deadalnix
Apr 09, 2013
Dicebot
Apr 09, 2013
John Colvin
Apr 09, 2013
Dicebot
Apr 09, 2013
Dicebot
Apr 10, 2013
deadalnix
Apr 10, 2013
Dicebot
Apr 10, 2013
deadalnix
Apr 10, 2013
Dicebot
Apr 10, 2013
deadalnix
Apr 10, 2013
Timon Gehr
Apr 10, 2013
deadalnix
Apr 10, 2013
Dicebot
Apr 11, 2013
deadalnix
Apr 09, 2013
Manu
Apr 09, 2013
Simen Kjaeraas
Apr 10, 2013
deadalnix
Apr 10, 2013
Walter Bright
Apr 10, 2013
Walter Bright
Apr 10, 2013
Walter Bright
Apr 09, 2013
Zach the Mystic
Apr 10, 2013
Zach the Mystic
Apr 08, 2013
Simen Kjaeraas
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Johannes Pfau
Apr 09, 2013
Manu
Apr 09, 2013
Dicebot
Apr 09, 2013
Simen Kjærås
Apr 08, 2013
Jacob Carlborg
Apr 08, 2013
Manu
Apr 08, 2013
David Nadlinger
Apr 08, 2013
Jacob Carlborg
Apr 08, 2013
deadalnix
Apr 08, 2013
Iain Buclaw
Apr 08, 2013
Jacob Carlborg
Apr 08, 2013
Dicebot
Apr 08, 2013
Timon Gehr
Apr 08, 2013
Simen Kjaeraas
Apr 08, 2013
Jacob Carlborg
Apr 08, 2013
David Nadlinger
Apr 08, 2013
Dicebot
Apr 09, 2013
deadalnix
Apr 09, 2013
Artur Skawina
Apr 09, 2013
Timon Gehr
Apr 09, 2013
kenji hara
Apr 09, 2013
Artur Skawina
Apr 09, 2013
Simen Kjærås
Apr 09, 2013
Timon Gehr
Apr 09, 2013
Artur Skawina
Apr 09, 2013
Tobias Pankrath
Apr 09, 2013
Timon Gehr
Apr 09, 2013
Artur Skawina
Apr 09, 2013
Manu
Apr 09, 2013
Manu
Apr 09, 2013
David Nadlinger
Apr 09, 2013
Timon Gehr
Apr 09, 2013
Manu
Apr 09, 2013
Timon Gehr
Apr 09, 2013
David Nadlinger
Apr 10, 2013
Walter Bright
Apr 11, 2013
deadalnix
Apr 11, 2013
Simen Kjærås
Apr 11, 2013
Jacob Carlborg
Apr 11, 2013
Jacob Carlborg
Apr 11, 2013
Iain Buclaw
Apr 11, 2013
Jacob Carlborg
Apr 11, 2013
John Colvin
Apr 11, 2013
kenji hara
Apr 11, 2013
John Colvin
Apr 11, 2013
deadalnix
Apr 11, 2013
Iain Buclaw
Apr 08, 2013
Iain Buclaw
May 02, 2013
bearophile
April 06, 2013
I remember Walter saying two or more times that the semantics of D offers some optimization opportunities that probably are not yet used to try to reduce the run-time of D programs. Is Walter willing to write down a list of such opportunities? (Ideas from other persons are welcome). Maybe some LDC/GDC developer will make the GCC/LLVM back-ends use them. The implementation of those ideas will require some time, so later it's better to put the list in the D wiki.

Bye,
bearophile
April 08, 2013
On 6 April 2013 12:09, bearophile <bearophileHUGS@lycos.com> wrote:

> I remember Walter saying two or more times that the semantics of D offers some optimization opportunities that probably are not yet used to try to reduce the run-time of D programs. Is Walter willing to write down a list of such opportunities? (Ideas from other persons are welcome). Maybe some LDC/GDC developer will make the GCC/LLVM back-ends use them. The implementation of those ideas will require some time, so later it's better to put the list in the D wiki.
>
> Bye,
> bearophile
>


This information could possibly be helpful.  Though given that most of (gdc) codegen is on par with g++, there's probably not much on the list that isn't already detected by the backend optimisation passes.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


April 08, 2013
On 04/08/2013 10:29 AM, Iain Buclaw wrote:
> On 6 April 2013 12:09, bearophile <bearophileHUGS@lycos.com
> <mailto:bearophileHUGS@lycos.com>> wrote:
>
>     I remember Walter saying two or more times that the semantics of D
>     offers some optimization opportunities that probably are not yet
>     used to try to reduce the run-time of D programs. Is Walter willing
>     to write down a list of such opportunities? (Ideas from other
>     persons are welcome). Maybe some LDC/GDC developer will make the
>     GCC/LLVM back-ends use them. The implementation of those ideas will
>     require some time, so later it's better to put the list in the D wiki.
>
>     Bye,
>     bearophile
>
>
>
> This information could possibly be helpful.  Though given that most of
> (gdc) codegen is on par with g++, there's probably not much on the list
> that isn't already detected by the backend optimisation passes.
>
>
> --
> Iain Buclaw
>
> *(p < e ? p++ : p) = (c & 0x0f) + '0';

Does GDC use the additional type information for optimization? Eg. if something is immutable, then aliasing issues do not have to be considered for it when reading and writing through multiple pointers repeatedly.
April 08, 2013
On 8 April 2013 10:06, Timon Gehr <timon.gehr@gmx.ch> wrote:

> On 04/08/2013 10:29 AM, Iain Buclaw wrote:
>
>> On 6 April 2013 12:09, bearophile <bearophileHUGS@lycos.com <mailto:bearophileHUGS@lycos.**com <bearophileHUGS@lycos.com>>> wrote:
>>
>>     I remember Walter saying two or more times that the semantics of D
>>     offers some optimization opportunities that probably are not yet
>>     used to try to reduce the run-time of D programs. Is Walter willing
>>     to write down a list of such opportunities? (Ideas from other
>>     persons are welcome). Maybe some LDC/GDC developer will make the
>>     GCC/LLVM back-ends use them. The implementation of those ideas will
>>     require some time, so later it's better to put the list in the D wiki.
>>
>>     Bye,
>>     bearophile
>>
>>
>>
>> This information could possibly be helpful.  Though given that most of (gdc) codegen is on par with g++, there's probably not much on the list that isn't already detected by the backend optimisation passes.
>>
>>
>> --
>> Iain Buclaw
>>
>> *(p < e ? p++ : p) = (c & 0x0f) + '0';
>>
>
> Does GDC use the additional type information for optimization? Eg. if something is immutable, then aliasing issues do not have to be considered for it when reading and writing through multiple pointers repeatedly.
>

It uses some type information, eg:

const/immutable/wild  -> qualified const.
shared -> qualified volatile.
shared + const/wild -> qualified const/volatile.


Done nothing in regards to C 'restrict' optimisations.  However the D array .ptr type could also be considered 'restrict' also.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


April 08, 2013
On 8 April 2013 19:41, Iain Buclaw <ibuclaw@ubuntu.com> wrote:

> On 8 April 2013 10:06, Timon Gehr <timon.gehr@gmx.ch> wrote:
>
>> On 04/08/2013 10:29 AM, Iain Buclaw wrote:
>>
>>> On 6 April 2013 12:09, bearophile <bearophileHUGS@lycos.com <mailto:bearophileHUGS@lycos.**com <bearophileHUGS@lycos.com>>> wrote:
>>>
>>>     I remember Walter saying two or more times that the semantics of D
>>>     offers some optimization opportunities that probably are not yet
>>>     used to try to reduce the run-time of D programs. Is Walter willing
>>>     to write down a list of such opportunities? (Ideas from other
>>>     persons are welcome). Maybe some LDC/GDC developer will make the
>>>     GCC/LLVM back-ends use them. The implementation of those ideas will
>>>     require some time, so later it's better to put the list in the D
>>> wiki.
>>>
>>>     Bye,
>>>     bearophile
>>>
>>>
>>>
>>> This information could possibly be helpful.  Though given that most of (gdc) codegen is on par with g++, there's probably not much on the list that isn't already detected by the backend optimisation passes.
>>>
>>>
>>> --
>>> Iain Buclaw
>>>
>>> *(p < e ? p++ : p) = (c & 0x0f) + '0';
>>>
>>
>> Does GDC use the additional type information for optimization? Eg. if something is immutable, then aliasing issues do not have to be considered for it when reading and writing through multiple pointers repeatedly.
>>
>
> It uses some type information, eg:
>
> const/immutable/wild  -> qualified const.
> shared -> qualified volatile.
> shared + const/wild -> qualified const/volatile.
>
>
> Done nothing in regards to C 'restrict' optimisations.  However the D array .ptr type could also be considered 'restrict' also.
>

Yes, I was just about to bring up __restrict, there is probably good
opportunity for that.
Why do you suppose .ptr is restrict? One problem with D's slicing is it's
very hard to assume __restrict on basically any arrays.
I feel like 'scope' might imply a __restrict input... although the
relationship is kinda backwards, so maybe not...

How about pure? Is GDC able to factor pure function calls with the same arguments outside of loops, or eliminate consecutive calls? It's really tedious to do this by hand, and breaks code continuity. Particularly important in a language that supports properties, since they'll be accessed consecutively all the time.

What about immutable? You said it qualifies const, which in C++ is absolutely meaningless in terms of optimisation potential; just because something is const, the source of the pointer can certainly be non-const somewhere else, which means C++ can't possibly factor const loads outside of loops, and must respect consecutive dereferences of the same pointer. immutable in D should certainly be able to be factored outside loops, so it is more meaningful than const, and actually has real optimisation potential. Can GCC actually express an immutable value?

I remember there was a problem a while back that I brought to you about GDC generating stack frames unnecessarily for leaf functions, is that resolved? I haven't checked in a while.

Does GDC have access to a GDC-specific __restrict attribute to tag stuff manually? I'm struggling to think where it can be automated...


April 08, 2013
On 8 April 2013 20:59, Manu <turkeyman@gmail.com> wrote:

> Does GDC have access to a GDC-specific __restrict attribute to tag stuff manually? I'm struggling to think where it can be automated...
>

I guess immutable is a subset of __restrict.
It should definitely leverage at least 50% of __restrict's value to to mark
immutable stuff as such.


April 08, 2013
On Monday, 8 April 2013 at 09:41:52 UTC, Iain Buclaw wrote:
> It uses some type information, eg:
>
> const/immutable/wild  -> qualified const.
> shared -> qualified volatile.
> shared + const/wild -> qualified const/volatile.
>

const/wild can be muted via aliasing. I'm not sure how GCC's backend understand const, but this seems unclear to me if this is correct.

>
> Done nothing in regards to C 'restrict' optimisations.  However the D array
> .ptr type could also be considered 'restrict' also.

slices can alias each other. Same as above, is that correct ?
April 08, 2013
On 8 April 2013 11:59, Manu <turkeyman@gmail.com> wrote:

> On 8 April 2013 19:41, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
>
>> On 8 April 2013 10:06, Timon Gehr <timon.gehr@gmx.ch> wrote:
>>
>>> On 04/08/2013 10:29 AM, Iain Buclaw wrote:
>>>
>>>> On 6 April 2013 12:09, bearophile <bearophileHUGS@lycos.com <mailto:bearophileHUGS@lycos.**com <bearophileHUGS@lycos.com>>> wrote:
>>>>
>>>>     I remember Walter saying two or more times that the semantics of D
>>>>     offers some optimization opportunities that probably are not yet
>>>>     used to try to reduce the run-time of D programs. Is Walter willing
>>>>     to write down a list of such opportunities? (Ideas from other
>>>>     persons are welcome). Maybe some LDC/GDC developer will make the
>>>>     GCC/LLVM back-ends use them. The implementation of those ideas will
>>>>     require some time, so later it's better to put the list in the D
>>>> wiki.
>>>>
>>>>     Bye,
>>>>     bearophile
>>>>
>>>>
>>>>
>>>> This information could possibly be helpful.  Though given that most of (gdc) codegen is on par with g++, there's probably not much on the list that isn't already detected by the backend optimisation passes.
>>>>
>>>>
>>>> --
>>>> Iain Buclaw
>>>>
>>>> *(p < e ? p++ : p) = (c & 0x0f) + '0';
>>>>
>>>
>>> Does GDC use the additional type information for optimization? Eg. if something is immutable, then aliasing issues do not have to be considered for it when reading and writing through multiple pointers repeatedly.
>>>
>>
>> It uses some type information, eg:
>>
>> const/immutable/wild  -> qualified const.
>> shared -> qualified volatile.
>> shared + const/wild -> qualified const/volatile.
>>
>>
>> Done nothing in regards to C 'restrict' optimisations.  However the D array .ptr type could also be considered 'restrict' also.
>>
>
> Yes, I was just about to bring up __restrict, there is probably good
> opportunity for that.
> Why do you suppose .ptr is restrict? One problem with D's slicing is it's
> very hard to assume __restrict on basically any arrays.
> I feel like 'scope' might imply a __restrict input... although the
> relationship is kinda backwards, so maybe not...
>
>
At least, many array operations, eg:  a[] += b[].  Require the arrays not to be overlapping, so could do some optimisations based around that knowledge.



> How about pure? Is GDC able to factor pure function calls with the same arguments outside of loops, or eliminate consecutive calls? It's really tedious to do this by hand, and breaks code continuity. Particularly important in a language that supports properties, since they'll be accessed consecutively all the time.
>
>
Only builtins are pure in the sense of 'C'.  Even functions considered PUREstrong by the frontend may update an internal state, so the rules just don't apply.  Except for maybe global functions...   In any case, the only benefit you can reap from 'D pure' functions are that they are more likely to be const-folded / inlined.



> What about immutable? You said it qualifies const, which in C++ is absolutely meaningless in terms of optimisation potential; just because something is const, the source of the pointer can certainly be non-const somewhere else, which means C++ can't possibly factor const loads outside of loops, and must respect consecutive dereferences of the same pointer. immutable in D should certainly be able to be factored outside loops, so it is more meaningful than const, and actually has real optimisation potential. Can GCC actually express an immutable value?
>
>
Other than saying that the type is const-qualified, the decl is set read-only, which only means to the backend that 'this decl may not be the lhs of an assignment.'


> I remember there was a problem a while back that I brought to you about GDC generating stack frames unnecessarily for leaf functions, is that resolved? I haven't checked in a while.
>
>
It probably is if you re referring to the thread I'm thinking of.

Does GDC have access to a GDC-specific __restrict attribute to tag stuff
> manually? I'm struggling to think where it can be automated...
>

Nope, but that can be added in using our new attribute syntax. :~)


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


April 08, 2013
On 8 April 2013 12:41, deadalnix <deadalnix@gmail.com> wrote:

> On Monday, 8 April 2013 at 09:41:52 UTC, Iain Buclaw wrote:
>
>> It uses some type information, eg:
>>
>> const/immutable/wild  -> qualified const.
>> shared -> qualified volatile.
>> shared + const/wild -> qualified const/volatile.
>>
>>
> const/wild can be muted via aliasing. I'm not sure how GCC's backend understand const, but this seems unclear to me if this is correct.
>
>
GCC's backend is pretty much C/C++ semantics.  So the const qualifier is shallow, and does not guarantee that no mutations will occur.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


April 08, 2013
On 2013-04-08 10:29, Iain Buclaw wrote:

> This information could possibly be helpful.  Though given that most of
> (gdc) codegen is on par with g++, there's probably not much on the list
> that isn't already detected by the backend optimisation passes.

Multiple calls to pure functions could be cached.

-- 
/Jacob Carlborg
« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11