Skip to content

Commit 6f44669

Browse files
committed
Undo changes to the existing LP. #2
1 parent e37c1ac commit 6f44669

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

content/learning-paths/servers-and-cloud-computing/cpp-profile-guided-optimisation/how-to-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout: learningpathall
88

99
### What is Profile-Guided Optimization (PGO) and how does it work?
1010

11-
Profile-Guided Optimization (PGO) is a compiler optimization technique that enhances program performance by utilizing real-world execution data. In GCC/G++, PGO typically involves a two-step process:
11+
Profile-Guided Optimization (PGO) is a compiler optimization technique that enhances program performance by utilizing real-world execution data. In GCC/G++, PGO involves a two-step process:
1212

1313
- First, compile the program with the `-fprofile-generate` flag to produce an instrumented binary that collects profiling data during execution;
1414
- Second, recompile the program with the `-fprofile-use` flag, allowing the compiler to leverage the collected data to make informed optimization decisions. This approach identifies frequently executed paths — known as “hot” paths — and optimizes them more aggressively, while potentially reducing emphasis on less critical code paths.

content/learning-paths/servers-and-cloud-computing/cpp-profile-guided-optimisation/how-to-3.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In this section, you'll learn how to use Google Benchmark and Profile-Guided Opt
1212

1313
Integer division is ideal for benchmarking because it's significantly more expensive than operations like addition, subtraction, or multiplication. On most CPU architectures, including Arm, division instructions have higher latency and lower throughput compared to other arithmetic operations. By applying Profile-Guided Optimization to code containing division operations, we can potentially achieve significant performance improvements.
1414

15-
## What tools are needed to run a Google Benchmark example on Linux?
15+
## What tools are needed to run a Google Benchmark example?
1616

1717
For this example, you can use any Arm Linux computer. For example, an AWS EC2 `c7g.xlarge` instance running Ubuntu 24.04 LTS can be used.
1818

@@ -100,4 +100,4 @@ sudo perf report --input=perf-division-base
100100

101101
As the `perf report` graphic below shows, the program spends a significant amount of time in the short loops with no loop unrolling. There is also an expensive `sdiv` operation, and most of the execution time is spent storing the result of the operation.
102102

103-
![before-pgo](./before-pgo.gif)
103+
![before-pgo](./before-pgo.gif)

content/learning-paths/servers-and-cloud-computing/cpp-profile-guided-optimisation/how-to-4.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ Next, run the instrumented binary to generate the profile data:
2222

2323
This execution creates profile data files (typically with a `.gcda` extension) in the same directory.
2424

25-
### Compile and run the optimized binary
26-
2725
Now recompile the program using the `-fprofile-use` flag to apply optimizations based on the collected data:
2826

2927
```bash

content/learning-paths/servers-and-cloud-computing/cpp-profile-guided-optimisation/how-to-5.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ jobs:
115115
echo "==================== With Profile-Guided Optimization ===================="
116116
./div_bench.opt
117117
echo "==================== Benchmarking complete ===================="
118+
````
118119

119-
120-
To use this workflow, save the YAML content into a file named `pgo_benchmark.yml` (or any other `.yml` name) inside the `.github/workflows/` directory of your GitHub repository. Ensure your `div_bench.cpp` file is present in the repository root. When you push changes to the `main` branch, GitHub Actions will automatically detect this workflow file and execute the defined steps on an Arm-based runner, compiling both versions of the benchmark and running them.
120+
To use this workflow, save the YAML content into a file named `pgo_benchmark.yml` (or any other `.yml` name) inside the `.github/workflows/` directory of your GitHub repository. Ensure your `div_bench.cpp` file is present in the repository root. When you push changes to the `main` branch, GitHub Actions will automatically detect this workflow file and execute the defined steps on an Arm-based runner, compiling both versions of the benchmark and running them.

0 commit comments

Comments
 (0)