Hi,

That’s indeed a large difference that looks more like a bug than anything else.

To (try) reproduce the bug, can you please provide us with the exact commit, 
build command and run command you are using?

A few possible causes of divergence are:

1. The random number generator, as suggested in the previous answer. I don’t 
think it is the case as the main gem5 random number generator is based on 
std::mt19937_64 which is deterministic for a given seed and the seed is picked 
deterministically in gem5 by default (it has been serving me just fine for a 
couple of years).

2. Relying on addresses to define order. This can occur, for instance, when 
storing pointers in a std::\[unordered_\]{map,set} with default comparison or 
hash functions that rely on the pointer value that itself depends on the memory 
allocator that gets its memory ranges from the OS.

3. Undefined behavior. This is the cursed benediction of unsafe languages like 
C and C++. A program with undefined behavior in it ***can*** lead to, well… 
undefined result. Most hidden undefined behaviors have benign consequences 
(that’s why they remain hidden) but one of the consequences is slightly 
different behavior of a program based on, among other things, the compiler and 
the optimization level. Compilers can do the assumption that undefined behavior 
never happens to perform clever deductions on the state of the program and 
perform killer optimizations. Depending on the smartness of the compiler you 
use (the one on the recent computer likely being smarter than the one on the 
older computer), you will get odd results.

Beug 2 can be found by running the same program with the same input several 
times with different optimization levels, compilers or host. It is also a good 
idea to load the host while running the program under test to increase system 
entropy and reduce the odds of always having the same addresses provided by the 
system.

For beug 3, it will likely suffice to run the program with and without 
optimization enabled (i.e., gem5.debug and gem5.opt).

In all cases, you should run the simulation with as many debug flags enabled as 
possible and compare the outputs. I recommend using

> colordiff -U 1000 <(simulation command 1) <(simulation command 2) | less -R

Best,

Gabriel
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to