riscv-non-isa/riscv-arch-test

test signatures

Closed this issue Β· 37 comments

I'm new to this repo, and failed to find the tests signatures, results. I think these were provided at some point .. What do I check/compare with my run results?

Test signatures are now generated dynamically by the riscof test framework, based on the specific configuration of your hart, which is described by a riscv-config YAML formatted file. This enables a single set of test to be run regardless of the architectural options supported by your hart (for the basic RV32I/RV64I ISA, that's mostly just HW misalign support)

The short form is that riscof selects, configures, and runs tests based on the config file on both the Sail formal model, and on your hart, and compares the results.

Riscv-config is described by the documentation here: https://github.com/riscv-software-src/riscv-config
Riscof is described by the documentation here:https://github.com/riscv-software-src/riscof

Hi @allenjbaum
Is there a step-by-step guide tutorial showing all stages required

  • packages to install
  • repositories to clone
  • execution flow

In order to get to the point where a set of programs and signatures are available to run on the RTL

what privileges are required for the above steps, many professional companies will not provide the users with root level privileges to perform these tasks where programs/packages are installed globally

Also, is there any document detailing which devices have so far successfully run through the process, and are allowed to use the logo indicating compliance with the tests

Hi @eroom1966, Riscof documentation (available here) is comprehensive, and contains a quick start guide which will give you a step by step instruction to set up the tools, configure a project, set up DUT and ref (Sail), run basic tests, and explain the execution flow.
For most of the packages, root/privilege access will not be needed. If you follow the quick start procedure, you will be able to run tests easily without having any trouble of privilege access.

Here is a simple port of the RISCOF framework I made for a custom RISC-V core: https://github.com/stnolting/neorv32-riscof

Maybe this can be helpful for you to get started πŸ˜‰

BTW, is this repo the "official RISCV compliance test" suit ?
what is the status of this repo: https://github.com/riscv-software-src/riscv-tests ?

Honestly, this new RISCOF framework is pretty troublesome from installation point of view. It would be much easier for users like me to have self-checking tests, containing predicted results, at least for user spec instructions, which is not that hard to create.
I understand , that it is more difficult to provide privileged spec tests results and it's much easier for creators to rely on the framework, but this is not such for users of this repo. I would like you guys to take better care of your clients ...

I think you just answered your own question.
Yes, we could (usually) have tests for the bare user mode stuff - but there will be very, very few implementations that don't use the priv spec. And once you're committed to that, self testing goes out the window, and the cost of also doing unpriv is negligible. But, just the existence of Zicsr (which is required for several unpriv extensions) and the open-ended definition of a WARL field makes self-checking difficult.

But even the simplest unpriv tests (load, store) can't have precomputed signatures, because misaligned accesses can be handled either in hardware or by trap and emulate - and in the general case it is not possible to know which.
Welcome to our world.

We are moving to get the installation to be much easier. Marc's repo is one step. We also intend to have a "Reference signature as a Service" implementation, which will make getting those reference signatures a much simpler process.
All of this depends on the kindness of volunteers to implement. If you want to throw a pile of money at RVI to speed this up, it probably could be.

Allen, thanks for explanation, our main obstacle is reluctance of IT to install all these service packages. I couldn't make them to install opam, for example . Another roadblock is Linux versions. We have 7.x something and there is no way I can make them to switch to something more modern.
Can you consider to use some more common tools and not the latest and greatest?

Allen, Marc,
Thanks again for your responses.

  1. Marc, I did not try your repo - I'm not IT person and have no permissions/knowledge to install anything on company servers. I referred opam as I had installation problems with it in another company for litmus tests evaluation. IT couldn't install it due older Linux version.

  2. Allen, what is approximate time frame, when this service be available?

  3. could the test suite run against spike step by step locally be considered as compliance certification ?

A few comments:

we have spike and riscv tools as part of GCC compiler , installed already.
We do run your tests in our DV environment, and compare DUT instruction trace with spike trace, or compare CPU state at every instruction commit with spike during simulation.
Can we be certified with such approach?

BTW, what's ACT?

Just tryied to install riscof:
"
% pip3 install git+https://github.com/riscv/riscof.git
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/riscv/riscof.git
Cloning https://github.com/riscv/riscof.git to /tmp/pip-req-build-nqqyryar
Running command git clone --filter=blob:none --quiet https://github.com/riscv/riscof.git /tmp/pip-req-build-nqqyryar
/grid/common/pkgs/git/v2.30.0/libexec/git-core/git-remote-https: /grid/common/pkgs/openssl/v1.0.2h/lib/libcrypto.so.1.0.0: no version information available (required by /lib64/libldap-2.4.so.2)
/grid/common/pkgs/git/v2.30.0/libexec/git-core/git-remote-https: /grid/common/pkgs/openssl/v1.0.2h/lib/libcrypto.so.1.0.0: no version information available (required by /lib64/libldap-2.4.so.2)
/grid/common/pkgs/git/v2.30.0/libexec/git-core/git-remote-https: /grid/common/pkgs/openssl/v1.0.2h/lib/libssl.so.1.0.0: no version information available (required by /lib64/libldap-2.4.so.2)
/grid/common/pkgs/git/v2.30.0/libexec/git-core/git-remote-https: /grid/common/pkgs/openssl/v1.0.2h/lib/libcrypto.so.1.0.0: no version information available (required by /lib64/libldap-2.4.so.2)
/grid/common/pkgs/git/v2.30.0/libexec/git-core/git-remote-https: /grid/common/pkgs/openssl/v1.0.2h/lib/libcrypto.so.1.0.0: no version information available (required by /lib64/libldap-2.4.so.2)
/grid/common/pkgs/git/v2.30.0/libexec/git-core/git-remote-https: /grid/common/pkgs/openssl/v1.0.2h/lib/libssl.so.1.0.0: no version information available (required by /lib64/libldap-2.4.so.2)
Resolved https://github.com/riscv/riscof.git to commit 4f8b28afb60bf55fdc1bf22b3e8ec146dc14e6cd
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

Γ— python setup.py egg_info did not run successfully.
β”‚ exit code: 1
╰─> [1 lines of output]
ERROR: Can not execute setup.py since setuptools is not available in the build environment.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Γ— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: There was an error checking the latest version of pip.
"
here our python versions:

% python --version
Python 3.7.0
% pip3 --version
pip 22.1 from /grid/common/pkgsData/python-v3.7.0/Linux/RHEL6.0-2013-x86_64/lib/python3.7/site-packages/pip (python 3.7)

what's wrong?

pawks commented

Looks like you are installing from git. In which case there is an inherent requirement for the setup tools package to be installed. You will need to run the following command to support installing from source directly:

pip3 install setuptools

PS - The recommended method of installing packages for users is from the pypi directly. I would advise you to use that if possible. You can install riscof using the command: pip3 install riscof

great!
got this:
% pip3 install riscof
Defaulting to user installation because normal site-packages is not writeable
Collecting riscof
Downloading riscof-1.25.2-py2.py3-none-any.whl (45 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.2/45.2 kB 2.2 MB/s eta 0:00:00
Collecting pytz>=2019.1
Downloading pytz-2022.5-py2.py3-none-any.whl (500 kB)

....
Collecting Cerberus>=1.3.1
Downloading Cerberus-1.3.4.tar.gz (63 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.8/63.8 kB 2.6 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

Γ— Preparing metadata (pyproject.toml) did not run successfully.
β”‚ exit code: 1
╰─> [65 lines of output]
running dist_info
creating /tmp/pip-modern-metadata-oebx0euy/Cerberus.egg-info
writing /tmp/pip-modern-metadata-oebx0euy/Cerberus.egg-info/PKG-INFO
....

end of log:
File "/tmp/pip-build-env-bkc4337g/overlay/lib/python3.7/site-packages/wheel/macosx_libfile.py", line 41, in
import ctypes
File "/grid/common/pkgsData/python-v3.7.0/Linux/RHEL6.0-2013-x86_64/lib/python3.7/ctypes/init.py", line 7, in
from _ctypes import Union, Structure, Array
ImportError: libffi.so.7: cannot open shared object file: No such file or directory
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Γ— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: There was an error checking the latest version of pip.

pawks commented

Looks like a missing dependency(libffi). You could install it using: yum install libffi or yum install libffi-devel.

% yum install libffi
Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify, versionlock
Loading support for Red Hat kernel ABI
You need to be root to perform this command.

Seems there is an installation problems here for multiuser corporate environments. Your stuff is working relatively well for single users environments , like personal Ubuntu. But how do I convince IT of the company to go through all this hassle to upgrade Linux to the state required for your tools? They keep Linux common for all users, which may not want any changes in the OS.

It should be some way to provide pretty confined tools, won't require such drastic measures. (maybe, Perl based, which works everywhere)..

why one needs to reinstall corporate OS to compile and run a few tests?

speaking of which .. Allen, Marc, could you help to certify SweRV EL2?
https://github.com/chipsalliance/Cores-SweRV-EL2
this is simple M-mode rv32imc core, opensource, can run with free tools (verilator) or with Cadence, Synopsys or Mentor simulators. It has simple Demo TB to run a few tests
I think, step by step guide /report how to run your compliance on this design. could be beneficial for future users ...

I think @algrobman has underlined a real problem here.
I work with a lot of corporate CAD/IT departments, It is always difficult getting corporate wide installations through these groups.
In my experience none of these groups I have worked with would be prepared to go through the trial/error process we are seeing unfold here.

Either everything in the flow needs to be reproducible with user level permissions, OR, a well defined description of what needs to be installed- prior to installing the tools required to use this flow.

It seems implausible to me, that an approach of trial/error would be acceptable to a corporate CAD group

I am truly sorry if this sounds difficult to hear by those who have architected this system, I don’t underestimate the amount of effort expended, but I believe we have to deal with the world (and corporate CAD/IT groups!) as it is, not how we would like it to be.

I have a few follow up questions.

  1. what is legality of this repo? How a user can be sure that this repo represents official view of RISCV International or riscv.org? I couldn't find any reference of this repo on their web site. Google search brings multiple "compliance tests suits" repos - all with different tests ...
  2. How can a user trust the software from this and any referred sites in sense of cyber security? (are all these required installations spyware free? (what if "Russian hackers", disguised as Czechs, had planted a spyware, will steal my company tread secrets 😊 ?
    We just got a corporate email, warning from installing SW on our computers by ourselves ...

regarding Lee's comment , I'm not sure I can convince our IT or even guide them with all these installations ... In best case they will just give up after a few attempts ...

You guys better provide some self contained solution, if you want be essential part of the RISCV industry proliferation process.
Again, at least user ISA spec tests can be self-checking so community could certify at least non-privileged part of their designs

Marc, thanks for all your help .

Thanks guys again. I'd figured out how to run your tests in self-checking mode - appears the run instruction macros have predicted value. With custom "plugin" macro I could make the test "fail" if there is a result mismatch.

pawks commented

Thanks guys again. I'd figured out how to run your tests in self-checking mode - appears the run instruction macros have predicted value. With custom "plugin" macro I could make the test "fail" if there is a result mismatch.

Those values are just place holders and not to be relied upon, examples - (link1), (link2).

@algrobman can this issue be closed?

yes, I was able to get what I needed, at least for "integer" tests (have no need in F/D tests for now), but will really appreciate if you could "return" self-checking capability to the suite ( may be excluding CSRs issues)

We have never had self checking tests.
We have tests that put expected results in comments, but that isn't my definition of self checking.
And that doesn't always work because too many instructions have results dependent on microarchitecture, or the exact unnamed architectural options that are implemented (load and store ops are the poster child for that).
We will have some self checking tests in extraordinary circumstances (e.g. when we have results that are restricted non-deterministic), but that support hasn't been implement yet (it's a bit tricky)
Because there are many tests that won't have a single unique expected result, we instead get it from running a reference model configured with the same unnamed architectural options as your DUT.
While there are tests that do have deterministic results, but we are not going to implement two different ways to do the compatibility checks.