umd-memsys / DRAMSim2

DRAMSim2: A cycle accurate DRAM simulator
http://www.ece.umd.edu/~blj/papers/cal10-1.pdf
255 stars 151 forks source link

simulation performance #46

Open wky opened 10 years ago

wky commented 10 years ago

Problem: running a simple profiler, I see that the program spends so much time in this function: unsigned dramsim_log2(unsigned) in SystemConfiguration.h

dramsim_log2 is used too frequently. For example, it is invoked 7 times in function addressMapping in AddressMapping.cpp, on variables that do not change at all during one simulation.

My suggestion:

  1. use __builtin_clz to calculate log2
  2. use pre-calculated log2 number in the program

Thanks

dramninjasUMD commented 10 years ago

I have been through DRAMSim2 with a not-so-simple profiler and I agree there are some pretty serious issues. At some point I was putting together a series of patches to try to cut out some of the more egregious inefficiencies. However, I got busy with my thesis and work and so they never made it to the light of day because I never quite got them working. I could push these unfinished patches, but I'm not sure anyone would want to take on the task of finishing them off ...

Do you know if there's a way to check if a builtin is supported by a compiler at compiletime? I don't want to add this in and then have it break builds for people using compilers other than some specific version of gcc.