Hi all,

I am running into a strange problem when simulating a C++ program in SE
mode. In short, when I comment a for loop in 1 of my function, gem5 works.
Otherwise, when I uncomment the for loop (the empty for loop, nothing in
the body) gem5 stucks after startup. It likes Gem5 cannot find where the
entry of the program is. I have a printf at the start and it does not print
out. Below I will provide more detail about my setup

Gem5 develop branch, commit 94d44ada63e217ae3d2a43a612622a0c46642206
> Host OS: Ubuntu 18.04
> Python: 3.8.8
> C++ compiler: aarch64-none-linux-gnu-g++ (GNU Toolchain for the A-profile
> Architecture 10.2-2020.11 (arm-10.16)) 10.2.1 20201103


The python config file: It's pretty long if I paste everything here.
Basically, it's just an AtomicSimpleCPU -> l2bus -> l2cache -> membus ->
mem_ctrl

C++ file: I simplify the file content and only show the part producing the
bug

// 8 * 8 bytes = 64 bytes in size
typedef struct {
    uint64_t number[8];
} LineSizedStruct;

alignas(64) LineSizedStruct data[129];

/******** The main actor here *******/
void random_latency_operation(LineSizedStruct block) {
    for (int i = 0; i < 8; ++i) {
        if (block.number[i] > 1) {
            uint64_t number = block.number[i] >> 25;
            int cap = (int) std::sqrt(number);

            /************ BUG PART ****************/
            for (int j = 1; j < cap; ++j) {
                // if (number / j == j) {
                //     // we just want the division operation, so we are
done
                //     break;
                // }
            }
           /******************************************/
        }
        block.number[i] = generate_random_uint64();
    }
}

int main(int argc, char const *argv[]) {
    printf("Hello world\n");

    // generate the data array with random number
    init_random_data();

    random_latency_operation(data[0]);

    return 0;
}

______
The compile command: aarch64-none-linux-gnu-g++ src/cache-stress.cc -o
bin/cache-stress -static
I highlight the for loop that produces the bug. When I comment that for
loop, everything is fine, but when I uncomment that for loop, Gem5 stuck
and can't execute the C++ program. The Hello world is never printed.

Does anyone know what happened?

Best regards,
Duc Anh
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to