├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .gitignore ├── .gitmodules ├── .pre-commit-config.yaml ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── docker ├── Dockerfile ├── README.md └── docker-compose.yaml ├── elfie-refs ├── cactuBSSN-s.1_1_globalr2 │ ├── cactuBSSN-s.1_1_globalr2.sim.elfie │ └── cactuBSSN-s.1_1_globalr2.txt └── elfie.py └── materials ├── complete ├── hello-world.py ├── simpoints-checkpoint.py ├── simpoints-restore.py ├── traffic-generator-hbm2stack.py ├── traffic-generator.py └── x86-full-system.py ├── hello-world.py ├── looppoints ├── create-looppoint-checkpoints.py ├── refs │ ├── looppoint-pinpoints.csv │ ├── looppoint.json │ ├── region-1-checkpoint │ │ ├── board.physmem.store0.pmem │ │ └── m5.cpt │ ├── region-2-checkpoint │ │ ├── board.physmem.store0.pmem │ │ └── m5.cpt │ └── region-3-checkpoint │ │ ├── board.physmem.store0.pmem │ │ └── m5.cpt └── restore-looppoint-checkpoint.py ├── obtain-resources.py ├── simpoints-checkpoint.py ├── simpoints-restore.py ├── traffic-generator.py └── x86-full-system.py /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gcr.io/gem5-test/hpca-23-gem5-build:latest as source 2 | 3 | FROM gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest 4 | 5 | RUN apt -y update && apt -y install git 6 | 7 | COPY --from=source /gem5/build/ALL/gem5.fast /usr/local/bin/gem5 8 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "hostRequirements": { 3 | "cpus": 4, 4 | "memory": "8gb", 5 | "storage": "32gb" 6 | }, 7 | "build": { "dockerfile": "Dockerfile" }, 8 | "postCreateCommand" : [ 9 | "git", "submodule", "update", "--init", "--recursive" 10 | ], 11 | "extensions": [ 12 | "ms-vscode.cpptools", 13 | "streetsidesoftware.code-spell-checker", 14 | "eamodio.gitlens", 15 | "ms-python.vscode-pylance", 16 | "ms-python.python" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all m5out directories and build directories 2 | **/m5out/ 3 | 4 | # Jekyll stuff 5 | _site/ 6 | .sass-cache/ 7 | Gemfile.lock 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "gem5"] 2 | path = gem5 3 | url = https://gem5.googlesource.com/public/gem5 4 | [submodule "gem5-resources"] 5 | path = gem5-resources 6 | url = https://gem5.googlesource.com/public/gem5-resources 7 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/markdownlint/markdownlint 3 | rev: e31711c0db57df9b350fbaeaae6de745972f3e66 4 | hooks: 5 | - id: markdownlint 6 | args: ["-i", "-r ~MD013,~MD026"] 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.formatting.provider": "black" 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public 379 | licenses. Notwithstanding, Creative Commons may elect to apply one of 380 | its public licenses to material it publishes and in those instances 381 | will be considered the “Licensor.” The text of the Creative Commons 382 | public licenses is dedicated to the public domain under the CC0 Public 383 | Domain Dedication. Except for the limited purpose of indicating that 384 | material is shared under a Creative Commons public license or as 385 | otherwise permitted by the Creative Commons policies published at 386 | creativecommons.org/policies, Creative Commons does not authorize the 387 | use of the trademark "Creative Commons" or any other trademark or logo 388 | of Creative Commons without its prior written consent including, 389 | without limitation, in connection with any unauthorized modifications 390 | to any of its public licenses or any other arrangements, 391 | understandings, or agreements concerning use of licensed material. For 392 | the avoidance of doubt, this paragraph does not form part of the 393 | public licenses. 394 | 395 | Creative Commons may be contacted at creativecommons.org. 396 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Open in Codespaces](https://classroom.github.com/assets/open-in-codespaces-abfff4d4e15f9e1bd8274d9a39a0befe03a0632bb0f153d0ec72ff541cedbe34.svg) 2 | This repository has been designed for use in gem5 tutorials. 3 | It has been built with the assumption users will utilize [Codespaces](https://github.com/features/codespaces) to learn gem5. 4 | 5 | The repository contains the following directories: 6 | 7 | * [docker](docker) : 8 | The source code for the Docker image used by [.devcontainer/Dockerfile](.devcontainer/Dockerfile) to create the Codespace Docker container. 9 | * gem5 : 10 | gem5 checkedout at revision 'cd35c9a6'. 11 | * gem5-resources : 12 | gem5-resources checked out at 'dbac39a'. 13 | 14 | **Note:** 'gem5' and 'gem5-resources' are submodules though the [.devcontainer/devcontainer.json](.devcontainer/devcontainer.json) file specifies that a `git module update --init --recursive` command is executed when the Codespace Docker container is created. 15 | 16 | The container used by Codespaces is built from [.devcontainer/Dockerfile](.devcontainer/Dockerfile). 17 | It contains: 18 | 19 | * All gem5 dependencies (inc. optional dependencies). 20 | * The 'gem5.fast' binary for v22.1 of gem5, compiled for with `scons build/ALL/gem5.fast`.. 21 | This exists in `PATH`, stored in `/usr/local/bin/gem5.fast` 22 | 23 | ## Beginners' example 24 | 25 | The following can be used within the Codespace container to run a basic gem5 simulation straight away: 26 | 27 | ``` 28 | gem5-all gem5/configs/example/gem5_library/arm-hello.py 29 | ``` 30 | 31 | This will execute a "Hello world!" program inside a simulated ARM system. 32 | 33 | ## Updating submodules 34 | 35 | In this project we have two submodules: 'gem5' and 'gem5-resources'. 36 | These are automatically obtained when the codespaces is initialized. 37 | 38 | To update the git submodules to be in-sync with their remote origins (that hosted on our [googlesource](https://gem5.googlesource.com)), execute the following command: 39 | 40 | ```sh 41 | git submodule update --remote 42 | ``` 43 | 44 | This repository may be updated to these in-sync submodules by running the following (this assumes you have correct permissions to do so): 45 | 46 | ```sh 47 | git add gem5 gem5-resources 48 | git commit -m "git submodules updated" 49 | git push 50 | ``` 51 | 52 | ## Best practises 53 | 54 | ### Using branches 55 | 56 | A good strategy when working with gem5 is to use branches. 57 | In the 'gem5' directory, you can use branches to segregate your development. 58 | A typical workflow would be as follows. 59 | 60 | 1. Start from the stable branch. 61 | This will ensure you are starting from a clean, stable version of gem5. 62 | 63 | ```sh 64 | git checkout stable 65 | ``` 66 | 67 | 2. Create another branch to work on. 68 | Initially this branch will be idential to stable but with a name of your choosing. 69 | 70 | ```sh 71 | git branch example-1 # Creating a new branch named 'example-1'. 72 | ``` 73 | 74 | 3. Checkout this branch: 75 | 76 | ```sh 77 | git checkout example-` 78 | ``` 79 | 80 | 4. Make changes on this branch and commit the changes. 81 | For example: 82 | 83 | ```sh 84 | echo "Create a test commit" >test.txt 85 | git add test.txt 86 | git commit -m "misc: Adding a test commit" 87 | ``` 88 | 89 | 5. When done, or wishing to move onto something else, checkout stable. 90 | This effectively reverts the changes made on the branch. 91 | 92 | ```sh 93 | git checkout stable 94 | ``` 95 | 96 | 6. You may return to this branch whenever you want. 97 | 98 | ```sh 99 | git checkout example-1 100 | ``` 101 | 102 | To see a list of all available branches you can execute: 103 | 104 | ```sh 105 | git branch 106 | ``` 107 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest 2 | 3 | RUN apt -y update && apt -y install git 4 | 5 | RUN git clone https://gem5.googlesource.com/public/gem5 /gem5 6 | 7 | WORKDIR /gem5 8 | 9 | RUN git checkout cd35c9a6194451952735f58fb09cb7983e5861ba 10 | 11 | RUN scons -j`nproc` build/ALL/gem5.fast 12 | 13 | 14 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | This directory provides the source for building the gcr.io/gem5-test/hpca-23-gem5-build image. 2 | This is a base image used in ".devcontainer/Dockerfile" to obtain the a compiled version of gem5. 3 | 4 | ## Building 5 | 6 | gcr.io/gem5-test/hpca-23-gem5-build can be built by executing: 7 | 8 | ```sh 9 | docker-compose build hpca-23-gem5-build 10 | ``` 11 | 12 | ## Notes for developers 13 | These images can be pushed with: `docker-compose push`. 14 | Permission must be granted to push to the Google Cloud repository before doing so. 15 | 16 | The Dockerfile tags must be updated accordingly for each release of gem5. 17 | -------------------------------------------------------------------------------- /docker/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | hpca-23-gem5-build: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile 8 | image: gcr.io/gem5-test/hpca-23-gem5-build:latest 9 | 10 | -------------------------------------------------------------------------------- /elfie-refs/cactuBSSN-s.1_1_globalr2/cactuBSSN-s.1_1_globalr2.sim.elfie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gem5-hpca-2023/gem5-tutorial-codespace/d6c9f9fe1869ae2d11a3ec3ba03f96143f4e82be/elfie-refs/cactuBSSN-s.1_1_globalr2/cactuBSSN-s.1_1_globalr2.sim.elfie -------------------------------------------------------------------------------- /elfie-refs/cactuBSSN-s.1_1_globalr2/cactuBSSN-s.1_1_globalr2.txt: -------------------------------------------------------------------------------- 1 | Sim-Start Addr 0x6ffed1 global_addrcount: 1 2 | Sim-End Addr 0x6c830f global_addrcount: 6479283 3 | -------------------------------------------------------------------------------- /elfie-refs/elfie.py: -------------------------------------------------------------------------------- 1 | from gem5.simulate.exit_event import ExitEvent 2 | from gem5.simulate.simulator import Simulator 3 | from gem5.utils.requires import requires 4 | from gem5.components.cachehierarchies.classic.private_l1_private_l2_cache_hierarchy import ( 5 | PrivateL1PrivateL2CacheHierarchy, 6 | ) 7 | from gem5.components.boards.simple_board import SimpleBoard 8 | from gem5.components.memory import DualChannelDDR4_2400 9 | from gem5.components.processors.simple_processor import SimpleProcessor 10 | from gem5.components.processors.cpu_types import CPUTypes 11 | from gem5.isas import ISA 12 | from gem5.resources.resource import BinaryResource 13 | from gem5.resources.elfie import PcCountPair, ELFieInfo 14 | from gem5.resources.workload import CustomWorkload 15 | from m5.stats import reset, dump 16 | 17 | requires(isa_required=ISA.X86) 18 | 19 | 20 | cache_hierarchy = PrivateL1PrivateL2CacheHierarchy( 21 | l1d_size="32kB", 22 | l1i_size="32kB", 23 | l2_size="256kB", 24 | ) 25 | 26 | memory = DualChannelDDR4_2400("1GiB") 27 | 28 | processor = SimpleProcessor( 29 | cpu_type=CPUTypes.TIMING, 30 | isa=ISA.X86, 31 | num_cores=8, 32 | ) 33 | 34 | board = SimpleBoard( 35 | clk_freq="3GHz", 36 | processor=processor, 37 | memory=memory, 38 | cache_hierarchy=cache_hierarchy, 39 | ) 40 | 41 | # workload = CustomWorkload( 42 | # function = "set_se_elfie_workload", 43 | # parameters = { 44 | # "elfie": BinaryResource("cactuBSSN-s.1_1_globalr2/cactuBSSN-s.1_1_globalr2.sim.elfie"), 45 | # "elfie_info": ELFieInfo(PcCountPair(0x6ffed1, 1), PcCountPair(0x6c830f, 6479283)), 46 | # } 47 | # ) 48 | 49 | # board.set_workload(workload) 50 | 51 | board.set_se_elfie_workload( 52 | elfie = BinaryResource("cactuBSSN-s.1_1_globalr2/cactuBSSN-s.1_1_globalr2.sim.elfie"), 53 | elfie_info = ELFieInfo(PcCountPair(0x6ffed1, 1), PcCountPair(0x6c830f, 6479283)) 54 | ) 55 | 56 | # Note: it could be useful to go to the beginning in atomic mode instead of timing 57 | def gen(): 58 | print("Hit beginning of the region.") 59 | reset() 60 | print ("Running the region.") 61 | yield False 62 | dump() 63 | yield True 64 | 65 | simulator = Simulator( 66 | board = board, 67 | on_exit_event={ExitEvent.SIMPOINT_BEGIN: gen()}, 68 | ) 69 | 70 | simulator.run() 71 | -------------------------------------------------------------------------------- /materials/complete/hello-world.py: -------------------------------------------------------------------------------- 1 | from gem5.components.boards.simple_board import SimpleBoard 2 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 3 | from gem5.components.memory import SingleChannelDDR3_1600 4 | from gem5.components.processors.simple_processor import SimpleProcessor 5 | from gem5.components.processors.cpu_types import CPUTypes 6 | from gem5.resources.resource import obtain_resource 7 | from gem5.simulate.simulator import Simulator 8 | from gem5.isas import ISA 9 | 10 | # Obtain the components. 11 | cache_hierarchy = NoCache() 12 | memory = SingleChannelDDR3_1600("1GiB") 13 | processor = SimpleProcessor(cpu_type=CPUTypes.ATOMIC, num_cores=1, isa=ISA.X86) 14 | 15 | # Add them to the board. 16 | board = SimpleBoard( 17 | clk_freq="3GHz", 18 | processor=processor, 19 | memory=memory, 20 | cache_hierarchy=cache_hierarchy, 21 | ) 22 | 23 | # Obtain a binary to run via gem5-resources. 24 | binary = obtain_resource("x86-hello64-static") 25 | board.set_se_binary_workload(binary) 26 | 27 | # Setup the simulator and run the simulation. 28 | simulator = Simulator(board=board) 29 | simulator.run() 30 | -------------------------------------------------------------------------------- /materials/complete/simpoints-checkpoint.py: -------------------------------------------------------------------------------- 1 | from gem5.simulate.exit_event import ExitEvent 2 | from gem5.simulate.simulator import Simulator 3 | from gem5.utils.requires import requires 4 | from gem5.components.boards.simple_board import SimpleBoard 5 | from gem5.components.memory.single_channel import SingleChannelDDR3_1600 6 | from gem5.components.processors.simple_processor import SimpleProcessor 7 | from gem5.components.processors.cpu_types import CPUTypes 8 | from gem5.isas import ISA 9 | from gem5.resources.resource import obtain_resource, SimpointResource 10 | from pathlib import Path 11 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 12 | from gem5.simulate.exit_event_generators import ( 13 | save_checkpoint_generator, 14 | ) 15 | 16 | requires(isa_required=ISA.X86) 17 | 18 | # Setup the components. 19 | cache_hierarchy = NoCache() 20 | memory = SingleChannelDDR3_1600(size="2GB") 21 | processor = SimpleProcessor( 22 | cpu_type=CPUTypes.ATOMIC, 23 | isa=ISA.X86, 24 | # SimPoints only works with one core 25 | num_cores=1, 26 | ) 27 | 28 | board = SimpleBoard( 29 | clk_freq="3GHz", 30 | processor=processor, 31 | memory=memory, 32 | cache_hierarchy=cache_hierarchy, 33 | ) 34 | 35 | # Setup the Simpoints workload 36 | board.set_se_simpoint_workload( 37 | binary=obtain_resource("x86-print-this"), 38 | arguments=["print this", 15000], 39 | simpoint=SimpointResource( 40 | simpoint_interval=1000000, 41 | simpoint_list=[2, 3, 4, 15], 42 | weight_list=[0.1, 0.2, 0.4, 0.3], 43 | warmup_interval=1000000, 44 | ), 45 | ) 46 | 47 | dir = Path("simpoint-checkpoint-dir") 48 | dir.mkdir(exist_ok=True) 49 | 50 | # Here we use the Simpoints generator to take the checkpoints. 51 | # When a Simpoint region, or warmup region, begins, a checkpoint is generated. 52 | simulator = Simulator( 53 | board=board, 54 | on_exit_event={ExitEvent.SIMPOINT_BEGIN: save_checkpoint_generator(dir)}, 55 | ) 56 | 57 | simulator.run() 58 | -------------------------------------------------------------------------------- /materials/complete/simpoints-restore.py: -------------------------------------------------------------------------------- 1 | from gem5.simulate.exit_event import ExitEvent 2 | from gem5.simulate.simulator import Simulator 3 | from gem5.utils.requires import requires 4 | from gem5.components.cachehierarchies.classic.private_l1_private_l2_cache_hierarchy import ( 5 | PrivateL1PrivateL2CacheHierarchy, 6 | ) 7 | from gem5.components.boards.simple_board import SimpleBoard 8 | from gem5.components.memory import DualChannelDDR4_2400 9 | from gem5.components.processors.simple_processor import SimpleProcessor 10 | from gem5.components.processors.cpu_types import CPUTypes 11 | from gem5.isas import ISA 12 | from gem5.resources.resource import SimpointResource, obtain_resource 13 | from gem5.resources.resource import SimpointResource 14 | from pathlib import Path 15 | 16 | from m5.stats import reset, dump 17 | 18 | requires(isa_required=ISA.X86) 19 | 20 | cache_hierarchy = PrivateL1PrivateL2CacheHierarchy( 21 | l1d_size="32kB", 22 | l1i_size="32kB", 23 | l2_size="256kB", 24 | ) 25 | 26 | memory = DualChannelDDR4_2400(size="2GB") 27 | 28 | processor = SimpleProcessor( 29 | cpu_type=CPUTypes.TIMING, 30 | isa=ISA.X86, 31 | num_cores=1, 32 | ) 33 | 34 | board = SimpleBoard( 35 | clk_freq="3GHz", 36 | processor=processor, 37 | memory=memory, 38 | cache_hierarchy=cache_hierarchy, 39 | ) 40 | 41 | board.set_se_simpoint_workload( 42 | binary=obtain_resource("x86-print-this"), 43 | arguments=["print this", 15000], 44 | simpoint=SimpointResource( 45 | simpoint_interval=1000000, 46 | simpoint_list=[2, 3, 4, 15], 47 | weight_list=[0.1, 0.2, 0.4, 0.3], 48 | warmup_interval=1000000, 49 | ), 50 | checkpoint=Path(""), 51 | ) 52 | 53 | 54 | def max_inst(): 55 | warmed_up = False 56 | while True: 57 | if warmed_up: 58 | print("end of SimPoint interval") 59 | yield True 60 | else: 61 | print("end of warmup, starting to simulate SimPoint") 62 | warmed_up = True 63 | # Schedule a MAX_INSTS exit event during the simulation 64 | simulator.schedule_max_insts( 65 | board.get_simpoint().get_simpoint_interval() 66 | ) 67 | dump() 68 | reset() 69 | yield False 70 | 71 | 72 | simulator = Simulator( 73 | board=board, 74 | on_exit_event={ExitEvent.MAX_INSTS: max_inst()}, 75 | ) 76 | 77 | simulator.schedule_max_insts(board.get_simpoint().get_warmup_list()[0]) 78 | simulator.run() 79 | -------------------------------------------------------------------------------- /materials/complete/traffic-generator-hbm2stack.py: -------------------------------------------------------------------------------- 1 | from gem5.components.boards.test_board import TestBoard 2 | from gem5.components.memory import HBM2Stack 3 | from gem5.components.processors.random_generator import RandomGenerator 4 | from gem5.components.boards.test_board import TestBoard 5 | from gem5.components.processors.random_generator import RandomGenerator 6 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 7 | 8 | import m5 9 | from m5.objects import Root 10 | 11 | # Setup the components. 12 | memory = HBM2Stack("1GiB") 13 | generator = RandomGenerator( 14 | duration="250us", 15 | rate="40GB/s", 16 | num_cores=1, 17 | max_addr=memory.get_size(), 18 | ) 19 | cache_hierarchy = NoCache() 20 | 21 | # Add them to the Test board. 22 | board = TestBoard( 23 | clk_freq="3GHz", 24 | generator=generator, 25 | memory=memory, 26 | cache_hierarchy=cache_hierarchy, 27 | ) 28 | 29 | # Setup the root and instantiate the simulation. 30 | # This is boilerplate code, to be removed in future releaes of gem5. 31 | root = Root(full_system=False, system=board) 32 | board._pre_instantiate() 33 | m5.instantiate() 34 | 35 | # Start the traffic generator. 36 | generator.start_traffic() 37 | exit_event = m5.simulate() 38 | -------------------------------------------------------------------------------- /materials/complete/traffic-generator.py: -------------------------------------------------------------------------------- 1 | from gem5.components.boards.test_board import TestBoard 2 | from gem5.components.memory import SingleChannelDDR3_1600 3 | from gem5.components.processors.random_generator import RandomGenerator 4 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 5 | 6 | import m5 7 | from m5.objects import Root 8 | 9 | # Setup the components. 10 | memory = SingleChannelDDR3_1600("1GiB") 11 | generator = RandomGenerator( 12 | duration="250us", 13 | rate="40GB/s", 14 | num_cores=1, 15 | max_addr=memory.get_size(), 16 | ) 17 | cache_hierarchy = NoCache() 18 | 19 | # Add them to the Test board. 20 | board = TestBoard( 21 | clk_freq="3GHz", 22 | generator=generator, 23 | memory=memory, 24 | cache_hierarchy=cache_hierarchy, 25 | ) 26 | 27 | # Setup the root and instantiate the simulation. 28 | # This is boilerplate code, to be removed in future releaes of gem5. 29 | root = Root(full_system=False, system=board) 30 | board._pre_instantiate() 31 | m5.instantiate() 32 | 33 | # Start the traffic generator. 34 | generator.start_traffic() 35 | exit_event = m5.simulate() 36 | -------------------------------------------------------------------------------- /materials/complete/x86-full-system.py: -------------------------------------------------------------------------------- 1 | from gem5.utils.requires import requires 2 | from gem5.components.boards.x86_board import X86Board 3 | from gem5.components.memory.single_channel import SingleChannelDDR3_1600 4 | from gem5.components.cachehierarchies.ruby.mesi_two_level_cache_hierarchy import ( 5 | MESITwoLevelCacheHierarchy, 6 | ) 7 | from gem5.components.processors.simple_switchable_processor import ( 8 | SimpleSwitchableProcessor, 9 | ) 10 | from gem5.coherence_protocol import CoherenceProtocol 11 | from gem5.isas import ISA 12 | from gem5.components.processors.cpu_types import CPUTypes 13 | from gem5.resources.workload import Workload 14 | from gem5.simulate.simulator import Simulator 15 | from gem5.simulate.exit_event import ExitEvent 16 | 17 | # This runs a check to ensure the gem5 binary is compiled to X86 and supports 18 | # the MESI Two Level coherence protocol. 19 | requires( 20 | isa_required=ISA.X86, 21 | coherence_protocol_required=CoherenceProtocol.MESI_TWO_LEVEL, 22 | ) 23 | 24 | # Here we setup a MESI Two Level Cache Hierarchy. 25 | cache_hierarchy = MESITwoLevelCacheHierarchy( 26 | l1d_size="32KiB", 27 | l1d_assoc=8, 28 | l1i_size="32KiB", 29 | l1i_assoc=8, 30 | l2_size="256kB", 31 | l2_assoc=16, 32 | num_l2_banks=1, 33 | ) 34 | 35 | # Setup the system memory. 36 | # Note, by default DDR3_1600 defaults to a size of 8GiB. However, a current 37 | # limitation with the X86 board is it can only accept memory systems up to 3GB. 38 | # As such, we must fix the size. 39 | memory = SingleChannelDDR3_1600("2GiB") 40 | 41 | # Here we setup the processor. This is a special switchable processor in which 42 | # a starting core type and a switch core type must be specified. Once a 43 | # configuration is instantiated a user may call `processor.switch()` to switch 44 | # from the starting core types to the switch core types. In this simulation 45 | # we start with TIMING cores to simulate the OS boot, then switch to the O3 46 | # cores for the command we wish to run after boot. 47 | processor = SimpleSwitchableProcessor( 48 | starting_core_type=CPUTypes.TIMING, 49 | switch_core_type=CPUTypes.O3, 50 | num_cores=2, 51 | isa=ISA.X86, 52 | ) 53 | 54 | # Here we setup the board. The X86Board allows for Full-System X86 simulations. 55 | board = X86Board( 56 | clk_freq="3GHz", 57 | processor=processor, 58 | memory=memory, 59 | cache_hierarchy=cache_hierarchy, 60 | ) 61 | 62 | # This is the command to run after the system has booted. The first `m5 exit` 63 | # will stop the simulation so we can switch the CPU cores from KVM to timing 64 | # and continue the simulation to run the echo command, sleep for a second, 65 | # then, again, call `m5 exit` to terminate the simulation. After simulation 66 | # has ended you may inspect `m5out/system.pc.com_1.device` to see the echo 67 | # output. 68 | command = ( 69 | "m5 exit;" 70 | + "echo 'This is running on Timing O3 cores.';" 71 | + "sleep 1;" 72 | + "m5 exit;" 73 | ) 74 | 75 | # Here we set the workload. If we look up 76 | # http://resources.gem5.org/resources.json we can see the following entry for 77 | # the workload "x86-ubuntu-18.04-boot": 78 | # ``` 79 | # { 80 | # "type" : "workload", 81 | # "name" : "x86-ubuntu-18.04-boot", 82 | # "documentation" : "A full boot of Ubuntu 18.04 with Linux 5.4.49 for 83 | # X86. It runs an `m5 exit` command when the boot is 84 | # completed unless the readfile is specified. If 85 | # specified the readfile will be executed after 86 | # booting.", 87 | # "function": "set_kernel_disk_workload", 88 | # "resources" : { 89 | # "kernel" : "x86-linux-kernel-5.4.49", 90 | # "disk_image":"x86-ubuntu-18.04-img" 91 | # }, 92 | # "additional_params" : {} 93 | # }, 94 | # ``` 95 | workload = Workload("x86-ubuntu-18.04-boot") 96 | 97 | # We want to ammend this workload slightly to carry out a script when the OS 98 | # boot is complete. The script immediately exits the simulation loop then, 99 | # when re-entered, will print "This is running on Timing CPU cores." before 100 | # sleeping for 1 simulated second then exiting the simulation loop again. 101 | # 102 | # We set this to the "readfile_contents" parameter. This parameter allows for 103 | # the setting of the contents of the readfile. The readfile is executed by this 104 | # resource when the OS is booted. 105 | command = ( 106 | "m5 exit;" 107 | + "echo 'This is running on O3 CPU cores.';" 108 | + "sleep 1;" 109 | + "m5 exit;" 110 | ) 111 | 112 | workload.set_parameter("readfile_contents", command) 113 | 114 | board.set_workload(workload) 115 | 116 | simulator = Simulator( 117 | board=board, 118 | on_exit_event={ 119 | # Here we want override the default behavior for the first m5 exit 120 | # exit event. Instead of exiting the simulator, we just want to 121 | # switch the processor. The 2nd 'm5 exit' after will revert to using 122 | # default behavior where the simulator run will exit. 123 | ExitEvent.EXIT: (func() for func in [processor.switch]), 124 | }, 125 | ) 126 | simulator.run() 127 | -------------------------------------------------------------------------------- /materials/hello-world.py: -------------------------------------------------------------------------------- 1 | from gem5.components.boards.simple_board import SimpleBoard 2 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 3 | from gem5.components.memory import SingleChannelDDR3_1600 4 | from gem5.components.processors.simple_processor import SimpleProcessor 5 | from gem5.components.processors.cpu_types import CPUTypes 6 | from gem5.resources.resource import obtain_resource 7 | from gem5.simulate.simulator import Simulator 8 | from gem5.isas import ISA 9 | -------------------------------------------------------------------------------- /materials/looppoints/create-looppoint-checkpoints.py: -------------------------------------------------------------------------------- 1 | from gem5.simulate.exit_event import ExitEvent 2 | from gem5.simulate.simulator import Simulator 3 | from gem5.utils.requires import requires 4 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 5 | from gem5.components.boards.simple_board import SimpleBoard 6 | from gem5.components.memory.single_channel import SingleChannelDDR3_1600 7 | from gem5.components.processors.simple_processor import SimpleProcessor 8 | from gem5.components.processors.cpu_types import CPUTypes 9 | from gem5.isas import ISA 10 | from gem5.resources.resource import obtain_resource 11 | from gem5.resources.looppoint import LooppointCsvLoader 12 | from pathlib import Path 13 | from gem5.simulate.exit_event_generators import ( 14 | looppoint_save_checkpoint_generator, 15 | ) 16 | 17 | requires(isa_required=ISA.X86) 18 | 19 | # When taking a checkpoint, the cache state is not saved, so the cache 20 | # hierarchy can be changed completely when restoring from a checkpoint. 21 | # By using NoCache() to take checkpoints, it can slightly improve the 22 | # performance when running in atomic mode, and it will not put any restrictions 23 | # on what people can do with the checkpoints. 24 | cache_hierarchy = NoCache() 25 | 26 | 27 | # Using simple memory to take checkpoints might slightly imporve the 28 | # performance in atomic mode. The memory structure can be changed when 29 | # restoring from a checkpoint, but the size of the memory must be equal or 30 | # greater to that taken when creating the checkpoint. 31 | memory = SingleChannelDDR3_1600(size="2GB") 32 | 33 | processor = SimpleProcessor( 34 | cpu_type=CPUTypes.ATOMIC, 35 | isa=ISA.X86, 36 | # LoopPoint can work with multicore workloads 37 | num_cores=9, 38 | ) 39 | 40 | board = SimpleBoard( 41 | clk_freq="3GHz", 42 | processor=processor, 43 | memory=memory, 44 | cache_hierarchy=cache_hierarchy, 45 | ) 46 | 47 | # Here we load the Pinpoint Looppoints CSV workload with the target binary and 48 | # input arguments. 49 | board.set_se_looppoint_workload( 50 | binary=obtain_resource("x86-matrix-multiply-omp"), 51 | arguments=[100, 8], 52 | looppoint=LooppointCsvLoader( 53 | pinpoints_file="materials/looppoints/refs/looppoint-pinpoints.csv" 54 | ), 55 | ) 56 | 57 | # Here we specify where this script should output the checkpoints. 58 | dir = Path("checkpoint_outputs") 59 | dir.mkdir(exist_ok=True) 60 | 61 | # This code ensures that when a looppoint region begins (inclusive of warmup) 62 | # a checkpoint will be taken. It also updates our looppoint data structure. 63 | simulator = Simulator( 64 | board=board, 65 | on_exit_event={ 66 | ExitEvent.SIMPOINT_BEGIN: looppoint_save_checkpoint_generator( 67 | checkpoint_dir=dir, 68 | looppoint=board.get_looppoint(), 69 | # True if the relative PC count pairs should be updated during the 70 | # simulation. Default as True. 71 | update_relatives=True, 72 | # True if the simulation loop should exit after all the PC count 73 | # pairs in the LoopPoint data file have been encountered. Default 74 | # as True. 75 | exit_when_empty=True, 76 | ) 77 | }, 78 | ) 79 | 80 | simulator.run() 81 | 82 | # Output the JSON file. To be used when restoring. 83 | board.get_looppoint().output_json_file("looppoint.json") 84 | -------------------------------------------------------------------------------- /materials/looppoints/refs/looppoint-pinpoints.csv: -------------------------------------------------------------------------------- 1 | # Regions based on: /home/alen/isca2022/looppoint/tools/sde-external-9.0.0-2021-11-07-lin/pinplay-scripts/pcregions.py --label_file t.labels --warmup_factor 2 --tid global --bbv_file t.bb --region_file t.simpoints --weight_file t.weights 2 | 3 | # comment,thread-id,region-id,start-pc, start-image-name, start-image-offset, start-pc-count,end-pc, end-image-name, end-image-offset, end-pc-count,end-pc-relative-count, region-length, region-weight, region-multiplier, region-type 4 | 5 | # RegionId = 1 Slice = 27 Icount = 2160042521 Length = 79958388 Weight = 0.04651 Multiplier = 4.000 ClusterSlicecount = 4 ClusterIcount = 320005167 6 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 211076617 source-info: matrix-omp.cpp:75 7 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 219060252 relative_count: 1060676.0 source-info: matrix-omp.cpp:75 8 | cluster 0 from slice 27,global,1,0x4069d0,matrix-omp,0x69d0,211076617,0x4069d0,matrix-omp,0x69d0,219060252,1060676,79958388,0.04651,4.000,simulation 9 | 10 | # RegionId = 2 Slice = 52 Icount = 4160001603 Length = 80000011 Weight = 0.05814 Multiplier = 5.001 ClusterSlicecount = 5 ClusterIcount = 400040399 11 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 407294228 source-info: matrix-omp.cpp:75 12 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 415282447 relative_count: 1035231.0 source-info: matrix-omp.cpp:75 13 | cluster 1 from slice 52,global,2,0x4069d0,matrix-omp,0x69d0,407294228,0x4069d0,matrix-omp,0x69d0,415282447,1035231,80000011,0.05814,5.001,simulation 14 | 15 | # RegionId = 3 Slice = 24 Icount = 1920000792 Length = 80027459 Weight = 0.04651 Multiplier = 4.000 ClusterSlicecount = 4 ClusterIcount = 320021091 16 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 187978221 source-info: matrix-omp.cpp:75 17 | #End: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 23520614 relative_count: 144352.0 source-info: matrix-omp.cpp:95 18 | cluster 2 from slice 24,global,3,0x4069d0,matrix-omp,0x69d0,187978221,0x406880,matrix-omp,0x6880,23520614,144352,80027459,0.04651,4.000,simulation 19 | 20 | # RegionId = 5 Slice = 62 Icount = 4960001982 Length = 80000038 Weight = 0.05814 Multiplier = 5.000 ClusterSlicecount = 5 ClusterIcount = 400005609 21 | #Start: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 59400187 source-info: matrix-omp.cpp:95 22 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 493422990 relative_count: 923025.0 source-info: matrix-omp.cpp:75 23 | cluster 4 from slice 62,global,5,0x406880,matrix-omp,0x6880,59400187,0x4069d0,matrix-omp,0x69d0,493422990,923025,80000038,0.05814,5.000,simulation 24 | 25 | # RegionId = 6 Slice = 31 Icount = 2480001019 Length = 80027856 Weight = 0.09302 Multiplier = 8.000 ClusterSlicecount = 8 ClusterIcount = 639987923 26 | #Start: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 29162087 source-info: matrix-omp.cpp:95 27 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 250145350 relative_count: 878899.0 source-info: matrix-omp.cpp:75 28 | cluster 5 from slice 31,global,6,0x406880,matrix-omp,0x6880,29162087,0x4069d0,matrix-omp,0x69d0,250145350,878899,80027856,0.09302,8.000,simulation 29 | 30 | # RegionId = 7 Slice = 57 Icount = 4560041160 Length = 79960651 Weight = 0.11628 Multiplier = 10.000 ClusterSlicecount = 10 ClusterIcount = 799960946 31 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 446368834 source-info: matrix-omp.cpp:75 32 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 454352717 relative_count: 1019689.0 source-info: matrix-omp.cpp:75 33 | cluster 6 from slice 57,global,7,0x4069d0,matrix-omp,0x69d0,446368834,0x4069d0,matrix-omp,0x69d0,454352717,1019689,79960651,0.11628,10.000,simulation 34 | 35 | # RegionId = 8 Slice = 0 Icount = 0 Length = 80000062 Weight = 0.01163 Multiplier = 1.000 ClusterSlicecount = 1 ClusterIcount = 80000061 36 | #Start: pc : 0x403050 image: matrix-omp offset: 0x3050 absolute_count: 1 source-info: matrix-omp.cpp:17 37 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 6861604 relative_count: 864190.0 source-info: matrix-omp.cpp:75 38 | cluster 7 from slice 0,global,8,0x403050,matrix-omp,0x3050,1,0x4069d0,matrix-omp,0x69d0,6861604,864190,80000062,0.01163,1.000,simulation 39 | 40 | # RegionId = 9 Slice = 81 Icount = 6480002566 Length = 80000017 Weight = 0.15116 Multiplier = 13.001 ClusterSlicecount = 13 ClusterIcount = 1040045961 41 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 634598476 source-info: matrix-omp.cpp:75 42 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 642586697 relative_count: 1012257.0 source-info: matrix-omp.cpp:75 43 | cluster 8 from slice 81,global,9,0x4069d0,matrix-omp,0x69d0,634598476,0x4069d0,matrix-omp,0x69d0,642586697,1012257,80000017,0.15116,13.001,simulation 44 | 45 | # RegionId = 10 Slice = 36 Icount = 2880001147 Length = 80000021 Weight = 0.12791 Multiplier = 11.000 ClusterSlicecount = 11 ClusterIcount = 879968292 46 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 282095199 source-info: matrix-omp.cpp:75 47 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 290083433 relative_count: 1008513.0 source-info: matrix-omp.cpp:75 48 | cluster 9 from slice 36,global,10,0x4069d0,matrix-omp,0x69d0,282095199,0x4069d0,matrix-omp,0x69d0,290083433,1008513,80000021,0.12791,11.000,simulation 49 | 50 | # RegionId = 11 Slice = 18 Icount = 1440000632 Length = 80000048 Weight = 0.02326 Multiplier = 2.001 ClusterSlicecount = 2 ClusterIcount = 160040723 51 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 140919731 source-info: matrix-omp.cpp:75 52 | #End: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 17872963 relative_count: 106579.0 source-info: matrix-omp.cpp:95 53 | cluster 10 from slice 18,global,11,0x4069d0,matrix-omp,0x69d0,140919731,0x406880,matrix-omp,0x6880,17872963,106579,80000048,0.02326,2.001,simulation 54 | 55 | # RegionId = 12 Slice = 47 Icount = 3760037208 Length = 79994218 Weight = 0.11628 Multiplier = 9.999 ClusterSlicecount = 10 ClusterIcount = 799899133 56 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 368227872 source-info: matrix-omp.cpp:75 57 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 376215478 relative_count: 993878.0 source-info: matrix-omp.cpp:75 58 | cluster 11 from slice 47,global,12,0x4069d0,matrix-omp,0x69d0,368227872,0x4069d0,matrix-omp,0x69d0,376215478,993878,79994218,0.11628,9.999,simulation 59 | 60 | # RegionId = 13 Slice = 22 Icount = 1760000764 Length = 79999993 Weight = 0.06977 Multiplier = 6.000 ClusterSlicecount = 6 ClusterIcount = 480027237 61 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 172001763 source-info: matrix-omp.cpp:75 62 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 179989993 relative_count: 924811.0 source-info: matrix-omp.cpp:75 63 | cluster 12 from slice 22,global,13,0x4069d0,matrix-omp,0x69d0,172001763,0x4069d0,matrix-omp,0x69d0,179989993,924811,79999993,0.06977,6.000,simulation 64 | 65 | # RegionId = 14 Slice = 76 Icount = 6080002419 Length = 80000030 Weight = 0.08140 Multiplier = 7.000 ClusterSlicecount = 7 ClusterIcount = 560000161 66 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 595528209 source-info: matrix-omp.cpp:75 67 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 603516434 relative_count: 1062544.0 source-info: matrix-omp.cpp:75 68 | cluster 13 from slice 76,global,14,0x4069d0,matrix-omp,0x69d0,595528209,0x4069d0,matrix-omp,0x69d0,603516434,1062544,80000030,0.08140,7.000,simulation 69 | 70 | # RegionId = 15 Slice = 25 Icount = 2000028251 Length = 160014270 WarmupFactor = 2 71 | #Start: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 23520614 source-info: matrix-omp.cpp:95 72 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 211076617 relative_count: 1933632.0 source-info: matrix-omp.cpp:75 73 | Warmup for regionid 1,global,15,0x406880,matrix-omp,0x6880,23520614,0x4069d0,matrix-omp,0x69d0,211076617,1933632,160014270,0.00000,0.000,warmup:1 74 | 75 | # RegionId = 16 Slice = 50 Icount = 4000001542 Length = 160000061 WarmupFactor = 2 76 | #Start: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 48111518 source-info: matrix-omp.cpp:95 77 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 407294228 relative_count: 2004125.0 source-info: matrix-omp.cpp:75 78 | Warmup for regionid 2,global,16,0x406880,matrix-omp,0x6880,48111518,0x4069d0,matrix-omp,0x69d0,407294228,2004125,160000061,0.00000,0.000,warmup:2 79 | 80 | # RegionId = 17 Slice = 22 Icount = 1760000764 Length = 160000028 WarmupFactor = 2 81 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 172001763 source-info: matrix-omp.cpp:75 82 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 187978221 relative_count: 1946376.0 source-info: matrix-omp.cpp:75 83 | Warmup for regionid 3,global,17,0x4069d0,matrix-omp,0x69d0,172001763,0x4069d0,matrix-omp,0x69d0,187978221,1946376,160000028,0.00000,0.000,warmup:3 84 | 85 | # RegionId = 19 Slice = 60 Icount = 4800028977 Length = 159973005 WarmupFactor = 2 86 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 470332151 source-info: matrix-omp.cpp:75 87 | #End: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 59400187 relative_count: 219220.0 source-info: matrix-omp.cpp:95 88 | Warmup for regionid 5,global,19,0x4069d0,matrix-omp,0x69d0,470332151,0x406880,matrix-omp,0x6880,59400187,219220,159973005,0.00000,0.000,warmup:5 89 | 90 | # RegionId = 20 Slice = 29 Icount = 2320000944 Length = 160000075 WarmupFactor = 2 91 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 227048490 source-info: matrix-omp.cpp:75 92 | #End: pc : 0x406880 image: matrix-omp offset: 0x6880 absolute_count: 29162087 relative_count: 212613.0 source-info: matrix-omp.cpp:95 93 | Warmup for regionid 6,global,20,0x4069d0,matrix-omp,0x69d0,227048490,0x406880,matrix-omp,0x6880,29162087,212613,160000075,0.00000,0.000,warmup:6 94 | 95 | # RegionId = 21 Slice = 55 Icount = 4400001705 Length = 160039455 WarmupFactor = 2 96 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 431258904 source-info: matrix-omp.cpp:75 97 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 446368834 relative_count: 1934734.0 source-info: matrix-omp.cpp:75 98 | Warmup for regionid 7,global,21,0x4069d0,matrix-omp,0x69d0,431258904,0x4069d0,matrix-omp,0x69d0,446368834,1934734,160039455,0.00000,0.000,warmup:7 99 | 100 | # No warmup possible for regionid 8 with WarmupFactor 2 101 | 102 | # RegionId = 23 Slice = 79 Icount = 6320002528 Length = 160000038 WarmupFactor = 2 103 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 619492892 source-info: matrix-omp.cpp:75 104 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 634598476 relative_count: 1914956.0 source-info: matrix-omp.cpp:75 105 | Warmup for regionid 9,global,23,0x4069d0,matrix-omp,0x69d0,619492892,0x4069d0,matrix-omp,0x69d0,634598476,1914956,160000038,0.00000,0.000,warmup:9 106 | 107 | # RegionId = 24 Slice = 34 Icount = 2720001105 Length = 160000042 WarmupFactor = 2 108 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 266118749 source-info: matrix-omp.cpp:75 109 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 282095199 relative_count: 1949519.0 source-info: matrix-omp.cpp:75 110 | Warmup for regionid 10,global,24,0x4069d0,matrix-omp,0x69d0,266118749,0x4069d0,matrix-omp,0x69d0,282095199,1949519,160000042,0.00000,0.000,warmup:10 111 | 112 | # RegionId = 25 Slice = 16 Icount = 1280000588 Length = 160000044 WarmupFactor = 2 113 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 124943274 source-info: matrix-omp.cpp:75 114 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 140919731 relative_count: 1947091.0 source-info: matrix-omp.cpp:75 115 | Warmup for regionid 11,global,25,0x4069d0,matrix-omp,0x69d0,124943274,0x4069d0,matrix-omp,0x69d0,140919731,1947091,160000044,0.00000,0.000,warmup:11 116 | 117 | # RegionId = 26 Slice = 45 Icount = 3600001357 Length = 160035851 WarmupFactor = 2 118 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 352247496 source-info: matrix-omp.cpp:75 119 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 368227872 relative_count: 1987144.0 source-info: matrix-omp.cpp:75 120 | Warmup for regionid 12,global,26,0x4069d0,matrix-omp,0x69d0,352247496,0x4069d0,matrix-omp,0x69d0,368227872,1987144,160035851,0.00000,0.000,warmup:12 121 | 122 | # RegionId = 27 Slice = 20 Icount = 1600028339 Length = 159972425 WarmupFactor = 2 123 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 156028351 source-info: matrix-omp.cpp:75 124 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 172001763 relative_count: 2080288.0 source-info: matrix-omp.cpp:75 125 | Warmup for regionid 13,global,27,0x4069d0,matrix-omp,0x69d0,156028351,0x4069d0,matrix-omp,0x69d0,172001763,2080288,159972425,0.00000,0.000,warmup:13 126 | 127 | # RegionId = 28 Slice = 74 Icount = 5920002374 Length = 160000045 WarmupFactor = 2 128 | #Start: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 580422616 source-info: matrix-omp.cpp:75 129 | #End: pc : 0x4069d0 image: matrix-omp offset: 0x69d0 absolute_count: 595528209 relative_count: 1903109.0 source-info: matrix-omp.cpp:75 130 | Warmup for regionid 14,global,28,0x4069d0,matrix-omp,0x69d0,580422616,0x4069d0,matrix-omp,0x69d0,595528209,1903109,160000045,0.00000,0.000,warmup:14 131 | 132 | # First PC, 0x403050 133 | # Total instructions in 13 regions = 1039968792 134 | # Total instructions in workload = 6880002703 135 | # Total slices in workload = 86 136 | -------------------------------------------------------------------------------- /materials/looppoints/refs/looppoint.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "simulation": { 4 | "start": { 5 | "pc": 4221392, 6 | "global": 211076617, 7 | "relative": 15326617 8 | }, 9 | "end": { 10 | "pc": 4221392, 11 | "global": 219060252, 12 | "relative": 23310252 13 | } 14 | }, 15 | "multiplier": 4.0, 16 | "warmup": { 17 | "start": { 18 | "pc": 4221056, 19 | "count": 23520614 20 | }, 21 | "end": { 22 | "pc": 4221392, 23 | "count": 211076617 24 | } 25 | } 26 | }, 27 | "2": { 28 | "simulation": { 29 | "start": { 30 | "pc": 4221392, 31 | "global": 407294228, 32 | "relative": 15794228 33 | }, 34 | "end": { 35 | "pc": 4221392, 36 | "global": 415282447, 37 | "relative": 23782447 38 | } 39 | }, 40 | "multiplier": 5.001, 41 | "warmup": { 42 | "start": { 43 | "pc": 4221056, 44 | "count": 48111518 45 | }, 46 | "end": { 47 | "pc": 4221392, 48 | "count": 407294228 49 | } 50 | } 51 | }, 52 | "3": { 53 | "simulation": { 54 | "start": { 55 | "pc": 4221392, 56 | "global": 187978221, 57 | "relative": 15976458 58 | }, 59 | "end": { 60 | "pc": 4221056, 61 | "global": 23520614, 62 | "relative": 2708114 63 | } 64 | }, 65 | "multiplier": 4.0, 66 | "warmup": { 67 | "start": { 68 | "pc": 4221392, 69 | "count": 172001763 70 | }, 71 | "end": { 72 | "pc": 4221392, 73 | "count": 187978221 74 | } 75 | } 76 | }, 77 | "5": { 78 | "simulation": { 79 | "start": { 80 | "pc": 4221056, 81 | "global": 59400187, 82 | "relative": 1957687 83 | }, 84 | "end": { 85 | "pc": 4221392, 86 | "global": 493422990, 87 | "relative": 23090839 88 | } 89 | }, 90 | "multiplier": 5.0, 91 | "warmup": { 92 | "start": { 93 | "pc": 4221392, 94 | "count": 470332151 95 | }, 96 | "end": { 97 | "pc": 4221056, 98 | "count": 59400187 99 | } 100 | } 101 | }, 102 | "6": { 103 | "simulation": { 104 | "start": { 105 | "pc": 4221056, 106 | "global": 29162087, 107 | "relative": 1689587 108 | }, 109 | "end": { 110 | "pc": 4221392, 111 | "global": 250145350, 112 | "relative": 23096860 113 | } 114 | }, 115 | "multiplier": 8.0, 116 | "warmup": { 117 | "start": { 118 | "pc": 4221392, 119 | "count": 227048490 120 | }, 121 | "end": { 122 | "pc": 4221056, 123 | "count": 29162087 124 | } 125 | } 126 | }, 127 | "7": { 128 | "simulation": { 129 | "start": { 130 | "pc": 4221392, 131 | "global": 446368834, 132 | "relative": 15109930 133 | }, 134 | "end": { 135 | "pc": 4221392, 136 | "global": 454352717, 137 | "relative": 23093813 138 | } 139 | }, 140 | "multiplier": 10.0, 141 | "warmup": { 142 | "start": { 143 | "pc": 4221392, 144 | "count": 431258904 145 | }, 146 | "end": { 147 | "pc": 4221392, 148 | "count": 446368834 149 | } 150 | } 151 | }, 152 | "8": { 153 | "simulation": { 154 | "start": { 155 | "pc": 4206672, 156 | "global": 1 157 | }, 158 | "end": { 159 | "pc": 4221392, 160 | "global": 6861604, 161 | "relative": 6861604 162 | } 163 | }, 164 | "multiplier": 1.0 165 | }, 166 | "9": { 167 | "simulation": { 168 | "start": { 169 | "pc": 4221392, 170 | "global": 634598476, 171 | "relative": 15105584 172 | }, 173 | "end": { 174 | "pc": 4221392, 175 | "global": 642586697, 176 | "relative": 23093805 177 | } 178 | }, 179 | "multiplier": 13.001, 180 | "warmup": { 181 | "start": { 182 | "pc": 4221392, 183 | "count": 619492892 184 | }, 185 | "end": { 186 | "pc": 4221392, 187 | "count": 634598476 188 | } 189 | } 190 | }, 191 | "10": { 192 | "simulation": { 193 | "start": { 194 | "pc": 4221392, 195 | "global": 282095199, 196 | "relative": 15976450 197 | }, 198 | "end": { 199 | "pc": 4221392, 200 | "global": 290083433, 201 | "relative": 23964684 202 | } 203 | }, 204 | "multiplier": 11.0, 205 | "warmup": { 206 | "start": { 207 | "pc": 4221392, 208 | "count": 266118749 209 | }, 210 | "end": { 211 | "pc": 4221392, 212 | "count": 282095199 213 | } 214 | } 215 | }, 216 | "11": { 217 | "simulation": { 218 | "start": { 219 | "pc": 4221392, 220 | "global": 140919731, 221 | "relative": 15976457 222 | }, 223 | "end": { 224 | "pc": 4221056, 225 | "global": 17872963, 226 | "relative": 2887963 227 | } 228 | }, 229 | "multiplier": 2.001, 230 | "warmup": { 231 | "start": { 232 | "pc": 4221392, 233 | "count": 124943274 234 | }, 235 | "end": { 236 | "pc": 4221392, 237 | "count": 140919731 238 | } 239 | } 240 | }, 241 | "12": { 242 | "simulation": { 243 | "start": { 244 | "pc": 4221392, 245 | "global": 368227872, 246 | "relative": 15980376 247 | }, 248 | "end": { 249 | "pc": 4221392, 250 | "global": 376215478, 251 | "relative": 23967982 252 | } 253 | }, 254 | "multiplier": 9.999, 255 | "warmup": { 256 | "start": { 257 | "pc": 4221392, 258 | "count": 352247496 259 | }, 260 | "end": { 261 | "pc": 4221392, 262 | "count": 368227872 263 | } 264 | } 265 | }, 266 | "13": { 267 | "simulation": { 268 | "start": { 269 | "pc": 4221392, 270 | "global": 172001763, 271 | "relative": 15973412 272 | }, 273 | "end": { 274 | "pc": 4221392, 275 | "global": 179989993, 276 | "relative": 23961642 277 | } 278 | }, 279 | "multiplier": 6.0, 280 | "warmup": { 281 | "start": { 282 | "pc": 4221392, 283 | "count": 156028351 284 | }, 285 | "end": { 286 | "pc": 4221392, 287 | "count": 172001763 288 | } 289 | } 290 | }, 291 | "14": { 292 | "simulation": { 293 | "start": { 294 | "pc": 4221392, 295 | "global": 595528209, 296 | "relative": 15105593 297 | }, 298 | "end": { 299 | "pc": 4221392, 300 | "global": 603516434, 301 | "relative": 23093818 302 | } 303 | }, 304 | "multiplier": 7.0, 305 | "warmup": { 306 | "start": { 307 | "pc": 4221392, 308 | "count": 580422616 309 | }, 310 | "end": { 311 | "pc": 4221392, 312 | "count": 595528209 313 | } 314 | } 315 | } 316 | } -------------------------------------------------------------------------------- /materials/looppoints/refs/region-1-checkpoint/board.physmem.store0.pmem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gem5-hpca-2023/gem5-tutorial-codespace/d6c9f9fe1869ae2d11a3ec3ba03f96143f4e82be/materials/looppoints/refs/region-1-checkpoint/board.physmem.store0.pmem -------------------------------------------------------------------------------- /materials/looppoints/refs/region-2-checkpoint/board.physmem.store0.pmem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gem5-hpca-2023/gem5-tutorial-codespace/d6c9f9fe1869ae2d11a3ec3ba03f96143f4e82be/materials/looppoints/refs/region-2-checkpoint/board.physmem.store0.pmem -------------------------------------------------------------------------------- /materials/looppoints/refs/region-3-checkpoint/board.physmem.store0.pmem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gem5-hpca-2023/gem5-tutorial-codespace/d6c9f9fe1869ae2d11a3ec3ba03f96143f4e82be/materials/looppoints/refs/region-3-checkpoint/board.physmem.store0.pmem -------------------------------------------------------------------------------- /materials/looppoints/restore-looppoint-checkpoint.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | from gem5.simulate.exit_event import ExitEvent 4 | from gem5.simulate.simulator import Simulator 5 | from gem5.utils.requires import requires 6 | from gem5.components.cachehierarchies.classic.private_l1_private_l2_cache_hierarchy import ( 7 | PrivateL1PrivateL2CacheHierarchy, 8 | ) 9 | from gem5.components.boards.simple_board import SimpleBoard 10 | from gem5.components.memory import DualChannelDDR4_2400 11 | from gem5.components.processors.simple_processor import SimpleProcessor 12 | from gem5.components.processors.cpu_types import CPUTypes 13 | from gem5.resources.looppoint import LooppointJsonLoader 14 | from gem5.isas import ISA 15 | from gem5.resources.resource import obtain_resource 16 | from m5.stats import reset, dump 17 | from pathlib import Path 18 | 19 | requires(isa_required=ISA.X86) 20 | 21 | parser = argparse.ArgumentParser(description="An restore checkpoint script.") 22 | 23 | parser.add_argument( 24 | "--region", 25 | type=str, 26 | required=False, 27 | choices=("1", "2", "3"), 28 | default="1", 29 | help="The checkpoint region to restore from.", 30 | ) 31 | args = parser.parse_args() 32 | 33 | # The cache hierarchy can be different from the cache hierarchy used in taking 34 | # the checkpoints 35 | cache_hierarchy = PrivateL1PrivateL2CacheHierarchy( 36 | l1d_size="32kB", 37 | l1i_size="32kB", 38 | l2_size="256kB", 39 | ) 40 | 41 | # The memory structure can be different from the memory structure used in 42 | # taking the checkpoints, but the size of the memory must be equal or larger. 43 | memory = DualChannelDDR4_2400(size="2GB") 44 | 45 | processor = SimpleProcessor( 46 | cpu_type=CPUTypes.TIMING, 47 | isa=ISA.X86, 48 | # The number of cores must be equal or greater than that used when taking 49 | # the checkpoint. 50 | num_cores=9, 51 | ) 52 | 53 | board = SimpleBoard( 54 | clk_freq="3GHz", 55 | processor=processor, 56 | memory=memory, 57 | cache_hierarchy=cache_hierarchy, 58 | ) 59 | 60 | # Load the Looppoint JSON here and specify the region and the corresponding 61 | # checkpoint 62 | board.set_se_looppoint_workload( 63 | binary=obtain_resource("x86-matrix-multiply-omp"), 64 | looppoint=LooppointJsonLoader( 65 | looppoint_file=Path("materials/looppoints/refs/looppoint.json"), 66 | region_id=args.region, 67 | ), 68 | checkpoint=Path( 69 | f"materials/looppoints/refs/region-{args.region}-checkpoint" 70 | ), 71 | ) 72 | 73 | # This generator will dump the stats and exit the simulation loop when the 74 | # simulation region reaches its end. In the case there is a warmup interval, 75 | # the simulation stats are reset after the warmup is complete. 76 | def reset_and_dump(): 77 | if len(board.get_looppoint().get_targets()) > 1: 78 | print("Warmup region ended. Resetting stats.") 79 | reset() 80 | yield False 81 | print("Region ended. Dumping stats.") 82 | dump() 83 | yield True 84 | 85 | 86 | simulator = Simulator( 87 | board=board, 88 | on_exit_event={ExitEvent.SIMPOINT_BEGIN: reset_and_dump()}, 89 | ) 90 | 91 | simulator.run() 92 | -------------------------------------------------------------------------------- /materials/obtain-resources.py: -------------------------------------------------------------------------------- 1 | from gem5.resources.resource import obtain_resource 2 | 3 | resource = obtain_resource("riscv-disk-img") 4 | 5 | print(f"The resource is available at {resource.get_local_path()}") 6 | -------------------------------------------------------------------------------- /materials/simpoints-checkpoint.py: -------------------------------------------------------------------------------- 1 | from gem5.simulate.exit_event import ExitEvent 2 | from gem5.simulate.simulator import Simulator 3 | from gem5.utils.requires import requires 4 | from gem5.components.boards.simple_board import SimpleBoard 5 | from gem5.components.memory.single_channel import SingleChannelDDR3_1600 6 | from gem5.components.processors.simple_processor import SimpleProcessor 7 | from gem5.components.processors.cpu_types import CPUTypes 8 | from gem5.isas import ISA 9 | from gem5.resources.resource import obtain_resource, SimpointResource 10 | from pathlib import Path 11 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 12 | from gem5.simulate.exit_event_generators import ( 13 | save_checkpoint_generator, 14 | ) 15 | 16 | requires(isa_required=ISA.X86) 17 | 18 | # Setup the components. 19 | cache_hierarchy = NoCache() 20 | memory = SingleChannelDDR3_1600(size="2GB") 21 | processor = SimpleProcessor( 22 | cpu_type=CPUTypes.ATOMIC, 23 | isa=ISA.X86, 24 | # SimPoints only works with one core 25 | num_cores=1, 26 | ) 27 | 28 | board = SimpleBoard( 29 | clk_freq="3GHz", 30 | processor=processor, 31 | memory=memory, 32 | cache_hierarchy=cache_hierarchy, 33 | ) 34 | 35 | ### TO COMPLETE HERE #### 36 | 37 | simulator.run() 38 | -------------------------------------------------------------------------------- /materials/simpoints-restore.py: -------------------------------------------------------------------------------- 1 | from gem5.simulate.exit_event import ExitEvent 2 | from gem5.simulate.simulator import Simulator 3 | from gem5.utils.requires import requires 4 | from gem5.components.cachehierarchies.classic.private_l1_private_l2_cache_hierarchy import ( 5 | PrivateL1PrivateL2CacheHierarchy, 6 | ) 7 | from gem5.components.boards.simple_board import SimpleBoard 8 | from gem5.components.memory import DualChannelDDR4_2400 9 | from gem5.components.processors.simple_processor import SimpleProcessor 10 | from gem5.components.processors.cpu_types import CPUTypes 11 | from gem5.isas import ISA 12 | from gem5.resources.resource import SimpointResource, obtain_resource 13 | from gem5.resources.resource import SimpointResource 14 | from pathlib import Path 15 | 16 | from m5.stats import reset, dump 17 | 18 | requires(isa_required=ISA.X86) 19 | 20 | cache_hierarchy = PrivateL1PrivateL2CacheHierarchy( 21 | l1d_size="32kB", 22 | l1i_size="32kB", 23 | l2_size="256kB", 24 | ) 25 | 26 | memory = DualChannelDDR4_2400(size="2GB") 27 | 28 | processor = SimpleProcessor( 29 | cpu_type=CPUTypes.TIMING, 30 | isa=ISA.X86, 31 | num_cores=1, 32 | ) 33 | 34 | board = SimpleBoard( 35 | clk_freq="3GHz", 36 | processor=processor, 37 | memory=memory, 38 | cache_hierarchy=cache_hierarchy, 39 | ) 40 | 41 | board.set_se_simpoint_workload( 42 | binary=obtain_resource("x86-print-this"), 43 | arguments=["print this", 15000], 44 | simpoint=SimpointResource( 45 | simpoint_interval=1000000, 46 | simpoint_list=[2, 3, 4, 15], 47 | weight_list=[0.1, 0.2, 0.4, 0.3], 48 | warmup_interval=1000000, 49 | ), 50 | checkpoint=Path(""), 51 | ) 52 | 53 | 54 | def max_inst(): 55 | warmed_up = False 56 | while True: 57 | if warmed_up: 58 | print("end of SimPoint interval") 59 | yield True 60 | else: 61 | print("end of warmup, starting to simulate SimPoint") 62 | warmed_up = True 63 | # Schedule a MAX_INSTS exit event during the simulation 64 | simulator.schedule_max_insts( 65 | board.get_simpoint().get_simpoint_interval() 66 | ) 67 | dump() 68 | reset() 69 | yield False 70 | 71 | 72 | simulator = Simulator( 73 | board=board, 74 | on_exit_event={ExitEvent.MAX_INSTS: max_inst()}, 75 | ) 76 | 77 | simulator.schedule_max_insts(board.get_simpoint().get_warmup_list()[0]) 78 | simulator.run() 79 | -------------------------------------------------------------------------------- /materials/traffic-generator.py: -------------------------------------------------------------------------------- 1 | from gem5.components.boards.test_board import TestBoard 2 | from gem5.components.memory.single_channel import SingleChannelDDR_1600 3 | from gem5.components.processors.random_generator import RandomGenerator 4 | from gem5.components.cachehierarchies.classic.no_cache import NoCache 5 | 6 | import m5 7 | from m5.objects import Root 8 | 9 | ### TO COMPLETE HERE ### 10 | 11 | # Setup the root and instantiate the simulation. 12 | # This is boilerplate code, to be removed in future releaes of gem5. 13 | root = Root(full_system=False, system=board) 14 | board._pre_instantiate() 15 | m5.instantiate() 16 | 17 | # Start the traffic generator. 18 | generator.start_traffic() 19 | exit_event = m5.simulate() 20 | -------------------------------------------------------------------------------- /materials/x86-full-system.py: -------------------------------------------------------------------------------- 1 | from gem5.utils.requires import requires 2 | from gem5.components.boards.x86_board import X86Board 3 | from gem5.components.memory.single_channel import SingleChannelDDR3_1600 4 | from gem5.components.cachehierarchies.ruby.mesi_two_level_cache_hierarchy import ( 5 | MESITwoLevelCacheHierarchy, 6 | ) 7 | from gem5.components.processors.simple_switchable_processor import ( 8 | SimpleSwitchableProcessor, 9 | ) 10 | from gem5.coherence_protocol import CoherenceProtocol 11 | from gem5.isas import ISA 12 | from gem5.components.processors.cpu_types import CPUTypes 13 | from gem5.resources.workload import Workload 14 | from gem5.simulate.simulator import Simulator 15 | from gem5.simulate.exit_event import ExitEvent 16 | --------------------------------------------------------------------------------