Skip to content

Conversation

@Hyalunar
Copy link
Contributor

@Hyalunar Hyalunar commented Dec 15, 2025

closes #2339

Separate event summarisation from `tabulateEvents`
@Hyalunar
Copy link
Contributor Author

Problems I'm currently thinking about:

  • Is it okay to fail in the middle of HTML-Generation?
  • How much parsing should I do beforehand?
  • Should I verify (and load?) all source files before even starting HTML generation? This may take a lot of memory, but it may also serve as a check so that the command won't fail in-between if there's a source file missing.

@athas
Copy link
Member

athas commented Dec 15, 2025

Is it okay to fail in the middle of HTML-Generation?

Ideally, in case of failure no output is produced. I think it is reasonable to produce all results in memory and only write them to disk at the end.

How much parsing should I do beforehand?

Parse all profiling data. I do not think there is reason to parse Futhark source at all. For highlighting, all you need is the source spans, which refer to byte offsets within the file.

Should I verify (and load?) all source files before even starting HTML generation?

Yes, and I do not think this will take up much memory. Futhark programs are small.

@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 1, 2026

Commit d098fc3 introduces a failure condition where an I/O-Error might abort the writing of the HTML-Files.
I don't think this is likely and I decided not to handle it because I would have to retry or delete all previously written files.

@athas
Copy link
Member

athas commented Jan 1, 2026

That's reasonable. You build all the files up front and then write them at the end, so I/O errors outside of our control is the only thing that can go wrong.

@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 1, 2026

This is an example site generated by futhark profile
image
Main.fut.html

It does not have any information beyond the color embeddings right now.

What I'm currently considering:

  • Explore HTML popover-api for links to cost centres
  • display information on hover

I opened the page locally in lynx and it erases all the colors entirely.

@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 6, 2026

I can't figure out what's wrong with the embedStringFile in Profile.hs, it hardly differs from the similar usage in Doc.hs.

cssFile :: T.Text
cssFile = $(embedStringFile "rts/futhark-profile/style.css")
cssFile :: T.Text
cssFile = $(embedStringFile "rts/futhark-doc/style.css")

I also have neither a windows nor a mac machine to reproduce and debug :(

@athas
Copy link
Member

athas commented Jan 6, 2026

I fixed some cosmetic things and unified the CSS files. Remember to also update the CHANGELOG with a mention, including whatever name you wish to be credited under.

@athas
Copy link
Member

athas commented Jan 6, 2026

Right now, this LocVolCalib.json (with no tricky relative paths) fail to be processed with futhark profile:

$ futhark profile LocVolCalib.json
Writing results to LocVolCalib.prof/
Stripping 'LocVolCalib.fut' from program paths.
Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
Map.!: given key is not an element in the map
CallStack (from HasCallStack):
  error, called at libraries/containers/containers/src/Data/Map/Internal.hs:622:17 in containers-0.7-6de3:Data.Map.Internal

@athas
Copy link
Member

athas commented Jan 6, 2026

Other (very simple) JSON files work, so I'm not quite sure what is going wrong.

@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 6, 2026

Oh yes, I already fixed it locally, sorry. It's related to the change I'm making because of the paths issue.

I'm currently waiting for ormolu to compile because I'm at my desktop PC now. (Where I can run the GPU Benchmarks for testing purposes)

@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 6, 2026

I am on 579b57b. I am using this JSON file: https://sigkill.dk/junk/LocVolCalib.json

After doing futhark profile LocVolCalib.json, I then open LocVolCalib.prof/futhark-benchmarks/finpar/LocVolCalib.fut.html (https://sigkill.dk/junk/LocVolCalib.prof/futhark-benchmarks/finpar/LocVolCalib.fut.html) and click on the link for main.gpuseq_26401, which doesn't work.

This is fixed from b3b373c onwards :) (works on my machine)

@athas
Copy link
Member

athas commented Jan 6, 2026

Works on mine as well. This actually looks pretty promising. It takes some work to understand the results for complicated programs, but that is inherent to the problem - it is quite difficult to relate source ranges to cost centres for such an aggressively optimising compiler, but the foundation here is strong (and doing much better will require compiler engineering).

@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 6, 2026

Thank you very much for you sustained assistance and help! I am done for today :]

@athas
Copy link
Member

athas commented Jan 7, 2026

When CI works, I am liable to just merge this and start getting some experience with it.

@athas athas merged commit 80a863e into diku-dk:master Jan 7, 2026
@Hyalunar Hyalunar deleted the profile-html-heatmap branch January 7, 2026 10:30
@Hyalunar
Copy link
Contributor Author

Hyalunar commented Jan 7, 2026

🥳

There are still a lot of queued checks from this branch, you might want to cancel them.

E.g. right now the check for 9eab85d is running the pyopencl tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose HTML-Formatted Profiling Heatmaps in futhark profile

2 participants