futhark icon indicating copy to clipboard operation
futhark copied to clipboard

Listing of source locations for cost centres in `profile.summary`

Open Hyalunar opened this issue 3 weeks ago • 5 comments

closes #2337

Hyalunar avatar Dec 10 '25 21:12 Hyalunar

Adds source information output to the file profile.summary. The source section is separated with a header, the start looks like this: image entire file: summary.txt

This increases the size of summary file by a lot. In my example, using this program I wrote for Advent of Code Day 09, which is 80 lines in length. This patch increased the size of the summary file by more than a factor of two!

Hyalunar avatar Dec 10 '25 21:12 Hyalunar

Please consider the above implementation a proposal. I would be happy to discuss and/or experiment with different formats before settling on anything, if anyone has different ideas of what it should look like.

By the way, how do I use ormolu? It seems to produce something that resembles a git patch format. But I am failing to apply it correctly, so far.

Hyalunar avatar Dec 10 '25 21:12 Hyalunar

ormolu -i FILE reformats the given file in place. See also STYLE.md for how to automatically run the formatter on all source files.

athas avatar Dec 10 '25 21:12 athas

This looks pretty promising, although it's too late in the day for me to read code. I'm OK with making the summary file larger, but we could also put the location information in a different file. What do you think would be best?

athas avatar Dec 10 '25 21:12 athas

This looks pretty promising, although it's too late in the day for me to read code. I'm OK with making the summary file larger, but we could also put the location information in a different file. What do you think would be best?

I would prefer having it in the same file, but I might try again with some of your benchmarks, something bigger. Sharing the file would help manual inspection a lot. In my workflow, I simply search for the word under my cursor after identifying an interesting name and it jumps to the next occurence, which is the source listing.

Hyalunar avatar Dec 10 '25 22:12 Hyalunar

Do not worry about the failing tests; they are the GPU cluster being flaky.

I agree with keeping everything in the same summary file for now. Long-term, I hope we can include much more information per cost centre (grid size etc), and then we might even want a file per cost centre, but that is not meaningful today.

athas avatar Dec 11 '25 07:12 athas

I hadn't even noticed that your example is for the multicore backend. Cool that it works too.

athas avatar Dec 11 '25 08:12 athas

I hadn't even noticed that your example is for the multicore backend. Cool that it works too.

Very cool that futhark supports so many targets. Multicore is the only one I can (currently) run that produces profiling information.

Hyalunar avatar Dec 11 '25 09:12 Hyalunar

Final thing, could you add an entry to the CHANGELOG under Added? Feel free to credit yourself under whatever name you prefer.

athas avatar Dec 11 '25 10:12 athas