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

[BUG] Spike version checks in regression scripts are unreliable #2110

Closed
1 task done
zchamski opened this issue May 14, 2024 · 2 comments
Closed
1 task done

[BUG] Spike version checks in regression scripts are unreliable #2110

zchamski opened this issue May 14, 2024 · 2 comments
Assignees
Labels
Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system

Comments

@zchamski
Copy link
Contributor

zchamski commented May 14, 2024

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

Verification script verif/sim/cva6.py performs version consistency checks on several tools including Spike. For Spike it compares the built-in version string based on the short Git hash (SHA1 checksum) against the short hash of the Spike source. There are three cases of false negatives in the current implementation of these checks:

  1. The short form of the hash has a length that is Git version-dependent. On RedHat Enterprise Linux, the short hash is 9 hex digits long whereas the built-in version string is built by fprintf-ing an unsigned integer (32 bits, 8 hex digits) thus causing the most significant digit to be truncated.
  2. The "hex number + fprintf" approach is not robust against leading zeroes in hash value.
  3. The use of "relative level-up" path (..) in git log invocations used to obtain the hash of the enclosing directory triggers a buggy behavior in Git: even when the .. is separated from commit-related information using a double dash (--), it gets interpreted as a commit-relative expression, yielding highly unexpected results.

Examples using 807ed7825 and openhwgroup/core-v-verif@8e8a63730, openhwgroup/core-v-verif@c98a21182:

  • point 1 - note the truncated leading 8 in the actual version string, even though the CFLAGS contain the correct value -DSPIKE_HASH_VERSION=0x8e8a63730:
$ bash verif/regress/smoke-tests.sh
...
Tue, 14 May 2024 15:15:40 ERROR    You are currently using version 1.1.1-dev e8a63730 of Spike, should be: 1.1.1-dev 8e8a63730. Please install or reinstall it with the installation script.
....
$ tools/spike/bin/spike -v
1.1.1-dev e8a63730
$
  • point 3 occurs only when the core-v-verif commit being used is a merge point (e.g., core-v-verif@c98a21182):
$ (cd verif/core-v-verif/vendor/riscv/riscv-isa-sim/build ; git log -1 --pretty=tformat:%h -- ..)
      1 8e8a63730
$ (cd verif/core-v-verif/vendor/riscv/riscv-isa-sim ; git log -1 --pretty=tformat:%h)
      1 8e8a63730
$ (cd verif/core-v-verif ; git checkout c98a21182)
Previous HEAD position was 8e8a63730 Revert "Implementation of Spike param via Yaml files"
HEAD is now at c98a21182 Merge pull request #2419 from ThalesSiliconSecurity/revert
$ (cd verif/core-v-verif/vendor/riscv/riscv-isa-sim/build ; git log -1 --pretty=tformat:%h -- ..)
      1 8e8a63730
$ (cd verif/core-v-verif/vendor/riscv/riscv-isa-sim ; git log -1 --pretty=tformat:%h)
      1 c98a21182
$ 
@zchamski zchamski added the Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system label May 14, 2024
@zchamski
Copy link
Contributor Author

The solution will require a coordinated modification of both repos: core-v-verif for Spike build, and cva6 to remove '..' from git log invocation.

@zchamski
Copy link
Contributor Author

Fixed in commit e6c3bac by aligning the behavior of Git hash extraction in Spike build inside core-v-verif and in verif/sim/cva6.py. From now on, the project-wide hash of core-v-verif is used on both sides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system
Projects
None yet
Development

No branches or pull requests

1 participant