Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Libre-RISCV General Development <libre-riscv-dev@lists.libre-riscv.org>
Subject: Re: [libre-riscv-dev] Using formal to expose bugs in scoreboard
Date: Mon, 8 Jun 2020 10:40:27 +0100
Message-ID: <CAPweEDzJv5zevxpd_tz1soxMhv+1sPKnCFjKHYPMH36b1VNLEA@mail.gmail.com> (raw)
In-Reply-To: <E2E475D2-7421-4970-92BE-146FC5514AA5@gatech.edu>

On Mon, Jun 8, 2020 at 4:11 AM Yehowshua <yimmanuel3@gatech.edu> wrote:
>
> This error highlights the need for formal on the scoreboard.

this exact need was taken into consideration when the application for
NLNet Funding for the Formal Correctnes Proofs was made, a year ago.
https://bugs.libre-soc.org/show_bug.cgi?id=81

as it is critically important a budget of EUR 5,000 was allocated just
to this *one* task:
https://bugs.libre-soc.org/show_bug.cgi?id=197

michael began a Formal Correctness Proof for the MultiCompUnit on the
24th of May:
https://bugs.libre-soc.org/show_bug.cgi?id=342

that Correctness Proof is designed to complement the bugreport that
you referenced (see further below)
https://bugs.libre-soc.org/show_bug.cgi?id=336#c54

Samuel Falvo's work was what originally inspired us to use a hybrid
combination of "simple, clear, well-documented" unit tests plus
extensive Formal Correctness Proofs:
http://lists.libre-riscv.org/pipermail/libre-riscv-dev/2019-August/002311.html

although i cannot find the original discussion, it is elsewhere on the
internet several months prior to the Aug 2019 discussion, Samuel's
insights showed us that writing comprehensive Unit Tests simply does
not catch everything, and even if efforts are made to try to do so the
sheer quantity of code involved masks errors, distracts from the
actual code being tested, and doesn't catch all errors anyway.

the IEEE754 FPU tests are a good example.  this is the basic
infrastructure that allows hundreds of thousands of random and
regression tests to be called:
https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/fpcommon/test/case_gen.py;hb=HEAD
https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/fpcommon/test/fpmux.py;hb=HEAD

and each pipeline then contains sometimes up to 10 separate unit tests
to cover different aspects:
https://git.libre-soc.org/?p=ieee754fpu.git;a=tree;f=src/ieee754/fpdiv/test;hb=HEAD
https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/fpmax/test/test_fpmax_pipe.py;hb=HEAD
https://git.libre-soc.org/?p=ieee754fpu.git;a=tree;f=src/ieee754/fpadd/test;hb=HEAD
https://git.libre-soc.org/?p=ieee754fpu.git;a=tree;f=src/ieee754/fpcmp/test;hb=HEAD

none of which *actually* gives us full confidence in the code, despite
taking a week to run even on the fastest modern machines available.
many of the errors during the 6+ month development of the IEEE754 FPU
code were only caught by running well over 100,000 random tests on the
code when parameterised down to FP16.

with only 65536 possible values in FP16, this gave a high probability
that corner-cases would be caught, and in some cases (single parameter
rather than two 2^16 parameters) allows for full coverage.


therefore, yes: the idea has always been to follow this step-by-step
process, for *all* code:

1) write the code and a basic "understanding" unit test infrastructure
sufficient to get the code functional
2) write Formal Correctness Proofs that catch errors
3) write *SIMPLE* unit tests that in no way cover the entirety of the
code: their purpose is as a *tutorial* and example of how to use the
code.

good examples of (3) when it comes to the pipeline API are here:
https://git.libre-soc.org/?p=nmutil.git;a=blob;f=src/nmutil/test/test_buf_pipe.py;hb=HEAD
https://git.libre-soc.org/?p=nmutil.git;a=blob;f=src/nmutil/test/test_inout_mux_pipe.py;hb=HEAD

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08  3:11 Yehowshua
2020-06-08  3:18 ` Yehowshua
2020-06-08  9:40 ` Luke Kenneth Casson Leighton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPweEDzJv5zevxpd_tz1soxMhv+1sPKnCFjKHYPMH36b1VNLEA@mail.gmail.com \
    --to=lkcl@lkcl.net \
    --cc=libre-riscv-dev@lists.libre-riscv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Libre RISC-V Mailing list Archives (accessible via public-inbox)

Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev

Example config snippet for mirrors


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git