I dont understand the code completely, so I'll try and answer as much as I can. Rick, maybe you could help me out here.
As I understand it, the code is not very modular. (written entirely in C) There is 1 file called power.c which does all the power calculations. It requires counters to be updated whenever any accesses are made in the CPUS or memory. Here is a snippet of some of the functions declared in power.h: ***** void init_power(void); void cleanup_power(void); void clear_access_stats(void); void update_power_stats(void); void print_dynamic_power_cc3 (void); void set_power_status (int coreid, int status); int get_power_status (int coreid); ***** and some of the counters defined in power.c ***** counter_t * regfile_access; counter_t * icache_access; counter_t * dcache_access; counter_t * alu_access; counter_t * ialu_access; counter_t * falu_access; counter_t * resultbus_access; counter_t * window_selection_access; counter_t * window_wakeup_access; ***** It is these counters which are incremented at appropriate times in the various O3 files (*_impl.hh). And then the power routines are called every cycle to evaluate power in the blocks which actually computed something (I assum this is how wattch is built). These counters currently are just declared as * extern * in the O3 files which use them. I dont have the time to move all this code to python. Currently its working for 1 core when I define all the simulation parameters in the power_def file manually like: #define CoreCount 1 #define MEM_L2_BLOCK_BYTES 64 //Caches.py #define MEM_L2_SIZE_KB 1024 //Caches.py I want to link these to the corresponding ones in M5 (CoreCount == numcpus) dynamically. Is there a way to do this? The code cares about the implementation details of individual cores since it calculates power at a fine granularity (cache lines, sense amps, clock power). I would like to also make it work for cores > 1. Can you suggest of a good way to decouple power calculations per core, given the code as is. Maybe the SimObject for the power model would be best? Sorry if all this looks confusing. As I said I have just started looking at this code and dont know much about it. Rick has more experience with it and he originally did the loose integration in M5 beta 4. - Sujay ----- Original Message ----- From: "Steve Reinhardt" <[EMAIL PROTECTED]> To: "M5 users mailing list" <[email protected]> Sent: Monday, June 23, 2008 2:22 PM Subject: Re: [m5-users] get python values into c files > I'm not familiar with the details of wattch, so I'll have to ask as > many questions as I answer here... > > How frequently are the computations in power.c performed? If they're > infrequent, you could move all that code into python where it would > have direct access to the python parameters. > > How modular is the power code? It seems inelegant that the > system-level power model would care about the implementation details > of the individual cores. If there was a way for each SimObject to own > its own little piece of the power model, then finding the parameters > should be easy... the CPU knows how big its LSQ is, the problem is in > getting that information out of the CPU model when not every CPU has > an LSQ. Similarly the System object knows how many CPUs there are in > that system, so if you can do the system-level power modeling right > there (or in a subordinate object) then it shouldn't be hard. Note > that when you're doing multi-system simulations you probably don't > want to roll up the power consumption across all the systems, since > some of the systems are just drivers to create traffic for the system > under test. > > As a last resort you could create a SimObject just for the power model > and then have the python pass the needed params in (you could probably > even set the python up to grab all those param values > semi-automatically) but the more I think about it that seems to be a > cop-out relative to having the power model itself be more modular. > But given the state of the existing code and your time constraints it > might be your best course of action. > > Steve > > On Mon, Jun 23, 2008 at 9:26 AM, Sujay Phadke <[EMAIL PROTECTED]> > wrote: >> Thanks Gabe and Steve for your suggestions. What I am trying to do is >> integrated wattch in M5 beta 5, using Rick Strong's basic code. >> >> It consists of a lot of counters integrated into various O3 >> implementation >> files (*_impl.hh), mem/cache/cache_impl.hh and calling the power >> calculations routines from power.c in simulate.cc He used a separate >> definitions files in which he defined the constants used for simulation >> (say >> numcpus or memory size), since his code did not have any hooks to get the >> information from python. >> >> for example: I would need to access to various system parameters - say >> the >> value of numcpus supplied at runtime, the value of memory size, etc. >> These >> are specified by the user using the config script and I assume some >> SimObject is created for the at runtime. Some other things like lsq_size >> are >> defined in O3CPU.py and I would need to access it. >> >> Currently the values are obtained by using a #include<> (in each of those >> files above) to include the file which has these parameters defined. So >> everytime we change a simulation parameter, this file has to be edited >> manually. >> >> So what would be the best way of going about this? >> >> Secondly, is this the best way of integrating wattch into M5? (modifying >> all >> the files I mentioned above). Or can you suggest a more cleaner approach >> that would work for all CPU models. >> >> Thanks, >> Sujay > _______________________________________________ > m5-users mailing list > [email protected] > http://m5sim.org/cgi-bin/mailman/listinfo/m5-users > _______________________________________________ m5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
