Skip to content

Improve how we vendor kernels that have upstreams (reduce divergence / maintenance burden) #721

Description

@moon-bot-app

Problem

Today, when we vendor a kernel that has an upstream (e.g. NATTEN huggingface/kernels-community#1031, which adds 431 files), we essentially copy the upstream source into kernels-community and then make many changes on top: fixing paths, restructuring files, adding bindings, etc.

This leaves us in a state where:

  • It's hard to tell whether a given line comes from upstream or is a change we made.
  • When upstream changes, we have to figure out where that change maps in our edited/restructured kernel.
  • Over time the port naturally diverges from upstream, increasing our maintenance burden.

This is especially relevant for brand-new kernels (like NATTEN) where we expect upstream to keep changing.

Idea

Best case: have an additive-only patch set that converts an upstream repo into an HF kernel. When upstream changes, we'd pull upstream and reapply our patches. Benefits:

  • We could make statements like "our kernel is as up to date as upstream's last commit."
  • Lowers the barrier to entry — existing kernel authors often don't want to restructure their whole repo but would like to benefit from the kernels project.

Open questions / discussion

  • How is this meaningfully different from the current workflow, and does it hold up when the patch itself introduces small-but-numerous changes?
  • We've been using an agent-driven approach (à la the AGENT.md in kernels-community) for the restructuring changes, and it seems to work fairly reliably — does that already lower the cognitive load enough, or is a formal patch-set approach still worth it?

Filing this to track the discussion started in Slack.


Requested by Sayak Paul - Slack thread - Agent trace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions