Jump to page: 1 222  
Page
Thread overview
Battle-plan for CTFE
May 09, 2016
Stefan Koch
May 09, 2016
Rory McGuire
May 09, 2016
David Nadlinger
May 09, 2016
Stefan Koch
May 10, 2016
Nordlöw
May 09, 2016
Walter Bright
May 09, 2016
Stefan Koch
May 09, 2016
Jonathan M Davis
May 09, 2016
Andrej Mitrovic
May 10, 2016
Walter Bright
May 10, 2016
H. S. Teoh
Jul 07, 2016
Stefan Koch
Jul 07, 2016
Stefan Koch
Jul 08, 2016
Stefan Koch
Jul 08, 2016
Rene Zwanenburg
Jul 08, 2016
Stefan Koch
Jul 09, 2016
ketmar
Jul 09, 2016
ketmar
May 10, 2016
Jacob Carlborg
May 10, 2016
Rory McGuire
May 10, 2016
Stefan Koch
May 16, 2016
jmh530
May 15, 2016
Martin Nowak
May 15, 2016
Martin Nowak
May 15, 2016
Martin Nowak
May 15, 2016
Stefan Koch
May 15, 2016
Daniel Murphy
May 15, 2016
Martin Nowak
May 15, 2016
Daniel Murphy
May 15, 2016
Martin Nowak
May 15, 2016
Daniel Murphy
May 15, 2016
Martin Nowak
May 16, 2016
Kagamin
May 16, 2016
Martin Nowak
May 16, 2016
Martin Nowak
May 16, 2016
safety0ff
May 16, 2016
Daniel Murphy
May 17, 2016
Don Clugston
May 17, 2016
Stefan Koch
May 17, 2016
Martin Nowak
May 18, 2016
Daniel Murphy
May 18, 2016
Stefan Koch
May 19, 2016
Daniel Murphy
May 21, 2016
Martin Nowak
May 21, 2016
Martin Nowak
May 21, 2016
Martin Nowak
May 27, 2016
Stefan Koch
May 15, 2016
Daniel Murphy
May 15, 2016
Martin Nowak
May 15, 2016
Stefan Koch
May 16, 2016
Martin Nowak
May 16, 2016
Martin Nowak
May 15, 2016
Stefan Koch
May 15, 2016
Martin Nowak
May 17, 2016
deadalnix
May 11, 2016
maik klein
May 13, 2016
Jonathan M Davis
May 13, 2016
Don Clugston
May 13, 2016
Timon Gehr
May 13, 2016
Stefan Koch
May 15, 2016
Martin Nowak
May 15, 2016
Martin Nowak
May 27, 2016
Stefan Koch
May 28, 2016
Stefan Koch
May 29, 2016
Taylor Hillegeist
Jun 03, 2016
Stefan Koch
Jun 08, 2016
Stefan Koch
Jun 30, 2016
Stefan Koch
Jun 30, 2016
Martin Nowak
Jun 30, 2016
Stefan Koch
Jun 30, 2016
Nordlöw
Jun 30, 2016
Stefan Koch
Jun 30, 2016
Martin Nowak
Jun 30, 2016
Timon Gehr
Jun 30, 2016
Stefan Koch
Jul 04, 2016
Stefan Koch
Jul 04, 2016
ZombineDev
Jul 04, 2016
ZombineDev
Jul 04, 2016
Stefan Koch
Jul 05, 2016
ketmar
Jul 05, 2016
deadalnix
Jul 06, 2016
ZombineDev
Jul 05, 2016
ketmar
Jul 05, 2016
H. S. Teoh
Jul 05, 2016
ketmar
Jul 06, 2016
Rory McGuire
Jul 06, 2016
ketmar
Jul 06, 2016
Rory McGuire
Jul 06, 2016
ketmar
Jul 06, 2016
ketmar
Jul 07, 2016
ketmar
Jul 07, 2016
ketmar
Jul 09, 2016
Stefan Koch
Jul 14, 2016
Stefan Koch
Jul 15, 2016
Stefan Koch
Jul 17, 2016
Stefan Koch
Jul 17, 2016
Rory McGuire
Jul 17, 2016
Stefan Koch
Jul 17, 2016
Rory McGuire
Jul 17, 2016
Stefan Koch
Jul 17, 2016
Rory McGuire
Jul 17, 2016
Stefan Koch
Jul 17, 2016
Rory McGuire
Jul 19, 2016
Stefan Koch
Jul 29, 2016
Stefan Koch
Jul 29, 2016
Stefan Koch
Jul 29, 2016
Stefan Koch
Jul 31, 2016
Stefan Koch
Aug 06, 2016
Stefan Koch
Aug 06, 2016
Rory McGuire
Aug 06, 2016
Stefan Koch
Aug 07, 2016
Stefan Koch
Aug 08, 2016
Johan Engelen
Aug 08, 2016
Stefan Koch
Aug 09, 2016
Kagamin
Aug 09, 2016
Stefan Koch
Aug 11, 2016
Stefan Koch
Aug 14, 2016
Stefan Koch
Aug 14, 2016
Rory McGuire
Aug 17, 2016
Stefan Koch
Aug 17, 2016
Rory McGuire
Aug 17, 2016
Stefan Koch
Aug 29, 2016
Stefan Koch
Aug 29, 2016
Rory McGuire
Aug 29, 2016
Stefan Koch
Aug 30, 2016
Jacob Carlborg
Aug 30, 2016
Johannes Pfau
Aug 30, 2016
Stefan Koch
Aug 30, 2016
Rory McGuire
Aug 30, 2016
Johannes Pfau
Aug 30, 2016
Johannes Pfau
Aug 30, 2016
deadalnix
Aug 30, 2016
Stefan Koch
Aug 30, 2016
tsbockman
Aug 31, 2016
Stefan Koch
Sep 01, 2016
Rory McGuire
Sep 01, 2016
Stefan Koch
Sep 01, 2016
Rory McGuire
Sep 01, 2016
David Nadlinger
Sep 01, 2016
Rory McGuire
Sep 01, 2016
David Nadlinger
Sep 01, 2016
Rory McGuire
Sep 01, 2016
David Nadlinger
Sep 01, 2016
Rory McGuire
Sep 01, 2016
David Nadlinger
Sep 01, 2016
ag0aep6g
Sep 01, 2016
Rory McGuire
Sep 01, 2016
ag0aep6g
Sep 05, 2016
Stefan Koch
Sep 05, 2016
Rory McGuire
Sep 05, 2016
Stefan Koch
Sep 08, 2016
Stefan Koch
Sep 08, 2016
Stefan Koch
Sep 08, 2016
Rory McGuire
Sep 08, 2016
Stefan Koch
Sep 08, 2016
Stefan Koch
Sep 19, 2016
Stefan Koch
Sep 19, 2016
Lurker
Sep 19, 2016
Stefan Koch
Sep 20, 2016
Nordlöw
Sep 25, 2016
Stefan Koch
Sep 25, 2016
Rory McGuire
Sep 25, 2016
Stefan Koch
Oct 05, 2016
Rory McGuire
Oct 16, 2016
Uplink_Coder
Oct 16, 2016
Dmitry Olshansky
Oct 16, 2016
Uplink_Coder
Oct 17, 2016
Uplink_Coder
Oct 17, 2016
Uplink_Coder
Oct 17, 2016
Nordlöw
Oct 24, 2016
Stefam Koch
Oct 24, 2016
Stefam Koch
Oct 24, 2016
Rory McGuire
Oct 25, 2016
Stefam Koch
Oct 25, 2016
Stefam Koch
Oct 25, 2016
Wyatt
Oct 25, 2016
Stefam Koch
Oct 25, 2016
Jacob Carlborg
Oct 26, 2016
Stefam Koch
Oct 26, 2016
Andrea Fontana
Oct 26, 2016
Stefan Koch
Oct 26, 2016
Stefam Koch
Oct 26, 2016
Kagamin
Oct 26, 2016
Stefam Koch
Oct 26, 2016
MakersF
Oct 26, 2016
Stefam Koch
Oct 28, 2016
Stefan Koch
Oct 30, 2016
Stefan Koch
Oct 30, 2016
Stefan Koch
Oct 30, 2016
Stefan Koch
Oct 31, 2016
Dicebot
Oct 19, 2016
Nordlöw
Oct 19, 2016
Stefan Koch
Oct 19, 2016
Rory McGuire
Sep 01, 2016
Stefan Koch
Sep 01, 2016
David Nadlinger
Sep 01, 2016
Stefan Koch
Sep 01, 2016
H. S. Teoh
Sep 01, 2016
David Nadlinger
Aug 29, 2016
Nordlöw
Aug 07, 2016
Martin Nowak
Jul 29, 2016
Edwin van Leeuwen
Jul 29, 2016
Stefan Koch
May 09, 2016
Hi Guys,

I have been looking into the DMD now to see what I can do about CTFE.
Unfortunately It is a pretty big mess to untangle.
Code responsible for CTFE is in at least 3 files.
[dinterpret.d, ctfeexpr.d, constfold.d]
I was shocked to discover that the PowExpression actually depends on phobos! (depending on the exact codePath it may or may not compile...)
which let to me prematurely stating that it worked at ctfe [http://forum.dlang.org/thread/ukcoibejffinknrbzktv@forum.dlang.org]

My Plan is as follows.

Add a new file for my ctfe-interpreter and update it gradually to take more and more of the cases the code in the files mentioned above was used for.

Do Dataflow analysis on the code that is to be ctfe'd so we can tell beforehand if we need to store state in the ctfe stack or not.

Or baring proper data-flow analysis: RefCouting the variables on the ctfe-stack could also be a solution.

I will post more details as soon as I dive deeper into the code.


May 09, 2016
On 09 May 2016 19:01, "Stefan Koch via Digitalmars-d-announce" < digitalmars-d-announce@puremagic.com> wrote:
>
> Hi Guys,
>
> I have been looking into the DMD now to see what I can do about CTFE.
> Unfortunately It is a pretty big mess to untangle.
> Code responsible for CTFE is in at least 3 files.
> [dinterpret.d, ctfeexpr.d, constfold.d]
> I was shocked to discover that the PowExpression actually depends on
phobos! (depending on the exact codePath it may or may not compile...)
> which let to me prematurely stating that it worked at ctfe [
http://forum.dlang.org/thread/ukcoibejffinknrbzktv@forum.dlang.org]
>
> My Plan is as follows.
>
> Add a new file for my ctfe-interpreter and update it gradually to take
more and more of the cases the code in the files mentioned above was used for.
>
> Do Dataflow analysis on the code that is to be ctfe'd so we can tell
beforehand if we need to store state in the ctfe stack or not.
>
> Or baring proper data-flow analysis: RefCouting the variables on the
ctfe-stack could also be a solution.
>
> I will post more details as soon as I dive deeper into the code.
>
>

Will be awesome. Particularly if you document the workings of ctfe, might make a great set of articles for a blog.


May 09, 2016
Hi Stefan,

On Monday, 9 May 2016 at 16:57:39 UTC, Stefan Koch wrote:
> My Plan is as follows.

I think you guys talked about it at the conference, but be sure to coordinate with Timon Gehr. You'll want to steal all the best ideas from the various implementations anyway. ;)

> Do Dataflow analysis on the code that is to be ctfe'd so we can tell beforehand if we need to store state in the ctfe stack or not.
>
> Or baring proper data-flow analysis: RefCouting the variables on the ctfe-stack could also be a solution.

I presume by "store state" you mean persisting objects beyond the bounds of a single CTFE invocation? My first inclination here would simply be to make all allocations from a new arena each time CTFE is entered (can also re-use memory from prior runs for that), do a deep-copy of the result (converting it to full AST nodes, etc.), and then drop the entire arena. But probably you have thought of (and discarded) this already.

 — David
May 09, 2016
awesome news :-) thanks you
May 09, 2016
On Monday, 9 May 2016 at 18:19:53 UTC, David Nadlinger wrote:
> Hi Stefan,
>
> On Monday, 9 May 2016 at 16:57:39 UTC, Stefan Koch wrote:
>> My Plan is as follows.
>
> I think you guys talked about it at the conference, but be sure to coordinate with Timon Gehr. You'll want to steal all the best ideas from the various implementations anyway. ;)
>
>> Do Dataflow analysis on the code that is to be ctfe'd so we can tell beforehand if we need to store state in the ctfe stack or not.
>>
>> Or baring proper data-flow analysis: RefCouting the variables on the ctfe-stack could also be a solution.
>
> I presume by "store state" you mean persisting objects beyond the bounds of a single CTFE invocation? My first inclination here would simply be to make all allocations from a new arena each time CTFE is entered (can also re-use memory from prior runs for that), do a deep-copy of the result (converting it to full AST nodes, etc.), and then drop the entire arena. But probably you have thought of (and discarded) this already.
>
>  — David

The current implementation stores persistent state for every ctfe incovation.
While caching nothing. Not even the compiled for of a function body.
Because it cannot relax purity.
Which is why a simple while-loop from 0 to 100_000_00 can crash dmd if executed at ctfe.

Your advice is a good one. I am happy to discuss with others!
There is no need to duplicate mental workload.
May 09, 2016
On 5/9/2016 9:57 AM, Stefan Koch wrote:
>[...]

The memory consumption problem, at least, can be resolved by using stack temporaries instead of allocating new nodes. This was already done in constfold.d, but not in the rest of the interpreter.

Doing that will (I predict) also double its speed right there.
May 09, 2016
On 5/9/16, Stefan Koch via Digitalmars-d-announce <digitalmars-d-announce@puremagic.com> wrote:
> I was shocked to discover that the PowExpression actually depends on phobos!

I seem to remember having to implement diagnostics in DMD asking for the user to import std.math. I'm fairly confident it had something to do with power expressions.

Yah, it's a mess. :)
May 09, 2016
On Monday, 9 May 2016 at 20:24:56 UTC, Walter Bright wrote:
> On 5/9/2016 9:57 AM, Stefan Koch wrote:
>>[...]
>
> The memory consumption problem, at least, can be resolved by using stack temporaries instead of allocating new nodes. This was already done in constfold.d, but not in the rest of the interpreter.
>
> Doing that will (I predict) also double its speed right there.

Thanks, your advice is most helpful and a good first stop-gap.

Still the current state of CTFE is almost not maintainable
 and I would really prefer a clean-slate approach.

SDC benefits extremely from the extra level of indirection, however I do understand that SDC and DMD have diffrent goals regarding compile-speed.

Also I feel that good code has found it's most beautiful shape when it's simplicity makes it inevitable, at least the Ctfe-Mechanism has not reached this point yet, imo.


May 09, 2016
On Monday, May 09, 2016 13:24:56 Walter Bright via Digitalmars-d-announce wrote:
> On 5/9/2016 9:57 AM, Stefan Koch wrote:
> >[...]
>
> The memory consumption problem, at least, can be resolved by using stack temporaries instead of allocating new nodes. This was already done in constfold.d, but not in the rest of the interpreter.
>
> Doing that will (I predict) also double its speed right there.

Previously, Don stated that he thought that simply making it so that CTFE didn't allocate a new integer every time it mutated it would be a _huge_ speed-up by itself (which presumably is what you're talking about with regards to allocating new nodes). Unfortunately, he got too busy to actually do that work and no one else stepped in to do. But if Stefan is going to step up and improve CTFE, that's fantastic. It's one of D's best features, but it's also one of its most problematic. Fixng that would be huge.

- Jonathan M Davis

May 09, 2016
On 5/9/2016 2:32 PM, Andrej Mitrovic via Digitalmars-d-announce wrote:
> On 5/9/16, Stefan Koch via Digitalmars-d-announce
> <digitalmars-d-announce@puremagic.com> wrote:
>> I was shocked to discover that the PowExpression actually depends
>> on phobos!
>
> I seem to remember having to implement diagnostics in DMD asking for
> the user to import std.math. I'm fairly confident it had something to
> do with power expressions.
>
> Yah, it's a mess. :)
>

The pow stuff should just be done in dmd without reference to the library.
« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11