spo600:2024_fall_project
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spo600:2024_fall_project [2024/10/31 15:48] – chris | spo600:2024_fall_project [2024/12/08 03:35] (current) – chris | ||
---|---|---|---|
Line 41: | Line 41: | ||
Note: you do __not__ have to produce a full bootstrap build. | Note: you do __not__ have to produce a full bootstrap build. | ||
- | 1a. Become familiar with producing and reviewing dumps produced during the compilation passes (see the '' | + | 1a. Become familiar with producing and reviewing dumps produced during the compilation passes (see the '' |
2. < | 2. < | ||
Line 108: | Line 108: | ||
==== Due Date ==== | ==== Due Date ==== | ||
- | * Stage 1 is due with the second batch of blog posts on November 2, 2024. | + | * Stage 1 is due with the second batch of blog posts on November |
+ | |||
+ | |||
+ | ===== Project Stage 2: Clone-Pruning Analysis Pass ===== | ||
+ | |||
+ | Create a pass for the GCC compiler which analyzes the program being compiled and: | ||
+ | - Identifies one or more functions which have been cloned; | ||
+ | - Examines the cloned functions to determine if they are substantially the same or different; | ||
+ | - Emits a message in the GCC diagnostic dump for the pass that indicates if the functions should be pruned (in the case that they' | ||
+ | |||
+ | It is recommended that you proceed in steps: | ||
+ | * Create a basic dummy pass with a diagnostic dump | ||
+ | * Add logic to iterate through the code in the program being compiled | ||
+ | * Add the logic to find the cloned function(s) | ||
+ | * Add the locic to compare the gimple representation of the funtion(s) | ||
+ | * Add the code to output a decision on whether the functions should or should not be pruned | ||
+ | |||
+ | To limit complexity, you may make these assumptions: | ||
+ | * There is only one cloned function in a program | ||
+ | * There are only two versions (clones) of that function (ignoring the function resolver) | ||
+ | |||
+ | It is important that you position your compiler pass __late__ in the compilation/ | ||
+ | |||
+ | Note that the gimple code for two identical functions may have slight variations. For example, the names of temporary variables will probably be different (because they are sequentially numbered), and generated labels in the code will probably be different (for the same reason). However, these variations by themselves should not be considered to make the function clones different. | ||
+ | |||
+ | Two possible approaches to this problem are (1) to iterate through the statements in each function, comparing them statement-by-statement; | ||
+ | |||
+ | Please use these specific strings in your dump file: | ||
+ | * '' | ||
+ | * '' | ||
+ | Where //name of base function// is the original name of the function that should (or should not) be pruned. | ||
+ | |||
+ | Your solution should build and execute successfully on both x86_64 and aarch64 systems, and should take into account the differences between the FMV implementations on those two architectures (for example, the munging algorithm used to create the suffixes for the cloned functions is different). | ||
+ | |||
+ | ==== Demo Files for Creating a GCC Pass ==== | ||
+ | |||
+ | Each of the [[SPO600 Servers]] has two files ''/ | ||
+ | |||
+ | These files are all from the '' | ||
+ | * passes.def - One line has been added: '' | ||
+ | * tree-pass.h - One line has been added: '' | ||
+ | * tree-ctyler.cc - The actual pass code, loosly modelled on '' | ||
+ | * Makefile.in - One line has been added to the OBJS definition: '' | ||
+ | |||
+ | Building GCC with these changes will result in a compiler that can output an additional dump, which can be triggered with '' | ||
+ | |||
+ | ==== Test Cases for Pruning/ | ||
+ | |||
+ | Each of the [[SPO600 Servers]] has a file ''/ | ||
+ | |||
+ | Refer to the README.txt file within the tgz file for more detail. | ||
+ | |||
+ | ==== Recommendations for Building GCC in Stage 2 ==== | ||
+ | |||
+ | A reminder that the '' | ||
+ | |||
+ | This can effectively cut the build time for a complex project like GCC from hours to minutes. On my development system (a Ryzen 7735HS with 32 GB RAM), a null rebuild (no source changes - make is checking that everything is up-to-date) takes about 8.3 seconds, and a rebuild with edits to one pass source file take 23-30 seconds. On the [[SPO600 Servers]] the rebuild times are similar. | ||
+ | |||
+ | To take advantage of this capability, do an initial full build of GCC in a separate build directory as usual, then make whatever required edits to the source code in the source directory. Run '' | ||
+ | |||
+ | Remember to use [[Screen Tutorial|screen]] (or a similar program such as tmux) when building on remote systems in case your network connection gets interrupted, | ||
+ | |||
+ | You can do your development work on either architecture, | ||
+ | |||
+ | ==== Submitting your Project Stage 2 ==== | ||
+ | |||
+ | Blog your results: | ||
+ | * Include detailed results for the items above. Be specific and conclusive in your reporting, and include detail such as build options and build time, specific files and directories identified as you learned to navigate the code, and the specific code used in your experimentation. | ||
+ | * Clearly identify the capabilities and limitations of your code. | ||
+ | * Enable replication of your results. For example, you could provide links to specific content in a Git repository of your experiments. Avoid presenting code as screenshots whenever possible, because screenshots are not searchable, indexable, testable, nor accessible. | ||
+ | * Add your reflections on the experience - what you learned, what you found interesting, | ||
+ | * I recommend that you blog about your work in multiple sections - blog as you go rather than waiting and writing one massive blog post at the end of each stage. | ||
+ | |||
+ | ==== Due Date ==== | ||
+ | |||
+ | * Stage 2 is due with the third batch of blog posts on December < | ||
+ | |||
+ | ===== Project Stage 3: Tidy & Wrap ===== | ||
+ | |||
+ | Bring your work to a solid conclusion. Take into account feedback received for Stage 2 and provide any documentation that is missing, incomplete, or unclear, as well as easily-testable code clearly showing your work. | ||
+ | * Tidy up any loose ends from your Stage 2 work. If you have an incomplete experiment or investigation that you can complete, include it in your Stage 3. | ||
+ | * Provide the source code for the latest version of your project in a form which permits another person to examine, build, and test the changes which you have made. This can be done in any of several different ways (in decreasing order of preference): | ||
+ | * Provide a public git repository from which your code can be pulled. This should be a clone of a base repository with your changes applied as one or more commits. Clearly document how to access this repository, and which branch(es) and commit(s) are of interest. | ||
+ | * Or, provide a set of patch files containing your changes. The easiest way to generate this is with the 'git format-patch' | ||
+ | * Alternatively, | ||
+ | * Test the access to your code (make sure that someone who is not you can access the source). | ||
+ | * Clearly show the state of your work: what you attempted to do, what works and what does not, and what the output (e.g., dump files) look like and how that output should be interpreted. | ||
+ | * Test your code with the [[#Test Cases for Pruning/ | ||
+ | * Describe the problems you encountered while writing your code and how you addressed those problems. | ||
+ | * Describe the next steps that could/ | ||
+ | * Write up your specific reflections on the project, if there are updates since Stage 2. | ||
+ | |||
+ | **Important note:** some students __did not__ demonstrate that they wrote any code for Stage 2. In order to successfully complete stage 3, you must show that you made some reasonable effort towand the goal of implementing a // | ||
+ | |||
+ | ==== Due Date ==== | ||
+ | |||
+ | * Stage 3 is due with the third batch of blog posts on December 11, 2024 (11:59 pm). | ||
spo600/2024_fall_project.1730389709.txt.gz · Last modified: 2024/10/31 15:48 by chris