Salsa
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: "Salsa Meeting 2025-01-22" date: 2025-01-22 url: https://hackmd.io/rEk8dr95Q8C9eVz-uxlzMA --- # Agenda ## rust-analyzer Integration Updates We've opened PR! https://github.com/rust-lang/rust-analyzer/pull/18964. Few notes: - Memory usage has gotten under control: it's now only a 250 megabyte regression. - Chayim's [enum changes](https://github.com/ChayimFriedman2/salsa/tree/fix-enums-bugs) reduce memory usage by ~300 megabytes and implement [salsa#578](https://github.com/salsa-rs/salsa/issues/578). We need to port this over to use `macro_rules` + `quote` instead of just `quote`. There's a few remaining questions: ### Globalizing Sync/Memo Tables [Globalizing sync tables](https://github.com/salsa-rs/salsa/pull/650) reduces rust-analyzer's by 240 megabytes, but might harm parallelism (by how much? unclear). As an alternative, Chayim reduced memory usage by shrinking `SyncState` from 16 bytes to 2 bytes. *Question*: what was the intention behind per-ingredient sync/memo tables? simplify parallelism, or...? **Conclusion:** * Overall goal should be to merge sync table into memos * But landing this PR would be ok as an intermediate step so long as it doesn't interfere with Carl's work ### Interned structs containing references to other structs After talking to Jack Huey, he mentioned it'd make migrating rust-analyzer to the new trait solver easier if he could write: ```rust #[salsa::interned] struct Ty<'db> { kind: &'db TyKind } ``` To me (davidbarsky), this smells like a combination of https://github.com/salsa-rs/salsa/pull/633 and https://github.com/salsa-rs/salsa/issues/498. While tracked structs allow the following already: ```rust #[salsa::tracked] struct MyTracked1<'db> { field: MyTracked2<'db>, } #[salsa::tracked] struct MyTracked2<'db> { field: u32, } ``` However, this doesn't have value semantics/equality, and `Ty`/`TyKind` need to be interned. **Conclusion:** * Supporting *references* is hard but ought to be possible to include `'db` lifetime without a problem ## Address/Discuss Remaining Open PRs - See discussion above on sync tables. - TK ## Garbage Collection - How should GC interact with interned values and non-default durabilities? [Github comment](https://github.com/salsa-rs/salsa/pull/602#issuecomment-2598225695) ## LRU eviction on new revision The LRU evicting within query computations can result in frequent (re-)evictions. This can be noticable in rust-analyzer when we process multiple requests doing similar-ish work where they will potentially start trashing the macro parse caches of another. Which gave me the idea that we could have caches evict on a new revision instead (as well as allowing manual eviction by the database owner). In other words we could offer LRU flavors: - No LRU - Current/Automatic LRU (always evict immediately to stay at the limit) - Manual LRU (new, trigger manually to have it evict until it reaches its limit again) - Revision LRU (new, trigger evictions when a new revision starts) **Conclusion:** * Move LRU eviction to `&mut` since in reality we don't actually drop the memory until `&mut` anyway * it will also align with interned data being released, in this way, and generally simplify ## open PRs ### interned-sans-lifetime @davidbarsky has locally updated [salsa#632](https://github.com/salsa-rs/salsa/pull/632) to substantially reduce the surface area of the changes by making use `salsa::plumbing::macro_if`. Usage is now `#[salsa::interned(no_lifetime)]` instead of a standalone macro. Niko suggested reducing the usage of `macro_if` through the following: * `db_lt` = `'db` always * `$($db_lt_arg:lifetime)?` may be empty and then do ```rust impl<$db_lt> $Struct< $($db_lt_arg)? > { } ``` **Conclusion:** - @davidbarsky will close [salsa#632](https://github.com/salsa-rs/salsa/pull/632) and open a new PR with the more minimal changes. ### untracked-by-default * good to land * one challenge: need an ingredient for every field * something depends on the fields being in specific ordering ### interning / ibraheem's PR * only interning adds edges * we need to support interning outside a query (with immortal semantics) *internally* * plan: * when you intern a value, record the durability of the query thus far in the interned struct (taking the max durability if there are multiple) * you record a dependency on the interned value with current durability of interned value * when you read from interned value * no edge is created * when you recycle an interned value * have to mark its durability as having changed * how would we do GC * what is the best heuristic? * one cute one is the color scheme * red/yellow/green with tunable sizes * to promote from yellow to green: * swap some green entry with your yellow one * to promote red to green: * swap some red with yellow * then some yellow with green above * then we can just recycle the red generation always, for example, the question will be how we tune the sizes of those bins, I think it'd be cool to observe and analyze them * rust-analyzer has a fork/version of this algorithm: https://github.com/rust-lang/rust-analyzer/blob/1f23156f51e6a064becb1103eac078c2c9d14a80/crates/ra-salsa/src/lru.rs#L150 https://github.com/salsa-rs/salsa/blob/650545363ef1508be1b7e84a2d6db976c9eb4455/tests/interned-revisions.rs#L19 ### fixpoint iteration - Got the multiple-thread tests passing. - When a query is about to return a provisional value, which is provisional on a cycle head that isn't on the active-query stack in that same thread, we have to insert our provisional result in the memo table (so it's available to the other thread) then block on the thread that owns execution of the cycle head, to let that other thread fixpoint-iterate and resolve the cycle. Then we can fetch the updated non-provisional memo for our own query, and return it. - Need to resolve some code organization issues, add some more complex multi-threaded cases (nested cycles, with 3+ threads and each head owned by a different thread) to make sure they work too, and then work on performance. - Right now we are making Memo quite a bit larger, making ClaimGuard more expensive, and there are some other potential optimization opportunities Lukas pointed out. - I'll post in Zulip when I think I've reached functional correctness (hopefully today or tomorrow?); at that point review and help/suggestions/exploration on performance issues would be very welcome. can we setup a testing framework https://github.com/awslabs/shuttle ## rust-analyzer PR prioritization ### 1.0 alpha 1 * interned sans lifetime * other memory use reduction? * 'salsa supertype' ([#578](https://github.com/salsa-rs/salsa/issues/578)) * tracked by default ### 1.0 alpha 2 * fixed point iteration * intern GC *

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully