Passiflora critique

Message boards : Science : Passiflora critique
Message board moderation

To post messages, you must log in.

1 · 2 · 3 · Next

AuthorMessage
k29000
Volunteer developer
Volunteer tester

Send message
Joined: 30 Apr 19
Posts: 48
Credit: 587,783
RAC: 446
Message 4510 - Posted: 18 Oct 2026, 20:17:23 UTC
Last modified: 18 Oct 2026, 20:39:49 UTC

This code lies in a very strange area. It uses floating-point arithmetic not to approximate an answer, but to exploit a particular rounding event as an algorithmic operation. The rounding trick, (x*qi + M) − M, turns a floating-point quotient estimate into an integer quotient, so values can be reduced modulo q efficiently. This works only when the numbers stay below known size bounds and the arithmetic rounds to the nearest value with no extra precision. These have not been calculated by hand, and really should be. It also needs the compiler to leave the expression alone.

The danger is not ordinary numerical inaccuracy. It is an incorrect residue, or a mistaken branch decision, that makes a valid polynomial appear to have character −1 and be rejected. The filter may only reject what it is certain would fail, so a wrong rejection loses a valid result.

For the CPU build, the developers choose the compiler, optimisation flags, target instruction set and floating-point options. Volunteers run the prebuilt binary.

The GPU side is less under the developers' control. For OpenCL, the kernel is shipped as source and compiled by the volunteer's own driver, so the project cannot fix the compiler, its version or the hardware. A driver update can change the generated code. CUDA and MUSA are compiled in advance, so less is left to the volunteer's machine.

The OpenCL specification helps, though. On full-profile devices, single-precision addition, subtraction and multiplication are required to be correctly rounded, with round-to-nearest-even as the default. The relaxed-math build options are off by default but are documented as able to break numerical compliance. The project passes none of them. So a driver that folded the trick away would be non-conformant or buggy.

A wrong rejection could happen in the following circumstances:

1. The compiler changes the arithmetic. It simplifies (x*qi + M) − M and removes the rounding step. In testing, -0fast broke the trick, but the filter then simply stopped rejecting, which is safe. For OpenCL this needs a non-conformant driver.

2. Extra precision or the wrong rounding mode. Extended precision (old x87, 32-bit x86) stops the constant from rounding the quotient to an integer, and valid candidates were lost in simulated testing. Rounding up also caused wrong rejections. Rounding down or toward zero only switched the filter off. Nothing in the project changes the mode but it is hypothetically changeable

3. A zero is mistaken for a nonzero value. This is the mechanism behind the round-up failures. A true zero comes back as ±q, the /= 0 check misses it, and the program follows the generic Euclid chain when it should switch to the general routine.

4. The values exceed the size bounds. The reduction trick is only exact below a limit. A test variant with primes outside the safe range lost valid results. The shipped code has a 4–17× margin, so this matters if the primes or inputs change.

A calculation that changes a value modulo q, so that the final Euler test returns −1 when the true discriminant is zero or a square, is the common outcome. A rejection needs the final value to equal exactly −1 and the zero check to pass, so most breakage just disables the filter. The dangerous cases corrupt the zero check or the residue itself.

Detection is also a weak point. The GPU self-check compares only polynomial counts taken before the filter runs, so it cannot see a miscomputing filter. The correct control is a known-answer test on the real device at every start-up.
ID: 4510 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Alperen Yavuz
Volunteer developer

Send message
Joined: 24 Jul 25
Posts: 25
Credit: 4,545,071
RAC: 134,955
Message 4511 - Posted: 18 Oct 2026, 20:38:26 UTC

Hmm, I don’t think I understood any of it. How would you explain this in the simplest way possible to someone who doesn’t know mathematics?
ID: 4511 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
k29000
Volunteer developer
Volunteer tester

Send message
Joined: 30 Apr 19
Posts: 48
Credit: 587,783
RAC: 446
Message 4515 - Posted: 19 Oct 2026, 9:11:06 UTC
Last modified: 19 Oct 2026, 10:10:40 UTC

The number theory isn't the important part. It only explains why the problem has consequences.

What matters is the main trick. You can understand this with simple programming knowledge about floats and ints. The code stores whole numbers in floating-point variables and has a line of code with (x*qi + MAGIC) - MAGIC to turn an approximate quotient back into a whole number. Put simply A + big number - big number to do the same thing as some rounding function Round(A). So it is relying on the processor's own rounding rather than calling a rounding function whose behaviour is guaranteed whatever the settings. So the result depends on how the processor and compiler behave.

The code contains a filter: a portion of code that throws away candidate polynomials it can prove would fail the full test by using the number above. Numberfields processes inputs in the form of polynomials. So if we think in terms of high school math Ax^2 + bx + c. Put simply, the filter correctly discards input polynomials only under certain assumptions about that rounding being correct: how the code is compiled, that the processor rounds to the nearest value with no extra precision, and that the numbers stay within known size limits.

If any of these break down, the rounding can give the wrong result, and discard a polynomial incorrectly, and it may do so only in rare circumstances. In testing, a test mix of candidates that were deliberately generated to try to produce failures (so I generated purposefully awkward polynomials to try to induce incorrect results more often that number fields test data) had the following results when breaking down things like compilation and processor rounding assumptions:

Deliberately breaking the extra-precision assumption (an x87-style build) wrongly rejected about 1 in 590,000 individual checks. Rounding toward +∞ wrongly rejected about 1 in 10,000. (A check is one candidate against one prime) Failures that rare can pass hundreds of thousands of tests without showing, so passing tests on one machine doesn’t prove the code is correct on another. A wrongly rejected candidate also leaves no trace in a normal run. Finding it needed me to write code to do a comparison against an exact integer calculation.

Often a broken assumption only switches the filter off, which is slow but safe. In other cases a candidate that should have been tested is wrongly thrown away, without anyone knowing.
ID: 4515 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
k29000
Volunteer developer
Volunteer tester

Send message
Joined: 30 Apr 19
Posts: 48
Credit: 587,783
RAC: 446
Message 4516 - Posted: 19 Oct 2026, 11:04:22 UTC
Last modified: 19 Oct 2026, 11:41:40 UTC

And just to conclude, I think the algorithm is fine under controlled conditions. Where compilation targets, drivers, are well understood by the developers and versions are fixed on the runtime machine(s), and resilient checks are written in the code to detect broken assumptions where the algorithm will not work correctly (This is what I called a "known-answer test" in my original message. Where some test cases known to break when certain assumptions break are run on the runtime machine and checked if they produce the expected result)

However, I personally wouldn't condone the algorithm for the distributed architecture of boinc. Even then I think it will probably be fine almost all of the time. But it has a hole where some unexpected machine somewhere incorrectly discards 1 polynomial out of millions because of some unpredicted aspect of the environment, and that one just happened to be one that should have been fully processed

The trade-off that has been made is not the correct balance for the architecture in question. It could probably be worked on to improve reliability, but I personally would encourage figuring out a different way to do it that is a better fit for the architecture
ID: 4516 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
k29000
Volunteer developer
Volunteer tester

Send message
Joined: 30 Apr 19
Posts: 48
Credit: 587,783
RAC: 446
Message 4517 - Posted: 19 Oct 2026, 18:04:41 UTC
Last modified: 19 Oct 2026, 18:36:31 UTC

Correction to my message above. It is only the conversion related code that would need to change to something else to be safer. No need to throw the baby out with the bathwater just yet

I did some reading and there's a few more robust ways to do it but all have impact on other parts of the code that would need to be reworked substantially. It will be slower but I have no idea by how much.
ID: 4517 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4523 - Posted: 19 Oct 2026, 23:40:35 UTC - in response to Message 4510.  

Regarding the rounding issue: (x*qi + M) − M.
I looked into this, mainly to educate myself and to understand what you were saying. I cut and pasted the code snippet into Gemini and asked it to explain what it was doing. Apparently, this "trick" is commonly used in high performance cryptography algorithms to rapidly reduce numbers modulo q. It works based on the IEEE 754 standard, which compilers must strictly follow. Compilers are forbidden from using the associativity laws from algebra, so it will not replace (x*qi + M) − M with x*qi + (M − M)=x*qi. HOWEVER, as you mentioned, compilers are not bound by these rules with certain optimization flags. All optimizations up to -O3 are safe. -Ofast and -ffast-math will both break it.

With OpenCL: The OpenCL specification strictly enforces non-associative IEEE 754 rules. So a standard-compliant OpenCL compiler should work. It says the developer needs to be careful when calling clBuildProgram to only pass the -O3 optimization flag (other optimization flags can break it as in the cpu case). They warn that it is possible for the end-user and certain non-compliant drivers to override the flags, and they give ways to fix this.

In summary, I think the rounding operation is safe, but we should double check the build flags in the makefiles and verify how clBuildProgram is called.

@k29000: Do you agree with this assessment? My information came from AI and you seem to be an expert at this stuff, so wanted to get your final opinion.
ID: 4523 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4524 - Posted: 19 Oct 2026, 23:51:25 UTC

Given the uncertainty at this point, I am holding off on deploying the new apps until we have resolved the unknowns.

I also wanted to report that almost 2000 WUs were tested, and not a single error yet. A total of 1.5 trillion polynomials were tested.
ID: 4524 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Henk Haneveld

Send message
Joined: 12 Oct 17
Posts: 4
Credit: 1,472,203
RAC: 2,286
Message 4530 - Posted: 20 Oct 2026, 8:25:12 UTC - in response to Message 4524.  

Given the uncertainty at this point, I am holding off on deploying the new apps until we have resolved the unknowns.

I also wanted to report that almost 2000 WUs were tested, and not a single error yet. A total of 1.5 trillion polynomials were tested.

May I suggest that you check how many different hosts where running these test WU's. I have the feeling that most where downloaded by just 2 or 3 hosts and that does not give a good spread across different hardware setups and OS versions.
ID: 4530 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4539 - Posted: 20 Oct 2026, 22:07:04 UTC - in response to Message 4530.  

Given the uncertainty at this point, I am holding off on deploying the new apps until we have resolved the unknowns.

I also wanted to report that almost 2000 WUs were tested, and not a single error yet. A total of 1.5 trillion polynomials were tested.

May I suggest that you check how many different hosts where running these test WU's. I have the feeling that most where downloaded by just 2 or 3 hosts and that does not give a good spread across different hardware setups and OS versions.

Each platform is getting almost 1000 WUs, and at the platform level there are at least a dozen different hosts, probably closer to 2 dozen.
ID: 4539 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Grant (SSSF)

Send message
Joined: 4 Jan 25
Posts: 119
Credit: 432,672,854
RAC: 878,805
Message 4540 - Posted: 21 Oct 2026, 6:54:06 UTC - in response to Message 4539.  

Given the uncertainty at this point, I am holding off on deploying the new apps until we have resolved the unknowns.

I also wanted to report that almost 2000 WUs were tested, and not a single error yet. A total of 1.5 trillion polynomials were tested.

May I suggest that you check how many different hosts where running these test WU's. I have the feeling that most where downloaded by just 2 or 3 hosts and that does not give a good spread across different hardware setups and OS versions.

Each platform is getting almost 1000 WUs, and at the platform level there are at least a dozen different hosts, probably closer to 2 dozen.
With a wide OS, driver spread?

My reading of the situation is that the code is working as intended on all the systems it's been tested on to date.
However, a particular combination of hardware, OS version and driver version could result in errors, that would not be detected.
Grant
Darwin NT, Australia.
ID: 4540 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4543 - Posted: 22 Oct 2026, 4:40:10 UTC - in response to Message 4540.  

I now have a way of rigorously testing the pdfilter subroutine (the core of passiflora). I am now confident that the algorithm is statistically safe to use.

There has been some discussion over potential compiler optimization problems. Since I have control over the compilation for cpu tasks, I am not worried about those systems. It's the openCL driver/compiler that warrants the most concern because it is possible for non-conformant drivers and users to modify compiler options.

I plan to deploy the cpu apps this weekend (just linux and windows). They will be assigned separate tasks (the DS13x12 cases), so it will be easy to backtrack if necessary.
ID: 4543 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Grant (SSSF)

Send message
Joined: 4 Jan 25
Posts: 119
Credit: 432,672,854
RAC: 878,805
Message 4544 - Posted: 22 Oct 2026, 7:07:40 UTC - in response to Message 4543.  

I now have a way of rigorously testing the pdfilter subroutine (the core of passiflora). I am now confident that the algorithm is statistically safe to use.

There has been some discussion over potential compiler optimization problems. Since I have control over the compilation for cpu tasks, I am not worried about those systems. It's the openCL driver/compiler that warrants the most concern because it is possible for non-conformant drivers and users to modify compiler options.

I plan to deploy the cpu apps this weekend (just linux and windows). They will be assigned separate tasks (the DS13x12 cases), so it will be easy to backtrack if necessary.
This is very good news.
Grant
Darwin NT, Australia.
ID: 4544 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4549 - Posted: 26 Oct 2026, 4:03:36 UTC - in response to Message 4543.  

I plan to deploy the cpu apps this weekend (just linux and windows). They will be assigned separate tasks (the DS13x12 cases), so it will be easy to backtrack if necessary.

If anyone was wondering, I am pushing this back a few days. Still working some issues with K29000, and want to make sure it's 100% ready before deploying.
ID: 4549 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Grant (SSSF)

Send message
Joined: 4 Jan 25
Posts: 119
Credit: 432,672,854
RAC: 878,805
Message 4550 - Posted: 26 Oct 2026, 5:12:56 UTC - in response to Message 4549.  

I plan to deploy the cpu apps this weekend (just linux and windows). They will be assigned separate tasks (the DS13x12 cases), so it will be easy to backtrack if necessary.

If anyone was wondering, I am pushing this back a few days. Still working some issues with K29000, and want to make sure it's 100% ready before deploying.
I was wondering, so thanks for the update.
Grant
Darwin NT, Australia.
ID: 4550 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Grant (SSSF)

Send message
Joined: 4 Jan 25
Posts: 119
Credit: 432,672,854
RAC: 878,805
Message 4562 - Posted: 5 Nov 2026, 7:33:59 UTC - in response to Message 4549.  

If anyone was wondering, I am pushing this back a few days. Still working some issues with K29000, and want to make sure it's 100% ready before deploying.
Just wondering how things were going?
Grant
Darwin NT, Australia.
ID: 4562 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
k29000
Volunteer developer
Volunteer tester

Send message
Joined: 30 Apr 19
Posts: 48
Credit: 587,783
RAC: 446
Message 4564 - Posted: 5 Nov 2026, 11:01:41 UTC - in response to Message 4562.  

If anyone was wondering, I am pushing this back a few days. Still working some issues with K29000, and want to make sure it's 100% ready before deploying.
Just wondering how things were going?


I'll be posting an update in a separate thread later today
ID: 4564 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4572 - Posted: 6 Nov 2026, 5:31:23 UTC - in response to Message 4562.  

If anyone was wondering, I am pushing this back a few days. Still working some issues with K29000, and want to make sure it's 100% ready before deploying.
Just wondering how things were going?

I just dumped 1000 test WUs for the latest version, just for linux and windows. When a sufficient number of these have been returned and look good, I will deploy the official versions. With any luck, maybe that will be tomorrow. GPUs and other platforms to come after that.
ID: 4572 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Grant (SSSF)

Send message
Joined: 4 Jan 25
Posts: 119
Credit: 432,672,854
RAC: 878,805
Message 4575 - Posted: 6 Nov 2026, 8:10:31 UTC - in response to Message 4572.  

I just dumped 1000 test WUs for the latest version, just for linux and windows. When a sufficient number of these have been returned and look good, I will deploy the official versions. With any luck, maybe that will be tomorrow. GPUs and other platforms to come after that.
Great to hear.
Grant
Darwin NT, Australia.
ID: 4575 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Eric Driver
Project administrator
Project developer
Project tester
Project scientist

Send message
Joined: 8 Jul 11
Posts: 1563
Credit: 1,411,806,959
RAC: 1,148,199
Message 4576 - Posted: 6 Nov 2026, 18:35:06 UTC - in response to Message 4575.  

I just dumped 1000 test WUs for the latest version, just for linux and windows. When a sufficient number of these have been returned and look good, I will deploy the official versions. With any luck, maybe that will be tomorrow. GPUs and other platforms to come after that.
Great to hear.

With over 500 tests (~250 on each linux/windows) now finished and in complete agreement with truth, I am starting the deployment. These will be confined to the DS13x12 data set. Legacy apps will stay on DS16x11. Hopefully I got the credit scale factors correct - the goal is to give x credit per hour of work on a cpu regardless of passiflora or legacy (GPUs get same credit as cpu, but should run faster so will get more credit per hour - same as it's always been).

After talking with K29000, there may be a simplification to the code coming (no need for the larger prime code). I'm not sure if this will improve timing very much, but the code will be more streamlined. I will wait for the verdict on that before testing/deploying on the other platforms.
ID: 4576 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Grant (SSSF)

Send message
Joined: 4 Jan 25
Posts: 119
Credit: 432,672,854
RAC: 878,805
Message 4577 - Posted: 6 Nov 2026, 21:19:12 UTC - in response to Message 4576.  
Last modified: 6 Nov 2026, 21:21:32 UTC

With over 500 tests (~250 on each linux/windows) now finished and in complete agreement with truth, I am starting the deployment.
I just started picking up some of the new application Tasks on my systems.
Early results- what was taking 2.5-3 hrs is now around 30-60min processing time (i7- 8700k system).

And if i understood you correctly earlier, these new Tasks are actually doing more processing than the older ones, even though they are being done in less time.
A great result.



One question about the new GPU application when it is released- since it is much more optimised, should it be configured to run only one Task at a time so it can run at full speed?
Grant
Darwin NT, Australia.
ID: 4577 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
1 · 2 · 3 · Next

Message boards : Science : Passiflora critique


Main page · Your account · Message boards


Copyright © 2026 Arizona State University