Thread overview | ||||||
---|---|---|---|---|---|---|
|
December 14, 2016 CTFE-PGO ... Because I was bored | ||||
---|---|---|---|---|
| ||||
Hi Guys, Implementing and TESTING function-call support is boring so ... I have just written a little piece of code that counts which switch-cases are executed most frequently versus how often their conditions are evaluated. This can essentially be the basis for pgo based on the ctfe-function path. Since functions are supposed to be the same at ctfe and at runtime, you basically get profiling information for free while compiling. Cheers, Stefan |
December 14, 2016 Re: CTFE-PGO ... Because I was bored | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Wednesday, 14 December 2016 at 05:07:17 UTC, Stefan Koch wrote: > Hi Guys, > > Implementing and TESTING function-call support is boring so ... > > I have just written a little piece of code that counts which switch-cases are executed most frequently versus how often their conditions are evaluated. > > This can essentially be the basis for pgo based on the ctfe-function path. > Since functions are supposed to be the same at ctfe and at runtime, you basically get profiling information for free while compiling. > > Cheers, > Stefan https://github.com/UplinkCoder/dmd/compare/newCTFE...newCTFE-PGO This is the code that was necessary to add execution counters. I'd say it does speak for the soundness of the design :) |
December 14, 2016 Re: CTFE-PGO ... Because I was bored | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Wednesday, 14 December 2016 at 05:07:17 UTC, Stefan Koch wrote:
> I have just written a little piece of code that counts which switch-cases are executed most frequently versus how often their conditions are evaluated.
>
> This can essentially be the basis for pgo based on the ctfe-function path. Since functions are supposed to be the same at ctfe and at runtime, you basically get profiling information for free while compiling.
Aside from just counting the results, is this going to possibly affect compilation/code generation to get speed/size optimization?
|
December 14, 2016 Re: CTFE-PGO ... Because I was bored | ||||
---|---|---|---|---|
| ||||
Posted in reply to Era Scarecrow | On Wednesday, 14 December 2016 at 06:00:08 UTC, Era Scarecrow wrote:
> Aside from just counting the results, is this going to possibly affect compilation/code generation to get speed/size optimization?
Well Yes.
That is the plan at least :)
CTFE could stream it's branch-counts directly into the optimizer.
I am not in the position to say how tricky it would be to provide this information to the backend, but I guess it will take a bit of fiddling.
|
Copyright © 1999-2021 by the D Language Foundation