From 5ebdf1991566a2873d044cb2bd8ccbf643c67296 Mon Sep 17 00:00:00 2001 From: Matthias Veigel Date: Tue, 22 Jul 2025 15:20:41 +0200 Subject: [PATCH] Added presentation --- .gitea/workflows/pdf.yaml | 7 +- .vscode/settings.json | 1 + fancyuulm.typ | 282 ++++++++++++++++++++++++++++++++++++++ logos/sp.svg | 227 ++++++++++++++++++++++++++++++ logos/uulm.svg | 177 ++++++++++++++++++++++++ presentation.typ | 202 +++++++++++++++++++++++++++ 6 files changed, 893 insertions(+), 3 deletions(-) create mode 100644 fancyuulm.typ create mode 100644 logos/sp.svg create mode 100644 logos/uulm.svg create mode 100644 presentation.typ diff --git a/.gitea/workflows/pdf.yaml b/.gitea/workflows/pdf.yaml index c9cb767..13fe979 100644 --- a/.gitea/workflows/pdf.yaml +++ b/.gitea/workflows/pdf.yaml @@ -8,10 +8,11 @@ jobs: container: archlinux:latest steps: - - run: pacman -Sy --noconfirm nodejs git typst fontconfig ttf-linux-libertine ttf-inconsolata + - run: pacman -Sy --noconfirm nodejs git typst fontconfig ttf-linux-libertine ttf-inconsolata ttf-fira-code ttf-fira-sans - uses: actions/checkout@v3 - run: typst c main.typ + - run: typst c presentation.typ - uses: actions/upload-artifact@v3 with: - name: main.pdf - path: main.pdf + name: pdfs + path: *.pdf diff --git a/.vscode/settings.json b/.vscode/settings.json index 387ca7a..621724e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,7 @@ "Regionalized", "RVSDG", "subexpression", + "Veigel", "Verilog", "VHDL", "Xplore" diff --git a/fancyuulm.typ b/fancyuulm.typ new file mode 100644 index 0000000..bfc7f05 --- /dev/null +++ b/fancyuulm.typ @@ -0,0 +1,282 @@ +// This theme is adapted from https://github.com/touying-typ/touying/blob/main/themes/simple.typ by OrangeX4 + +#import "@preview/touying:0.6.1": * + +/// Default slide function for the presentation. +/// +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// +/// - repeat (int, auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. +/// +//// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. +/// +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. +/// +/// - composer (function): The composer of the slide. You can use it to set the layout of the slide. +/// +/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. +/// +/// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function. +/// +/// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns. +/// +/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` will make the `Footer` cell take 2 columns. +/// +/// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. +/// +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +#let slide( + config: (:), + repeat: auto, + setting: body => body, + composer: auto, + ..bodies, +) = touying-slide-wrapper(self => { + let header(self) = utils.call-or-display(self, self.store.header) + let footer(self) = { + text(size: 0.5em, fill: self.colors.neutral-lightest, grid( + align: (left + horizon, center + horizon, right + horizon), + fill: self.colors.secondary, + columns: (1fr, 4.5fr, 1fr), + // gutter: 0em, + // stroke: (x: self.colors.secondary + 0.5em), + rows: 100%, + box(inset: (left: self.page.margin.x / 2), utils.call-or-display(self, self.store.footer-left)), + utils.call-or-display(self, self.store.footer), + box(fill: self.colors.primary, height: 100%, inset: (x: self.page.margin.x / 2), align(center, utils.call-or-display(self, self.store.footer-right))), + ) + ) + } + let self = utils.merge-dicts( + self, + config-page( + header: header, + footer: footer, + ), + config-common(subslide-preamble: self.store.subslide-preamble), + ) + touying-slide(self: self, config: config, repeat: repeat, setting: setting, composer: composer, ..bodies) +}) + + +/// Centered slide for the presentation. +/// +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For several configurations, you can use `utils.merge-dicts` to merge them. +#let centered-slide(config: (:), ..args) = touying-slide-wrapper(self => { + touying-slide(self: self, ..args.named(), config: config, align(center + horizon, args.pos().sum(default: none))) +}) + + +/// Title slide for the presentation. +/// +/// Example: `#title-slide(title-image: "assets/title-image.png")` +/// +/// - content (content | none): The content of the title slide, typically an image. The content will be displayed centered above the title and subtitle. +/// +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For several configurations, you can use `utils.merge-dicts` to merge them. +#let title-slide(content, config: (:), ..args) = touying-slide-wrapper(self => { + let body = { + set block(spacing: 0em) + // show text: it => align(right + horizon, it) + set text(fill: self.colors.neutral-lightest) + + block( + inset: (x: self.page.margin.x * 2/3, y: 0.5cm), + width: 100%, + height: 1fr, + content + ) + block( + fill: self.colors.primary, + width: 100%, + height: 2.2cm, + inset: (x: self.page.margin.x * 2/3), + align(right + horizon, text(size: 1.4em, weight: "bold", self.info.title)) + ) + let secondary-info = (self.info.subtitle, self.info.author, self.info.date.display("[month repr:long] [day], [year]")).filter(it => it != none).join(" | ") + block( + fill: self.colors.secondary, + width: 100%, + height: 1.1cm, + inset: (x: self.page.margin.x * 2/3), + align(right + horizon, text(size: 0.9em, secondary-info)) + ) + block( + width: 100%, + height: 2.2cm, + inset: (x: self.page.margin.x * 2/3, y: 0.35cm), + box(image(self.info.institute-logo, height: 1fr)) + h(1fr) + box(image(self.info.university-logo, height: 1fr)) + ) + } + let self = utils.merge-dicts( + self, + config-common(freeze-slide-counter: true), + config-page(margin: 0em) + ) + touying-slide(self: self, ..args.named(), config: config, body) +}) + + +/// New section slide for the presentation. You can update it by updating the `new-section-slide-fn` argument for `config-common` function. +/// +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +#let new-section-slide(config: (:), body) = centered-slide(config: config, [ + #text(1.2em, weight: "bold", utils.display-current-heading(level: 1)) + + #body +]) + + +/// Focus on some content. +/// +/// Example: `#focus-slide[Wake up!]` +/// +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// +/// - background (color, auto): The background color of the slide. Default is `auto`, which means the primary color of the slides. +/// +/// - foreground (color): The foreground color of the slide. Default is `white`. +#let focus-slide(config: (:), background: auto, foreground: white, body) = touying-slide-wrapper(self => { + self = utils.merge-dicts( + self, + config-common(freeze-slide-counter: true), + config-page(fill: if background == auto { + self.colors.primary + } else { + background + }), + ) + set text(fill: foreground, size: 1.5em) + touying-slide(self: self, config: config, align(center + horizon, body)) +}) + +/// Fancy Ulm University theme (Institute of Software Engineering and Programming Languages). +/// +/// Example: +/// +/// ```typst +/// #show: fancyuulm.with(aspect-ratio: "16-9", config-colors(primary: blue))` +/// ``` +/// +/// The default colors: +/// +/// ```typst +/// config-colors( +/// neutral-light: gray, +/// neutral-lightest: rgb("#ffffff"), +/// neutral-darkest: rgb("#000000"), +/// primary: rgb("#A32638"), +/// secondary: rgb("#A9A28D"), +/// ) +/// ``` +/// +/// - aspect-ratio (string): The aspect ratio of the slides. Default is `16-9`. +/// +/// - header (function): The header of the slides. Default is `self => utils.display-current-heading(setting: utils.fit-to-width.with(grow: false, 100%), depth: self.slide-level)`. +/// +/// - footer-left (function): The left part of the footer. Default is `self => self.info.author`. +/// +/// - footer (function): The footer of the slides. Default is `self => self.info.title`. +/// +/// - footer-right (content): The right part of the footer. Default is `context utils.slide-counter.display()`. +/// +/// - primary (color): The primary color of the slides. Default is `rgb("#A32638")`. +/// +/// - secondary (color): The secondary color of the slides. Default is `rgb("#A9A28D")`. +/// +/// - subslide-preamble (content): The preamble of the subslides. Default is `block(below: 1.5em, text(1.2em, weight: "bold", utils.display-current-heading(level: 2)))`. +/// +/// - include-new-section-slides (bool): Whether to include slides for introducing new sections. Default is `false`. +#let fancyuulm( + aspect-ratio: "16-9", + header: self => [],//utils.display-current-heading( + // setting: utils.fit-to-width.with(grow: false, 100%), + // level: 1, + // depth: self.slide-level, + // ), + footer-left: self => self.info.author, + footer: self => [#self.info.title -- #self.info.subtitle -- #utils.display-current-heading(level: 1)], + footer-right: context utils.slide-counter.display(), + primary: rgb("#A32638"), + secondary: rgb("#A9A28D"), + subslide-preamble: block( + below: 1.3cm, + text(1.5em, weight: "bold", utils.display-current-heading(level: 2)), + ), + include-new-section-slides: false, + ..args, + body, +) = { + show: touying-slides.with( + config-page( + paper: "presentation-" + aspect-ratio, + margin: (x: 2cm, top: 1.5cm, bottom: 2cm), + footer-descent: 1.2cm, + ), + config-common( + slide-fn: slide, + new-section-slide-fn: if include-new-section-slides { new-section-slide }, + zero-margin-header: false, + zero-margin-footer: true, + ), + config-methods( + init: (self: none, body) => { + set text(size: 18pt, number-width: "tabular", font: "Fira Sans") + show raw: set text(font: "Fira Code") + show math.equation: set text(font: "Noto Sans Math") + set par(spacing: 1cm) + + set footnote.entry(indent: 0cm, clearance: 0.3cm) + show footnote.entry: set text(size: 8pt) + show footnote.entry: set cite(form: "full") + show footnote.entry: box.with(width: 62.5%) + + // set list(spacing: 1cm) + // show list: it => { + // show list: set list(spacing: 0.75cm) + // it + // } + + // show raw.where(block: false): box + // show raw.where(block: false): set box( + // fill: self.colors.neutral-lighter, + // inset: (x: 5pt, y: 0pt), + // outset: (y: 5pt), + // radius: 3pt, + // ) + + // set table(inset: 9pt, stroke: (0.5pt + self.colors.neutral-light)) + // show table: table => { + // show raw.where(block: false): set box( + // fill: none, + // inset: (x: 1pt), + // outset: 0pt + // ) + // table + // } + + body + }, + alert: utils.alert-with-primary-color, + ), + config-colors( + neutral-light: luma(200), + neutral-lighter: luma(250), + neutral-lightest: rgb("#ffffff"), + neutral-darkest: rgb("#000000"), + primary: primary, + secondary: secondary, + ), + // Save the variables for later use + config-store( + header: header, + footer-left: footer-left, + footer: footer, + footer-right: footer-right, + subslide-preamble: subslide-preamble, + ), + ..args, + ) + + body +} \ No newline at end of file diff --git a/logos/sp.svg b/logos/sp.svg new file mode 100644 index 0000000..3383def --- /dev/null +++ b/logos/sp.svg @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/logos/uulm.svg b/logos/uulm.svg new file mode 100644 index 0000000..68b7619 --- /dev/null +++ b/logos/uulm.svg @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/presentation.typ b/presentation.typ new file mode 100644 index 0000000..07221c6 --- /dev/null +++ b/presentation.typ @@ -0,0 +1,202 @@ +// cSpell:ignore fancyuulm uulm +#import "fancyuulm.typ": fancyuulm, slide, centered-slide, title-slide, config-info, pause +#import "@preview/codly:1.3.0": codly-init, codly + +#show: codly-init.with() +#codly(zebra-fill: none, display-icon: false, display-name: false, stroke: none, radius: 0mm, inset: 0.3em) + +#show: fancyuulm.with( + config-info( + title: [Dataflow Analysis for Compiler Optimization], + subtitle: [Institute of Software Engineering and Programming Languages], + author: [Matthias Veigel], + date: datetime(year: 2025, month: 7, day: 23), + institution: [University Ulm], + institute-logo: "logos/sp.svg", + university-logo: "logos/uulm.svg" + ) +) + +#show figure.caption: it => { v(5mm); it.body } + +#title-slide[ + Dataflow Analysis for Compiler Optimization +] +// Hi +// Will talk about the background, method, results + += Background +#slide[ + #set list(spacing: 1.5em) + - Looks how data flows through the program during execution + - Either performed forward or backward + - Forward looks how data is used by later execution + - Backward looks what data is still used at a point + - Performed either on source or immediate representation + - Used for optimizations, warnings, correctness analysis +] +#v(0mm, weak: true) +#figure( // ssa_form_example + caption: [C code and respective control flow graph in SSA form, adapted from Fig. 1 in the work of Reissmann, Meyer and Soffa], + kind: "raw", + supplement: "", + grid( + columns: (1fr, 1.25fr), + ```C + int x = 2 * 2 + 4; + x = x - 2; + if (x < 4) + x = 10; + else + x = 12; + int y = x * 2; + ```, + image("ssa-example.svg", height: 16em) + ) +) +// what is it +// where is it used +// works based on what +// LLVM +// Talk about how used in JIT + += Methodology +- RQ1 -- What are the advantages and disadvantages of using dataflow analysis for compiler optimization? +#pause +- RQ2 -- How is dataflow analysis used in current compilers? +#pause +#v(1em) +- Total inspected publications: 571 +- Publications included: 15 +- Publications ranging from 1973 to 2024 +- Use a multitude of languages, $1/3$ use LLVM IR +- Most focused research areas: + - Algorithms and techniques + - Analysis speed improvement + - Custom IR for analysis + += Analysis performance +#slide[ + #set list(spacing: 1.25em) + - Except for JIT, DFA is done at compile-time + - Parallelization approaches include: per SSA-node, per function + - SSA clusterization approach for avoiding overhead + - Pipelining function analysis as other approach + #pause + #figure( + caption: [Example function for pipelining analysis, taken from fig. 4 of the work by Shi and Zhang], + kind: "raw", + supplement: "", + ```C + int* foo() { + int* p = bar(null); + int* q = p; + int* r = q; + return r; + } + ``` + ) +] +// research done, some things possible +// most still sequentially dependent -> not much speedup + + += Optimizations +#slide[ + - Constant folding and propagation + - `int a = 1; int b = a + 2;` #h(1em) #sym.arrow #h(1em) `int a = 1; int b = 3;` + #pause + - Copy propagation + - `int a; int b = a; int c = b + 1;` #h(1em) #sym.arrow #h(1em) `int a; int c = a + 1;` + #pause + - Conditional/Dead branch elimination + - ` if (false) {...} int a = 4; if (a > 10) {...}` #h(1em) #sym.arrow #h(1em) `int a = 4;` + #pause + - Common subexpression elimination + - `int b = (a + 2) * (a + 2);` #h(1em) #sym.arrow #h(1em) `int temp = a + 2; int b = temp * temp;` + #pause + - Dead code elimination + - `return; int a = 10;` #h(1em) #sym.arrow #h(1em) `return;` +] +#v(0mm, weak: true) +#figure( + caption: [Example of how RVSDG looks, taken from Fig. 1 of the work by Reissmann, Meyer, Bahmann and Själander], + grid( + columns: (1.35fr, 1fr, 1fr), + column-gutter: 0.5em, + [ + #set text(size: 15pt) + #codly(inset: 0.165em) + ```C + int f(int a, int b, int c, int d) { + int li1, li2; + int cse, epr; + do { + li1 = b+c; + li2 = d-b; + a = a*li1; + int down = a%c; + int dead = a+d; + if (a > d) { + int acopy = a; + a = 3+down; + cse = acopy< cse); + return li2+epr; + } + ``` + #align(center, text(size: 8.25pt, "(a) Code")) + ], + image("rvsdg_3_uir.svg", height: 85%), + image("rvsdg_4_oir.svg", height: 85%), + + ) +) + += Problems with DFA +// global vars +// pointers +// multithreaded +- Global variables + - Analysis of every function depends on it + - Adds complex connections between functions +#pause +- Pointer + - Points-to analysis +#pause +- Multithreaded applications + - Requires well synchronized code + - Can be handled by build graph of possible concurrent accesses + + += Conclusion +#slide[ + - RQ1 -- What are the advantages and disadvantages of using dataflow analysis for compiler optimization? +] +#slide[ + - RQ1 -- What are the advantages and disadvantages of using dataflow analysis for compiler optimization? + - Trades compilation performance for runtime performance + - Allows complex optimization across branch and function boundaries + - Allows writing generic code, which will then be optimized based on the usage in an application +] +#slide[ + - RQ1 -- What are the advantages and disadvantages of using dataflow analysis for compiler optimization? + - Trades compilation performance for runtime performance + - Allows complex optimization across branch and function boundaries + - Allows writing generic code, which will then be optimized based on the usage in an application + - RQ2 -- How is dataflow analysis used in current compilers? +] +#slide[ + - RQ1 -- What are the advantages and disadvantages of using dataflow analysis for compiler optimization? + - Trades compilation performance for runtime performance + - Allows complex optimization across branch and function boundaries + - Allows writing generic code, which will then be optimized based on the usage in an application + - RQ2 -- How is dataflow analysis used in current compilers? + - Already extensively used by popular compilers + - Many different optimizations implemented, some listed previously + - Still working on improving speed and optimization possibilities +]