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

Implement specialized posit<16,2> sub, mul, div #404

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

davidmallasen
Copy link
Contributor

Following issue #343 I implemented the specialized posit<16,2> sub, mul and div operations. Now addition, subtraction and multiplication are passing the exhaustive tests, but division is not working 100% and I can't seem to see why.

@Ravenwater Ravenwater merged commit 7c420ec into stillwater-sc:v3.74 Dec 21, 2023
1 check passed
@Ravenwater
Copy link
Contributor

Looks like we are not yet handling the geometric regimes correctly:

Manual exhaustive div
FAIL
8.5265128291212022305e-14 /                       128 != 2.2204460492503130808e-16 golden reference is 8.8817841970012523234e-16
    0b0.000000000001.00.1 /     0b0.110.11.0000000000 !=     0b0.00000000000001.0. golden reference is     0b0.00000000000001.1.
FAIL
8.5265128291212022305e-14 /                      -128 != -2.2204460492503130808e-16 golden reference is -8.8817841970012523234e-16
    0b0.000000000001.00.1 /     0b1.110.11.0000000000 !=     0b1.00000000000001.0. golden reference is     0b1.00000000000001.1.
FAIL
1.7053025658242404461e-13 /                       256 != 2.2204460492503130808e-16 golden reference is 8.8817841970012523234e-16
    0b0.000000000001.01.1 /     0b0.1110.00.000000000 !=     0b0.00000000000001.0. golden reference is     0b0.00000000000001.1.
FAIL
1.7053025658242404461e-13 /                      -256 != -2.2204460492503130808e-16 golden reference is -8.8817841970012523234e-16
    0b0.000000000001.01.1 /     0b1.1110.00.000000000 !=     0b1.00000000000001.0. golden reference is     0b1.00000000000001.1.
FAIL
3.4106051316484808922e-13 /                       512 != 2.2204460492503130808e-16 golden reference is 8.8817841970012523234e-16
    0b0.000000000001.10.1 /     0b0.1110.01.000000000 !=     0b0.00000000000001.0. golden reference is     0b0.00000000000001.1.
FAIL
3.4106051316484808922e-13 /                      -512 != -2.2204460492503130808e-16 golden reference is -8.8817841970012523234e-16
    0b0.000000000001.10.1 /     0b1.1110.01.000000000 !=     0b1.00000000000001.0. golden reference is     0b1.00000000000001.1.
FAIL
6.8212102632969617844e-13 /                      1024 != 2.2204460492503130808e-16 golden reference is 8.8817841970012523234e-16
    0b0.000000000001.11.1 /     0b0.1110.10.000000000 !=     0b0.00000000000001.0. golden reference is     0b0.00000000000001.1.

I'll try to RCA

@Ravenwater Ravenwater self-assigned this Dec 21, 2023
@Ravenwater
Copy link
Contributor

A small randomized subset loves you

Fast specialization posit<16,2>: report test cases
 posit< 16,2> useed scale     4     minpos scale        -56     maxpos scale         56  :  0

Special case tests
posit< 16, 2> Initialize to zero:            PASS
posit< 16, 2> Initialize to NAN              PASS
posit< 16, 2> Initialize to INFINITY         PASS
posit< 16, 2> sign is true                   PASS
posit< 16, 2> is negative                    PASS
posit< 16, 2> sign is false                  PASS
posit< 16, 2> is positive                    PASS
posit< 16, 2>                                                addition       PASS
posit< 16, 2>                                                subtraction    PASS
posit< 16, 2>                                                multiplication PASS
posit< 16, 2>                                                division       PASS
Fast specialization posit<16,2>: PASS

@Ravenwater
Copy link
Contributor

And the exhaustive add does too

posit addition validation: results only
posit<8,0>                                                   addition PASS
posit<16,2>                                                  addition PASS
posit addition validation: PASS

Ravenwater added a commit that referenced this pull request Jan 3, 2024
* Bumping SEMVER to v3.74.1

* removing extraneous function

* adding QSNR to the benchmarking

* adding range reporting for the Scalar type

* adding elastic integer traits to try to disambiguate type_tag (not entirely successful yet)

* compilation fix for gcc and clang

* streamlining elastic binary integer API test

* renaming Adaptive to Elastic

* expanding QSNR experiment to sample across multiple sets

* generalizing qsnr as a service

* adding is_subnormal() attribute method

* specialized posit<16,2> engineering

* redefining nibble markers to be 0-based

* WIP: fast posit<16,2> addition

* restructuring specialized posits test infrastructure

* adding a posit oracle as a separate data type to be used to validate specialized posits

* adding a arithmetic debug test

* Implement specialized posit<16,2> addition (#403)

* rearchitecting the regression test suite to have a universal number system check

* cleaning up include file dependencies

* bug fix in the argument order of ReportBinaryArithmeticError as called in the posit test suite

* WIP: bug fixes for add/sub, not quite there yet

* compilation fix for gcc and clang

* WIP: fast posit<16,2> subtraction checks

* Implement specialized posit<16,2> sub, mul, div (#404)

Div is not working 100% yet

* enabling the regression level 1 again in specialized posit<16,2> while we are RCAing the div on extreme regime values

* bug fix and reporting improvement of posit randoms

* WIP: cleaning up posit<16,1> and posit<16,2>

* adding a math library to the posito oracle so we can use it to compare native implementations

* WIP: building test infrastructure to RCA specialized posit implementations

* WIP: RCAing specialized posit<16,2> divide operator

* adding multiplication tests for specialized posits

* WIP: code hygiene for old posit code

* WIP: redoing the fast posit<16,2> arithmetic operators

* restoring the multiplication operator algorithm

* configuring a regression test for fast posit multiplication

* configuring a regression test for fast posit addition

* test name edit

* configuring a regression test for fast posit division: not enabled yet

* adding a regression suite for fast posit subtraction

* code hygiene for old posit code

* bug fix in fast posit<32,2> that code hygiene activities had introduced

* WIP: fixed bugs in regime and exponent fields for fast posit<16,2>, rounding still buggy

* bug fix of bitnplusone calculation in divround of posit<16,2>

* code hygiene posit<32,2>

* bug fix div operator for fast posit<16,2>

* adding new posit attribute functions: maxprecision_max/min, this is the largest value of Regime 0, and the smallest value of Regime -1

* adding full regression results for reference

---------

Co-authored-by: David Mallasén Quintana <[email protected]>
@davidmallasen davidmallasen deleted the davidmallasen-v3.74 branch February 2, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants