chipsalliance / chipsalliance/riscv-vector-tests

Potential race conditions in both C testfloat3 and Go rand number generators

Open
#76 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
118
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I am seeing inconsistent `.quad` values between compilations, even though I use fixed seeds. The issue are race conditions caused by multiple goroutines accessing the shared number generator in different orders and resets in between.

What I think is happening:
Multiple goroutines call (indirectly via main) `testfloat3.InitF16()` , and that function calls srand(2024). At the same time, Go’s `genRandomData`() calls `rand.Seed(n)`.

Due to the parallelization of the loop with goroutines, these generators are reset and consumed simultaneously. The seeds are deterministic, but the access pattern is not, which leads to non deterministic sequences.

For context: I have customized the script to only test the "vd, vs2, vm" format, and I have added a few new instructions that do not have default test case values. So the source register data is completely random

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing main's goroutines into testfloat3.InitF16() and Go genRandomData(), focusing on their calls to srand(2024) and rand.Seed(n). Reproduce the inconsistent .quad values with the parallel loop and fixed seeds; done should establish deterministic generator behavior under the reported concurrent execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.