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

docs(frontend): add performance tips section #919

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

umut-sahin
Copy link
Contributor

Copy link
Contributor

@bcm-at-zama bcm-at-zama left a comment

Choose a reason for hiding this comment

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

Please, before adding new sections in the doc, let me sit a bit with @yuxizama, such that we define the architecture of files and doc. Then, we'll add the sections. Else, we keep adding files and files, and we add too much complexity

So blocking the PR for a moment please

@umut-sahin
Copy link
Contributor Author

Sure, we don't have to merge immediately, but let's improve the content as much as we can. We can just move it to wherever when we are ready to merge.

@yuxizama
Copy link
Contributor

yuxizama commented Jun 27, 2024

It's very useful to have this kind of content for users! Thank you @umut-sahin
Regarding the architecture, I don't see any problem with this one being inside "compilation". However we're about to define some general doc objectives for Q3 with @bcm-at-zama , so we'll get back on this shortly.

@umut-sahin umut-sahin force-pushed the docs/performance-tips branch from f684e12 to bad72ca Compare June 27, 2024 14:06
Copy link
Member

@BourgerieQuentin BourgerieQuentin left a comment

Choose a reason for hiding this comment

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

That's a great start to have this page. I would change the ordering, or maybe several section:

Improve parallelism

  • Tensorize
  • Dataflow

Optimize tlus

  • Reduce number of tlus
  • rounding/truncate maybe merged with approximate, as it's a optimization of the rounding?
  • p-error
  • bit extraction
  • complex operations
  • modules

@umut-sahin umut-sahin force-pushed the docs/performance-tips branch from bad72ca to 870e299 Compare June 28, 2024 11:33
@umut-sahin
Copy link
Contributor Author

I've grouped the tips by category 👍

@BourgerieQuentin BourgerieQuentin force-pushed the docs/performance-tips branch from 870e299 to 02b2e6d Compare July 4, 2024 11:36
@bcm-at-zama bcm-at-zama self-requested a review July 11, 2024 09:58
Copy link
Contributor

@bcm-at-zama bcm-at-zama left a comment

Choose a reason for hiding this comment

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

I've not read the content but at least, where the new file is is OK with what we've agreed with Yuxi. So, if you want to merge when I'm off, good with me (but have it reviewed by someone, obviously).

Copy link
Contributor

@bcm-at-zama bcm-at-zama left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this new documentation.

I have however a concern, which is that the new .md is very very long. I know from @yuxizama, and from our own experience, that we would like to have smaller .md's. We also wanted to try to keep a part of the doc for "simple" users, and some other parts for advanced users. I have moved eg some long & extensive part to "Explanation" part.

So I would maybe ask @yuxizama and @BourgerieQuentin what they think about this. In particular, we may consider

  • splitting that into several md's
  • and have an "Optimize tips" category on the left pane, instead of a single file

@umut-sahin umut-sahin force-pushed the docs/performance-tips branch 2 times, most recently from ba53ecd to 995e855 Compare July 29, 2024 14:04
@umut-sahin
Copy link
Contributor Author

I've split it in multiple files, let me know if you like it @bcm-at-zama 🙌

@umut-sahin umut-sahin requested a review from bcm-at-zama July 29, 2024 14:11
Copy link
Contributor

@bcm-at-zama bcm-at-zama left a comment

Choose a reason for hiding this comment

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

Thanks @umut-sahin . Sorry, I still have a few concerns:

  • I would not add this to where you've added it, but to Explanations; and I would add a short summary in the "easy part"
  • some parts are not self contained, it's easy to fix

Let's have the opinion from @yuxizama before doing more changes.

@umut-sahin
Copy link
Contributor Author

I would not add this to where you've added it, but to Explanations

To me, Explanations are for explaining how things work, like how things are done internally. These are not explanations.

and I would add a short summary in the "easy part"

I don't think we should split this to easy/hard. We need to have a place where users can see what they can do to improve the performance of their circuits, this is exactly that, grouped by performance considerations across different areas. It's a lot more organized than easy vs hard optimizations.

@umut-sahin
Copy link
Contributor Author

umut-sahin commented Jul 30, 2024

These are in fact guides, more than explanations.

@bcm-at-zama
Copy link
Contributor

and I would add a short summary in the "easy part"
I don't think we should split this to easy/hard. We need to have a place where users can see what they can do to improve the performance of their circuits, this is exactly that, grouped by performance considerations across different areas. It's a lot more organized than easy vs hard optimizations.

To me, our doc used to be too long and too explanative. Users don't want to read a book, they want short things that they can do. For long things, I would use the Explanation part. We used to have lengthy lengthy things, I have tried to simplify this.

@umut-sahin
Copy link
Contributor Author

Each page is like single page already, we can't make it shorter. And keeping all optimization ideas grouped is a lot better in my opinion as users won't need to jump entire different sections of the doc.

@bcm-at-zama
Copy link
Contributor

These are in fact guides, more than explanations.

'Guide' in the docs (C and CML) is more for deployment

@bcm-at-zama
Copy link
Contributor

Each page is like single page already, we can't make it shorter.

To me, it's too long for the easy part. See what I have done eg for

* [Table Lookups basics](core-features/table_lookups.md)
* [Non-linear operations](core-features/non_linear_operations.md)
* Other operations
  * [Bit extraction](core-features/bit_extraction.md)
  * [Common tips](core-features/workarounds.md)
  * [Extensions](core-features/extensions.md)

I have tried to make them small and just about what the simple user need to know/do. The full info has been moved.

Let's @yuxizama dive in here

@umut-sahin
Copy link
Contributor Author

'Guide' in the docs (C and CML) is more for deployment

Then they are not Guides, they are Deployment Guides. Saying Guides in the title and then implying Guides is only for deployment is certainly more confusing then using Guides for all kinds of Guides.

Plus, optimization is also important for actual deployment.

@umut-sahin
Copy link
Contributor Author

umut-sahin commented Jul 30, 2024

To me, it's too long for the easy part. See what I have done eg for

Optimization is an advanced topic, I really don't think we should sprinkle some of it here and some of it there. Users can learn the library in the "easy" part, develop their application and when the time to optimize comes, they can read the "hard" part in one place to maximize their performance.

Lastly, if we split these tips across the docs, they can even miss some of the tips as they could only look for one part.

Anyway, I'll let @yuxizama and @BourgerieQuentin reply and then continue 👍

@BourgerieQuentin
Copy link
Member

I'm aligned with @umut-sahin , I think splitting optimization tips across the documentation is a bad thing. The "easy part" should be simplest as possible just documenting features without any complexity, then a chapter regrouping optimization is a must have for me. It follow the development process, "make it works then make it fast". And I'm ok it's not explanations for me it should be a dedicated section of the documentation.

@bcm-at-zama
Copy link
Contributor

And I'm ok it's not explanations for me it should be a dedicated section of the documentation.

We don't want to add a new section in the documentation too often. The main sections is decided by @yuxizama, has some common names with other products etc.

@bcm-at-zama
Copy link
Contributor

We've decided for

Short optim part: in Execution/Analysis
Long optim part: in Guide

@umut-sahin umut-sahin force-pushed the docs/performance-tips branch from 995e855 to 078dcd8 Compare July 31, 2024 10:15
@umut-sahin umut-sahin requested a review from bcm-at-zama July 31, 2024 10:30
Copy link
Contributor

@yuxizama yuxizama left a comment

Choose a reason for hiding this comment

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

Hey @umut-sahin
Thanks for the update.

Before merging this, I just have 1 last thing to add:
Could you add a 1-sentence summary at the beginning of each doc, starting with "This document explains/provides/introduces .....". It gives readers an overview of what they will see in the doc.

You can find such examples in all the TFHE-rs doc, the "Get started" part of Concrete doc and part of CML and fhEVM doc. It's a format that I'm trying to use for all the docs.

Besides that, the rest of good for me.

Copy link
Contributor

@bcm-at-zama bcm-at-zama left a comment

Choose a reason for hiding this comment

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

I guess this has not been completely modified, to take into accounts the previous reviews, right?

For the summary, I am quite happy: it gives a not too long overview, with some actions (ie, options) that the user can try

Copy link
Contributor

@yuxizama yuxizama left a comment

Choose a reason for hiding this comment

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

I proposed to shorten the titles, otherwise it looks very long on the side menu. With the title shortened, it makes better sense with the introduction summary in each doc.
Screenshot 2024-08-02 at 10 17 08

Copy link
Contributor

@bcm-at-zama bcm-at-zama 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 to me, thanks a lot @umut-sahin

@bcm-at-zama
Copy link
Contributor

(some compliance problems, however)

@umut-sahin umut-sahin force-pushed the docs/performance-tips branch from a53fe2b to e2ca48b Compare August 2, 2024 09:09
@umut-sahin umut-sahin merged commit 2968e80 into main Aug 2, 2024
28 checks passed
@umut-sahin umut-sahin deleted the docs/performance-tips branch August 2, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants