Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
75f5ee9
Scaffolding and Setup for HTML-Generation
Hyalunar Dec 15, 2025
90b7e4e
Add the htmlDir Parameter to Record creation
Hyalunar Dec 15, 2025
cf9a88e
SourceRange Parser, Event Splitting
Hyalunar Dec 16, 2025
254babb
Enforce invariants in SourceRanges
Hyalunar Dec 16, 2025
bccfe03
Improve Variable Naming
Hyalunar Dec 16, 2025
8f843fd
Refactor the Provenance Parsing
Hyalunar Dec 16, 2025
b0e48ba
Load all source files
Hyalunar Dec 16, 2025
b99adb8
Group Summaries By File, Don't distribute event time
Hyalunar Dec 17, 2025
8954373
WIP: Find all Overlapping Ranges
Hyalunar Dec 17, 2025
a6a96ec
Simplified Range overlap check
Hyalunar Dec 28, 2025
90c5606
WIP: SourceRange merging
Hyalunar Dec 28, 2025
9f864f6
Handling of the first two cases
Hyalunar Dec 29, 2025
9b6d8e0
Simplification of `mergeRanges`
Hyalunar Dec 30, 2025
78edfef
Filter Empty SourceRanges after merging
Hyalunar Dec 30, 2025
45d06f7
Finish `summarizeAndSplitByFile`
Hyalunar Dec 30, 2025
76be8f4
Fix `sourceRangeOverlapsWith` to respect exclusiveness
Hyalunar Dec 30, 2025
38a724f
Start: HTML-File-Generation
Hyalunar Dec 30, 2025
e908946
Refactor SourceRange into a Single Module
Hyalunar Jan 1, 2026
21c1ba2
Break out `EventSummary` to avoid circular imports
Hyalunar Jan 1, 2026
88f1da9
I forgot to run the formatter
Hyalunar Jan 1, 2026
f34f913
Split out headHtml and relativise for futher usage
Hyalunar Jan 1, 2026
d098fc3
Write out the empty html files
Hyalunar Jan 1, 2026
9b6f070
Prettify the file paths
Hyalunar Jan 1, 2026
15459d7
Generate HTML with Spans for Cost-Centres
Hyalunar Jan 1, 2026
1359e6f
Simple Source Highlighting
Hyalunar Jan 1, 2026
46870eb
Normalize CRLF and CR newlines
Hyalunar Jan 1, 2026
b0eeb23
Add hover information
Hyalunar Jan 1, 2026
87639c5
Embed CSS file, add anchors
Hyalunar Jan 1, 2026
2f82eba
Prepare Anchors for Details
Hyalunar Jan 1, 2026
dcf27ee
Display Detail Tables for Source Ranges
Hyalunar Jan 1, 2026
97049e4
Extract html generation from file writing
Hyalunar Jan 1, 2026
488a0e1
Cost Centre Listing at `cost-centres.html`
Hyalunar Jan 2, 2026
ae4b8b3
Prepare Code Cleanup and Organisation
Hyalunar Jan 3, 2026
c948ab0
Rewrite `ccOverview` to new data structures
Hyalunar Jan 3, 2026
94df9e0
Rewrite `heatmapHtml` to new details structure
Hyalunar Jan 3, 2026
4ef8553
Type Aliases
Hyalunar Jan 4, 2026
40b28e0
Code Rewrite To Organized Data Structures
Hyalunar Jan 4, 2026
e5174be
Formatting and Hyperlinking
Hyalunar Jan 4, 2026
3710ae7
Fixed the inverted heatmap colors
Hyalunar Jan 4, 2026
579b57b
Fix build.
athas Jan 5, 2026
52f75a4
Browser-Readable Profiling Information
Hyalunar Jan 5, 2026
3903cf9
document the newly generated files
Hyalunar Jan 5, 2026
35c57ff
improve the `Files produced` docs
Hyalunar Jan 5, 2026
59b9b5c
Remove redudant import; removes the warning, fixes CI
Hyalunar Jan 6, 2026
06ce1f7
Don't use relative paths to write files
Hyalunar Jan 6, 2026
33296be
Add futhark-profile/style.css to extra-source-files.
athas Jan 6, 2026
f432a80
Style fix.
athas Jan 6, 2026
1704c12
Create the Directory even if there are no source files
Hyalunar Jan 6, 2026
9eab85d
Unify CSS.
athas Jan 6, 2026
4359b06
Style fix.
athas Jan 6, 2026
b3b373c
Fix to the `Map.!` issue, unformatted and untested
Hyalunar Jan 6, 2026
05e69a2
Postponed formatting
Hyalunar Jan 6, 2026
a17a40a
Document `foo-index.html` to be in the toplevel-directory
Hyalunar Jan 6, 2026
c3a2f5b
Style fix.
athas Jan 6, 2026
9c544d9
Merge branch 'master' into profile-html-heatmap
athas Jan 6, 2026
b46d496
Scaffolding for HTML Index file
Hyalunar Jan 6, 2026
438db43
Correctly Link the Css File
Hyalunar Jan 6, 2026
de1f6c1
Index File With Explanations
Hyalunar Jan 6, 2026
d02583e
Fix Heatmap Title and apply hlint functor law
Hyalunar Jan 6, 2026
f94d33f
Remove a trailing whitespace
Hyalunar Jan 6, 2026
0b03fd6
Changelog: HTML-Generation in `futhark profile`
Hyalunar Jan 6, 2026
928bceb
Final `ormolu` formatting
Hyalunar Jan 6, 2026
fc6595b
Augment manpage slightly more.
athas Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

* Per Cost-Centre Source Location Listings in the `.summary`-file output of `futhark profile`. (By VegOwOtenks)
* `futhark profile`: Generation of HTML-Files with cost centre and source range
analysis, heatmap markup according to source range cost.
(#2340, With VegOwOtenks)

* Per Cost-Centre Source Location Listings in the `.summary`-file output of
`futhark profile`. (By VegOwOtenks)

### Removed

Expand Down
35 changes: 23 additions & 12 deletions docs/man/futhark-profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ futhark profile JSONFILES
DESCRIPTION
===========

This tool produces human-readable profiling information based on information
collected with :ref:`futhark bench<futhark-bench(1)>`. Futhark has basic support
for profiling. The system can collect information about the run-time behaviour
This tool produces human- and browser-readable profiling information based on
information collected with :ref:`futhark bench<futhark-bench(1)>`.
Futhark has basic support for profiling.
The system can collect information about the run-time behaviour
of the program, and connects it as best it is able to the program source code.
This works best for the GPU backends, and not at all for the sequential
backends. The collected information can then be used to estimate the source of
Expand All @@ -32,22 +33,25 @@ collected profiling information. If you neglect to pass ``--profile``,
the profiling information will be missing. The information in the JSON
file is complete, but it is difficult for humans to read.

The next step is to run ``futhark profile`` on the JSON file. For a
JSON file ``prog.json``, this will create a *top level directory*
``prog.prof`` that contains files with human-readable profiling
information. A set of files will be created for each benchmark
dataset. If the original invocation of ``futhark bench`` included
multiple programs, then ``futhark profile`` will create subdirectories
for each program (although all inside the same top level directory).
The next step is to run ``futhark profile`` on the JSON file. For a JSON file
``prog.json``, this will create a *top level directory* ``prog.prof`` that
contains files with human-readable profiling information. A set of files will be
created for each benchmark dataset. If the original invocation of ``futhark
bench`` included multiple programs, then ``futhark profile`` will create
subdirectories for each program (although all inside the same top level
directory). If the source files passed to ``futhark bench`` are accessible via
the original paths, then the directory will also contain HTML files with
annotated source code.

You can pass multiple JSON files to ``futhark profile``. Each will
produce a distinct top level directory.

Files produced
--------------

Supposing a dataset ``foo``, ``futhark profile`` will produce the
following files in the top level directory.
Supposing a dataset ``foo`` for an entry point in ``source-file.fut``.
``futhark profile`` will produce the following files and directories in the top
level directory.

* ``foo.log``: the running log produced during execution. Contains many details
on dynamic behaviour, depending on the exact backend.
Expand All @@ -59,9 +63,16 @@ following files in the top level directory.
which they occurred, along with their runtime and other available information,
most importantly the source locations.

* ``foo-index.html``: overview file and guide to the other html files.
Contains explanations for the concepts, links to other pages.
This is the entry file for profile exploration.

The log file is often too verbose to be useful, but the summary and timeline
should be inspected, even if the latter is sometimes fairly large.

All the other files require a web browser but may provide easier access
to the timing data, since the source resolution and parsing is done already.

Technicalities
--------------

Expand Down
7 changes: 6 additions & 1 deletion futhark.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extra-source-files:
rts/c/util.h
rts/c/server.h
rts/cuda/prelude.cu
rts/futhark-doc/style.css
rts/style.css
rts/javascript/server.js
rts/javascript/values.js
rts/javascript/wrapperclasses.js
Expand Down Expand Up @@ -380,6 +380,10 @@ library
Futhark.Pkg.Solve
Futhark.Pkg.Types
Futhark.Profile
Futhark.Profile.Details
Futhark.Profile.EventSummary
Futhark.Profile.Html
Futhark.Profile.SourceRange
Futhark.Script
Futhark.Test
Futhark.Test.Spec
Expand All @@ -392,6 +396,7 @@ library
Futhark.Util
Futhark.Util.CMath
Futhark.Util.IntegralExp
Futhark.Util.Html
Futhark.Util.Loc
Futhark.Util.Log
Futhark.Util.Options
Expand Down
16 changes: 16 additions & 0 deletions rts/futhark-doc/style.css → rts/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,19 @@ main {
color: #5f0220;
text-decoration: none;
}

a.silent-anchor {
text-decoration: inherit;
color: inherit;
}

table, th, td {
border: 1px solid black;
border-collapse: collapse;
}

th, td {
padding-left: 0.5em;
padding-right: 0.5em;
text-align: center;
}
2 changes: 1 addition & 1 deletion src/Futhark/CLI/Doc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import System.IO
import Text.Blaze.Html.Renderer.Text

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

data DocConfig = DocConfig
{ docOutput :: Maybe FilePath,
Expand Down
Loading