Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing thread execution for RV32I #216

Open
kpgriesser opened this issue Nov 30, 2023 · 1 comment
Open

missing thread execution for RV32I #216

kpgriesser opened this issue Nov 30, 2023 · 1 comment
Assignees

Comments

@kpgriesser
Copy link
Collaborator

Describe the bug
A thread is never executed when attempting 3 threads on 2 harts using RV32I ISA. The test passes when there are 4 harts or when using 64-bit ISA.

To Reproduce

cd threading/pthreads/permute
make clean && make -j

All issues must be accompanied by:

  • The version of SST utilized (sst --version; sst-config --CXX; sst-config --ELEMENT_CXXFLAGS)
    SST-Core Version (13.0.0)
    clang++
    -std=c++17 -fPIC -DHAVE_CONFIG_H -I/Users/kgriesser/local/sstcore-13.0.0/include

  • The source code branch being used

  • The last commit hash
    2f2bda7 (HEAD -> devel, origin/devel

  • The compiler utilized to build Rev
    Apple clang version 15.0.0 (clang-1500.0.40.1)

  • The compiler utilized to build the test
    riscv64-unknown-elf-g++ (g2ee5e430018-dirty) 12.2.0

  • The python or JSON simulation input

  • C/CXX test source (or mention which test in the current source tree failed)
    See tests/threading/pthreads/permute

Expected behavior
No assertions

Trace

Passing case on RV64G

RevCPU[cpu0:ECALL_pthread_create:26000]: ECALL: pthread_create called by thread 1 on hart 0
RevCPU[cpu0:CreateThread:26000]: Creating new thread with PC = 0x14cf4
RevCPU[cpu0:ECALL_pthread_create:50000]: ECALL: pthread_create called by thread 1 on hart 0
RevCPU[cpu0:CreateThread:50000]: Creating new thread with PC = 0x14d4c
RevCPU[cpu0:ECALL_pthread_create:73000]: ECALL: pthread_create called by thread 1 on hart 0
RevCPU[cpu0:CreateThread:73000]: Creating new thread with PC = 0x14da4
RevCPU[cpu0:ECALL_pthread_join:89000]: ECALL: pthread_join called by thread 1 on hart 0

enter void *thread2()

RevCPU[cpu0:Render:91000]: Core 0; Hart 0; Thread 1857172069; *I 0x14d4c:fe010113 addi sp, sp, -32 0x3fdbeff7<-sp sp<-0x3fdbefd7

enter void *thread3()

RevCPU[cpu0:Render:226000]: Core 0; Hart 0; Thread 2961362521; *I 0x14da4:fe010113 addi sp, sp, -32 0x3fc7eff6<-sp sp<-0x3fc7efd6

enter void *thread1() <- GOOD (missing from failing case)

RevCPU[cpu0:Render:362000]: Core 0; Hart 1; Thread 2197699622; *I 0x14cf4:fe010113 addi sp, sp, -32 0x3fefeff8<-sp sp<-0x3fefefd8

wrote 0xa

RevCPU[cpu0:Render:484000]: Core 0; Hart 1; Thread 2197699622; *I 0x14d18:f6e1a023 sw a4, -160(gp) 0x193f0<-gp 0xa<-a4 [0x19350,4]<-0x0000000a
RevCPU[cpu0:ECALL_pthread_join:514000]: ECALL: pthread_join called by thread 1 on hart 0
RevCPU[cpu0:ECALL_pthread_join:530000]: ECALL: pthread_join called by thread 1 on hart 0
### Read 0xa ok
RevCPU[cpu0:Render:539000]: Core 0; Hart 0; Thread 1; *I 0x14e98:f601a783 lw a5, -160(gp) 0x193f0<-gp 0x0000000a<-[0x19350,4] a5<-0xa

PASSES

Failing case on RV32I

Notice that we never call the function 'void *thread1()'

RevCPU[cpu0:ECALL_pthread_create:25000]: ECALL: pthread_create called by thread 1 on hart 0
RevCPU[cpu0:CreateThread:25000]: Creating new thread with PC = 0x1462c
RevCPU[cpu0:ECALL_pthread_create:49000]: ECALL: pthread_create called by thread 1 on hart 0
RevCPU[cpu0:CreateThread:49000]: Creating new thread with PC = 0x14678
RevCPU[cpu0:ECALL_pthread_create:72000]: ECALL: pthread_create called by thread 1 on hart 0
RevCPU[cpu0:CreateThread:72000]: Creating new thread with PC = 0x146c4
RevCPU[cpu0:ECALL_pthread_join:88000]: ECALL: pthread_join called by thread 1 on hart 0

enter void *thread2()

RevCPU[cpu0:Render:90000]: Core 0; Hart 0; Thread 501234749; *I 0x14678:fe010113 addi sp, sp, -32 0x3fdbeff7<-sp sp<-0x3fdbefd7

enter void *thread3()

RevCPU[cpu0:Render:193000]: Core 0; Hart 0; Thread 331638285; *I 0x146c4:fe010113 addi sp, sp, -32 0x3fc7eff6<-sp sp<-0x3fc7efd6
RevCPU[cpu0:ECALL_pthread_join:312000]: ECALL: pthread_join called by thread 1 on hart 0
RevCPU[cpu0:ECALL_pthread_join:328000]: ECALL: pthread_join called by thread 1 on hart 0
### FAILS HERE
### read 0 instead of 0xa
RevCPU[cpu0:Render:337000]: Core 0; Hart 0; Thread 1; *I 0x147a8:c341a783 lw a5, -972(gp) 0x181f0<-gp 0x00000000<-[0x17e24,4] a5<-0x0

Additional context
Add any other context about the problem here.

@kpgriesser
Copy link
Collaborator Author

not sure if this is really just a 32-bit thing. The other 32-bit test cases pass so it may be exposing an edge case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants