Ball Larus Path Profiling with Branch Predictor Optimization#19
Open
SamyakSinghania wants to merge 7 commits into
Open
Ball Larus Path Profiling with Branch Predictor Optimization#19SamyakSinghania wants to merge 7 commits into
SamyakSinghania wants to merge 7 commits into
Conversation
Collaborator
|
@SamyakSinghania Please provide a detailed explanation for atleast one of the testcase, what do these files contain and how profiling is being done? |
Author
@lahiri-phdworks Sir I have added detailed explanation for the outputs of the first 2 testcases along with images. I have also added detailed description of which files are generated and the kind of information it contains. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template for Feature Additions.
Brief description feature
The path profiling is being done as discussed in the Ball Larus Path Profiling paper.
This involves:
The static branch predictor is build by indexing the predictor table with the (path id, program counter)
On running any program, the control flow graph is generated in the file
control_flow_graph.pngusing which we can track down the paths shown in the filepath_profile_data.txtWe have added two new flags in our project:
-bl– for generating Ball-Larus path profiling data.-bl_op– for generating Ball-Larus path profiling data with branch predictor optimization.Example
Running Ball-Larus Path Profiling Only
To generate only the Ball-Larus path profiling data, use the command:
Running Ball-Larus Path Profiling with Branch Predictor Optimization
To generate profiling data along with branch prediction optimization:
The directory
path_profiling_testscontains testcases including if-else, loops, nested loops, and other control flow constructs. These tests can be used for the-blflag.The
inputs.txtfile contains the input parameters for the program, and these parameters can be generated using thegenerate_inputs.pyscript.The directory
path_profiling_op_testscontains testcases for the-bl_opflag.On running:
The following output is generated:
**File: **
path_profile_data.txtExplanation:From the code and the cfg, we can clearly verify that the path profile generated for the execution is indeed correct.Since,
:var1 = 15and:var2 = 30, the pathSTART->4->5->8->10->ENDis taken. The path profile data is generated based on the execution of the program.On running:
The following output is generated:
**File: **
predictor_accuracy.txt**File: **
path_profile_data.txtExplanation:The values of x,y,z,p were randomly generated based on which a specific path will be taken in the double diamond CFG. These inputs are present in the file./BallLarus/inputs.txt. Based on the path profile and execution of branch instructions of the training inputs, a static branch predictor was learned which gives the predictions for the branch instructions of the test inputs. The accuracy of the predictor is also shown in the filepredictor_accuracy.txt. The accuracy is calculated based on the number of correct predictions made by the predictor.On running:
The following output is generated:
**File: **
path_profile_data.txtOn running:
The following output is generated:
**File: **
path_profile_data.txtOn running:
The following output is generated:
**File: **
predictor_accuracy.txt**File: **
path_profile_data.txtOn running:
The following output is generated:
**File: **
predictor_accuracy.txt**File: **
path_profile_data.txtOn running:
The following output is generated:
**File: **
predictor_accuracy.txt**File: **
path_profile_data.txtWhy is the feature interesting?
Give use cases for the feature.
Other Details
The source code lies in the directory
BallLarus. The main implementation of the algorithm is in the file:This directory also includes a dedicated interpreter for Ball-Larus, derived from the pre-existing interpreter for better modularity.
The file generate_inputs.py in ChironCore/BallLarus/ can be used to generate multiple input flags for usage of -bl_op flag.
The following files are generated upon running the profiling:
hash_dump.txtContains the path indexes along with their frequencies.
path_profile_data.txtContains the actual path profile data along with their frequencies.
predictions_pc.txtContains the program counter (PC) values and corresponding branch predictor predictions.
predictor_accuracy.txtContains the final accuracy of the branch predictor based on the profiling data.