power_thermal_model.doxygen revision 11424:e07fd01651f3
15643Sgblack@eecs.umich.edu# Copyright (c) 2016 ARM Limited
25643Sgblack@eecs.umich.edu# All rights reserved
35643Sgblack@eecs.umich.edu#
45643Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall
55643Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual
65643Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating
75643Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software
85643Sgblack@eecs.umich.edu# licensed hereunder.  You may use the software subject to the license
95643Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated
105643Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software,
115643Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form.
125643Sgblack@eecs.umich.edu#
135643Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
145643Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
155643Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
165643Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
175643Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
185643Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
195643Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
205643Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
215643Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
225643Sgblack@eecs.umich.edu# this software without specific prior written permission.
235643Sgblack@eecs.umich.edu#
245643Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
255643Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
265643Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
275643Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
285643Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
295643Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
305643Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
315643Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
325643Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
335643Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
345643Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
355643Sgblack@eecs.umich.edu#
365643Sgblack@eecs.umich.edu# Author: David Guillen Fandos
375643Sgblack@eecs.umich.edu
385643Sgblack@eecs.umich.edu/*! \page gem5PowerModel Gem5 Power & Thermal model
395643Sgblack@eecs.umich.edu
406137Sgblack@eecs.umich.edu  \tableofcontents
416137Sgblack@eecs.umich.edu
425643Sgblack@eecs.umich.edu  This document gives an overview of the power and thermal modelling
435643Sgblack@eecs.umich.edu  infrastructure in Gem5. The purpose is to give a high level view of
445643Sgblack@eecs.umich.edu  all the pieces involved and how they interact with each other and
455657Sgblack@eecs.umich.edu  the simulator.
466137Sgblack@eecs.umich.edu
475657Sgblack@eecs.umich.edu  \section gem5_PM_CD Class overview
485643Sgblack@eecs.umich.edu
495643Sgblack@eecs.umich.edu  Classes involved in the power model are:
505643Sgblack@eecs.umich.edu
515643Sgblack@eecs.umich.edu    - PowerModel: Represents a power model for a hardware component.
525643Sgblack@eecs.umich.edu
535643Sgblack@eecs.umich.edu    - PowerModelState: Represents a power model for a hardware component
545643Sgblack@eecs.umich.edu      in a certain power state. It is an abstract class that defines an
555643Sgblack@eecs.umich.edu      interface that must be implemented for each model.
565643Sgblack@eecs.umich.edu
575643Sgblack@eecs.umich.edu    - MathExprPowerModel: Simple implementation of PowerModelState that
585643Sgblack@eecs.umich.edu      assumes that power can be modeled using a simple power
595643Sgblack@eecs.umich.edu
605643Sgblack@eecs.umich.edu  Classes involved in the thermal model are:
615643Sgblack@eecs.umich.edu
625643Sgblack@eecs.umich.edu    - ThermalModel: Contains the system thermal model logic and state.
635643Sgblack@eecs.umich.edu      It performs the power query and temperature update. It also enables
645643Sgblack@eecs.umich.edu      gem5 to query for temperature (for OS reporting).
655643Sgblack@eecs.umich.edu
665643Sgblack@eecs.umich.edu    - ThermalDomain: Represents an entity that generates heat. It's
675643Sgblack@eecs.umich.edu      essentially a group of SimObjects grouped under a SubSystem component
685643Sgblack@eecs.umich.edu      that have its own thermal behaviour.
695643Sgblack@eecs.umich.edu
705643Sgblack@eecs.umich.edu    - ThermalNode: Represents a node in the thermal circuital equivalent.
715657Sgblack@eecs.umich.edu      The node has a temperature and interacts with other nodes through
725657Sgblack@eecs.umich.edu      connections (thermal resistors and capacitors).
736137Sgblack@eecs.umich.edu
746137Sgblack@eecs.umich.edu    - ThermalReference: Temperature reference for the thermal model
755643Sgblack@eecs.umich.edu      (essentially a thermal node with a fixed temperature), can be used
766136Sgblack@eecs.umich.edu      to model air or any other constant temperature domains.
775643Sgblack@eecs.umich.edu
785643Sgblack@eecs.umich.edu    - ThermalEntity: A thermal component that connects two thermal nodes
795643Sgblack@eecs.umich.edu      and models a thermal impedance between them. This class is just an
806139Sgblack@eecs.umich.edu      abstract interface.
816139Sgblack@eecs.umich.edu
825643Sgblack@eecs.umich.edu    - ThermalResistor: Implements ThermalEntity to model a thermal resistance
835643Sgblack@eecs.umich.edu      between the two nodes it connects. Thermal resistances model the
845643Sgblack@eecs.umich.edu      capacity of a material to transfer heat (units in K/W).
855643Sgblack@eecs.umich.edu
865643Sgblack@eecs.umich.edu    - ThermalCapacitor. Implements ThermalEntity to model a thermal
875643Sgblack@eecs.umich.edu      capacitance. Thermal capacitors are used to model material's thermal
885827Sgblack@eecs.umich.edu      capacitance, this is, the ability to change a certain material
895643Sgblack@eecs.umich.edu      temperature (units in J/K).
905643Sgblack@eecs.umich.edu
915643Sgblack@eecs.umich.edu  \section gem5_thermal Thermal model
925643Sgblack@eecs.umich.edu
935643Sgblack@eecs.umich.edu  The thermal model works by creating a circuital equivalent of the
945643Sgblack@eecs.umich.edu  simulated platform. Each node in the circuit has a temperature (as
955643Sgblack@eecs.umich.edu  voltage equivalent) and power flows between nodes (as current in a
965643Sgblack@eecs.umich.edu  circuit).
975643Sgblack@eecs.umich.edu
985643Sgblack@eecs.umich.edu  To build this equivalent temperature model the platform is required
995643Sgblack@eecs.umich.edu  to group the power actors (any component that has a power model)
1005643Sgblack@eecs.umich.edu  under SubSystems and attach ThermalDomains to those subsystems.
1015643Sgblack@eecs.umich.edu  Other components might also be created (like ThermalReferences) and
1025643Sgblack@eecs.umich.edu  connected all together by creating thermal entities (capacitors and
1035643Sgblack@eecs.umich.edu  resistors).
1045643Sgblack@eecs.umich.edu
1055643Sgblack@eecs.umich.edu  Last step to conclude the thermal model is to create the ThermalModel
1065643Sgblack@eecs.umich.edu  instance itself and attach all the instances used to it, so it can
1075643Sgblack@eecs.umich.edu  properly update them at runtime. Only one thermal model instance is
1085643Sgblack@eecs.umich.edu  supported right now and it will automatically report temperature when
1095643Sgblack@eecs.umich.edu  appropriate (ie. platform sensor devices).
1105643Sgblack@eecs.umich.edu
1115651Sgblack@eecs.umich.edu  \section gem5_power Power model
1125651Sgblack@eecs.umich.edu
1135651Sgblack@eecs.umich.edu  Every ClockedObject has a power model associated. If this power model is
1146136Sgblack@eecs.umich.edu  non-null power will be calculated at every stats dump (although it might
1156136Sgblack@eecs.umich.edu  be possible to force power evaluation at any other point, if the power
1166136Sgblack@eecs.umich.edu  model uses the stats, it is a good idea to keep both events in sync).
1175651Sgblack@eecs.umich.edu  The definition of a power model is quite vague in the sense that it is
1185651Sgblack@eecs.umich.edu  as flexible as users want it to be. The only enforced contraints so far
1195643Sgblack@eecs.umich.edu  is the fact that a power model has several power state models, one for
1205643Sgblack@eecs.umich.edu  each possible power state for that hardware block. When it comes to compute
1215643Sgblack@eecs.umich.edu  power consumption the power is just the weighted average of each power model.
1225651Sgblack@eecs.umich.edu
1235651Sgblack@eecs.umich.edu  A power state model is essentially an interface that allows us to define two
1245651Sgblack@eecs.umich.edu  power functions for dynamic and static. As an example implementation a class
1255651Sgblack@eecs.umich.edu  called MathExprPowerModel has been provided. This implementation allows the
1265651Sgblack@eecs.umich.edu  user to define a power model as an equation involving several statistics.
1275651Sgblack@eecs.umich.edu  There's also some automatic (or "magic") variables such as "temp", which
1285651Sgblack@eecs.umich.edu  reports temperature.
1295643Sgblack@eecs.umich.edu