Skip to content

[RFC] FlyDSL kernels in downstream libraries #749

Description

@jhinpan

This RFC started with a simple question: how should a downstream kernel library consume kernels written in FlyDSL?

After implementing RMSNorm backward and studying both Quack and AITER, the main issue is no longer kernel capability. It is ownership.

FlyDSL now has RMSNorm forward + backward, residual backward, autograd coverage, and an optimized staged-reduction path (#795, #800, #855). The current backward implementation is competitive with the tested PyTorch and AIter baselines on MI355X.

The remaining question is where production kernel code and integration logic should live.

Proposed boundary

Follow the model already used by AITER:

FlyDSL owns

  • the DSL, compiler, and runtime;
  • target selection, JIT cache correctness, device/context safety, streams, and diagnostics;
  • generic infrastructure that is useful to more than one downstream.

The downstream library owns

  • the production FlyDSL kernel used by that library;
  • operator semantics, dtype support, autograd, framework custom ops, fallback behavior, and dispatch;
  • operator-specific tuning, tests, benchmarks, packaging, and CI.

This keeps one semantic owner for each operator. It also avoids turning FlyDSL into an operator library just so Quack can import one RMSNorm implementation. Quack can adapt the existing Apache-2.0 FlyDSL kernel with attribution and then evolve it with Quack's API.

Quack RMSNorm PoC

The scope question is now open in Dao-AILab/quack#178. We should not open implementation sub-issues until Quack maintainers confirm that a non-CuTe backend belongs in the project.

If accepted, the work should be split into small Quack-owned changes:

  1. Isolate eager CuTe/CUDA imports and decide how CUDA/ROCm dependencies are installed.
  2. Add an explicit experimental FlyDSL RMSNorm entry point.
  3. Implement plain weighted forward + backward first, including FP16/BF16/FP32 inputs, FP32 weights for 16-bit inputs, runtime eps, and flattenable contiguous inputs.
  4. Validate on gfx942 and gfx950 against Quack's references and ROCm PyTorch/AIter.
  5. Enable transparent quack.rmsnorm dispatch only after the agreed API and torch.compile contract are covered.

Bias, residual/prenorm, per-head mode, output dtype conversion, optional weight, and weight_offset are follow-ups owned by Quack—not reasons to expand FlyDSL's public operator surface.

FlyDSL work

Only one required FlyDSL-core gap has been identified:

  • #878: resolve the JIT target from the invocation device and keep target/cache reuse safe across GPU architectures.

The existing torch.compile discussion in #596 may still lead to a useful generic helper, but it is not a blocker for the Quack PoC. Quack and AITER already own operator-specific custom-op wrappers.

The RMSNorm training tracker #769 is complete and closed. Generic autotune work remains in #770, but Quack-specific search spaces and selected configs should live in Quack.

Decision

For this RFC, the proposed direction is:

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