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

Merge old optimisations from spdz2k-develop #385

Merged
merged 19 commits into from
Feb 18, 2022
Merged

Merge old optimisations from spdz2k-develop #385

merged 19 commits into from
Feb 18, 2022

Conversation

jonas-lj
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Feb 14, 2022

Codecov Report

Merging #385 (93d8415) into master (9a4d7d4) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##              master      #385    +/-   ##
============================================
  Coverage     100.00%   100.00%            
- Complexity      3485      3597   +112     
============================================
  Files            394       404    +10     
  Lines           9878     10177   +299     
  Branches         758       776    +18     
============================================
+ Hits            9878     10177   +299     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../dk/alexandra/fresco/framework/util/MathUtils.java 100.00% <100.00%> (ø)
.../fresco/lib/field/integer/BasicNumericContext.java 100.00% <100.00%> (ø)
...b/common/collections/sort/KeyedCompareAndSwap.java 100.00% <100.00%> (ø)
...lexandra/fresco/lib/common/compare/Comparison.java 100.00% <100.00%> (ø)
...a/fresco/lib/common/compare/DefaultComparison.java 100.00% <100.00%> (ø)
.../fresco/lib/common/compare/lt/BitLessThanOpen.java 100.00% <100.00%> (ø)
.../alexandra/fresco/lib/common/compare/lt/Carry.java 100.00% <100.00%> (ø)
...exandra/fresco/lib/common/compare/lt/CarryOut.java 100.00% <100.00%> (ø)
...fresco/lib/common/compare/lt/LessThanOrEquals.java 100.00% <100.00%> (ø)
...dra/fresco/lib/common/compare/lt/LessThanZero.java 100.00% <100.00%> (ø)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a4d7d4...93d8415. Read the comment docs.

@jonas-lj jonas-lj changed the title Optimisations to library from spdz2k-develop Merge old optimisations from spdz2k-develop Feb 14, 2022
@jonas-lj jonas-lj requested a review from jot2re February 15, 2022 14:09
Copy link
Collaborator

@jot2re jot2re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I only have a couple of suggestions for clarification (which is not really an issue with the merge, but rather an issue with the state of spdz2k-develop code base).

return builder.seq(new Equality(bitLength, x, y));
public DRes<SInt> equals(DRes<SInt> x, DRes<SInt> y) {
int maxBitLength = builder.getBasicNumericContext().getMaxBitLength();
return equals(x, y, maxBitLength);
}

@Override
public DRes<SInt> compareLEQ(DRes<SInt> x, DRes<SInt> y) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this algorithm is now obsolete. However for compatibility it can instead be implemented by calling compareLT on x-1 or y+1 (depending on whether there are issues with overflow or underflow)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It now calls compareLT and is annotated as being deprecated, but I keep it around for now since it is used in many places

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think maybe we should add a task to fix this? Because then it means that certain protocols use one (less fast) protocol for comparison and others use the efficient version.

@@ -1,4 +1,4 @@
package dk.alexandra.fresco.lib.common.compare.gt;
package dk.alexandra.fresco.lib.common.compare.lt;

import dk.alexandra.fresco.framework.DRes;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this call is now obsolete, unless it uses an algorithm that can be better than the constant round and log round comparison algorithms now implemented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in the LP lib to compare large values, but besides that, it is obsolete. I have marked it as deprecated for now.

Copy link
Collaborator

@jot2re jot2re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made a new issue for removing remaining deprecated code. Otherwise good.

return builder.seq(new Equality(bitLength, x, y));
public DRes<SInt> equals(DRes<SInt> x, DRes<SInt> y) {
int maxBitLength = builder.getBasicNumericContext().getMaxBitLength();
return equals(x, y, maxBitLength);
}

@Override
public DRes<SInt> compareLEQ(DRes<SInt> x, DRes<SInt> y) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think maybe we should add a task to fix this? Because then it means that certain protocols use one (less fast) protocol for comparison and others use the efficient version.

@jonas-lj jonas-lj merged commit 1930b27 into master Feb 18, 2022
@jonas-lj jonas-lj deleted the merge_spdz2k branch February 18, 2022 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants