Closed s117 closed 4 years ago
602.gcc_s_ref also has this issue (compiled by the same toolchain)
$ spike -m8192 pk -c sgcc_base.riscv-m64 gcc-pp.c -O5 -fipa-pta -o gcc-pp.opts-O5_-fipa-pta.s
Requesting target memory 0x200000000
******* Resetting core **********
****Initializing the processor system****
******* Resetting core **********
******* Resetting core **********
****Initialization complete****
bad syscall array_size 1063 #179->0!
cycle = 334397
instret = 334404
******* Resetting core **********
A call path to sysinfo()
in 435.gromacs:
6. __sysinfo()
5. __get_phys_pages()
4. __sysconf()
3. __qsort_r()
2. qsort()
1. init_constraints() cpu2006/benchspec/CPU2006/435.gromacs/build/build_base_riscv.0000/constr.c:512
A call path to sysinfo()
in 602.gcc:
6. __sysinfo()
5. __get_phys_pages()
4. __sysconf()
3. physmem_total() cpu2017/benchspec/CPU/602.gcc_s/build/build_base_riscv-m64.0000/physmem.c:87
2. init_ggc_heuristics() cpu2017/benchspec/CPU/602.gcc_s/build/build_base_riscv-m64.0000/ggc-common.c:783
1. toplev_main() cpu2017/benchspec/CPU/602.gcc_s/build/build_base_riscv-m64.0000/toplev.c:1740
made a sys_info() implementation in https://github.com/s117/riscv-pk/commit/ce00ace5e43ca270327585645ccb30edfcd60ea3
Prototype:
struct sysinfo {
__kernel_long_t uptime; /* Seconds since boot */
__kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */
__kernel_ulong_t totalram; /* Total usable main memory size */
__kernel_ulong_t freeram; /* Available memory size */
__kernel_ulong_t sharedram; /* Amount of shared memory */
__kernel_ulong_t bufferram; /* Memory used by buffers */
__kernel_ulong_t totalswap; /* Total swap space size */
__kernel_ulong_t freeswap; /* swap space still available */
__u16 procs; /* Number of current processes */
__u16 pad; /* Explicit padding for m68k */
__kernel_ulong_t totalhigh; /* Total high memory size */
__kernel_ulong_t freehigh; /* Available high memory size */
__u32 mem_unit; /* Memory unit size in bytes */
char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */
};
int sysinfo(struct sysinfo *info);
https://github.com/s117/riscv-gnu-toolchain/blob/9.2.0_anycore/linux-headers/include/linux/sysinfo.h
The implementation above has 2 limitations:
procs
) is hard-coded.loads[]
) are always 100%The field it returns:
uptime
- rdcycle() / CLOCK_FREQ
totalram
- total physical memoriesfreeram
- unpopulated physical memoriessharedram
- physical memories populated for kernelbufferram
, totalswap
, freeswap
, totalhigh
, freehigh`.mem_unit
(the size unit is always a byte).Finished 435.gomacs_ref
and three 602.gcc_s_ref
runs with this sys_info().
$ spike -m2048 pk -c ./gromacs_base.riscv -silent -deffnm gromacs --nice 0
Requesting target memory 0x80000000 * Resetting core ** Initializing the processor system * Resetting core ** * Resetting core ** Initialization complete cycle = 1585954559665 instret = 1585954559672 * Resetting core **
- 602.gcc_s_1_ref
$ spike -m8192 pk -c sgccbase.riscv-m64 gcc-pp.c -O5 -fipa-pta -o gcc-pp.opts-O5-fipa-pta.s
Requesting target memory 0x200000000 * Resetting core ** Initializing the processor system * Resetting core ** * Resetting core ** Initialization complete gcc-pp.c: In function 'fibheap_delete_node': gcc-pp.c:19958:49: warning: overflow in implicit constant conversion gcc-pp.c: In function 'htab_mod_1': gcc-pp.c:25469:7: warning: right shift count >= width of type cycle = 1212891878504 instret = 1212891878511 * Resetting core **
- 602.gcc_s_2_ref
$ spike -m8192 pk -c sgccbase.riscv-m64 gcc-pp.c -O5 -finline-limit=1000 -fselective-scheduling -fselective-scheduling2 -o gcc-pp.opts-O5-finline-limit1000-fselective-scheduling_-fselective-scheduling2.s
Requesting target memory 0x200000000 * Resetting core ** Initializing the processor system * Resetting core ** * Resetting core ** Initialization complete gcc-pp.c: In function 'fibheap_delete_node': gcc-pp.c:19958:49: warning: overflow in implicit constant conversion gcc-pp.c: In function 'htab_mod_1': gcc-pp.c:25469:7: warning: right shift count >= width of type cycle = 627943375374 instret = 627943375381 * Resetting core **
- 602.gcc_s_3_ref
$ spike -m8192 pk -c sgccbase.riscv-m64 gcc-pp.c -O5 -finline-limit=24000 -fgcse -fgcse-las -fgcse-lm -fgcse-sm -o gcc-pp.opts-O5-finline-limit24000-fgcse-fgcse-las-fgcse-lm_-fgcse-sm.s
Requesting target memory 0x200000000 * Resetting core ** Initializing the processor system * Resetting core ** * Resetting core ** Initialization complete gcc-pp.c: In function 'fibheap_delete_node': gcc-pp.c:19958:49: warning: overflow in implicit constant conversion gcc-pp.c: In function 'htab_mod_1': gcc-pp.c:25469:7: warning: right shift count >= width of type cycle = 609629732065 instret = 609629732072 * Resetting core **
Will update the submodule when all the missing syscalls are provided.
Commit d0401da incorporated this patch.
Binary is compiled by https://github.com/s117/riscv-gnu-toolchain/commit/d0bdaa9a282a32cc68e6203098dc1162021ceba7
syscall 179 corresponds to sys_info, as defined here: https://github.com/s117/riscv-gnu-toolchain/blob/d0bdaa9a282a32cc68e6203098dc1162021ceba7/linux-headers/include/asm-generic/unistd.h#L506