Skip to content

Add jax-cudnn-frontend agent skill - #2273

Open
jessicadesilva wants to merge 4 commits into
mainfrom
jessica-desilva/jax-cudnn-fe-skill
Open

Add jax-cudnn-frontend agent skill#2273
jessicadesilva wants to merge 4 commits into
mainfrom
jessica-desilva/jax-cudnn-fe-skill

Conversation

@jessicadesilva

@jessicadesilva jessicadesilva commented Aug 17, 2026

Copy link
Copy Markdown
Member

Adds a discovery-first procedural skill for wrapping, integrating, and validating cuDNN Frontend / CuTe DSL kernels from pure JAX, without PyTorch.

Example usage:

Using the jax-cudnn-frontend skill: wrap the cuDNN Frontend CuTe DSL block sparse attention kernels for inference and training from pure JAX, exposing the kernel configuration knobs so we can autotune per problem shape.

Lives at: docs/agent-skills/jax-cudnn-frontend/ so it's discoverable by any AI coding agent or human.

Covers: environment discovery, locating the vendor's own kernel call site as the source of truth for tensor contracts, minimal standalone repro scripts, JAX wrapper validation, and a symptom-indexed debugging guide distilled from real integration failures.

@copy-pr-bot

copy-pr-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

the kernel once with fixed seeds, prints **value-based** evidence (NaN
counts, checksums, fixed-position samples), and exposes every configuration
choice as an env-var toggle. This script is simultaneously your repro for
bug reports and your bisection harness. Allocate outputs with `jnp.empty` so

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A little correction, from JAX 0.11 jnp.empty may not be reliable as a NaN check - they say it may retrn genuinely uninitialized memory. Thus, an unwritten tile can contain any finite value and evade the jnp.isnan.
We could say to use jnp.full(..., jnp.nan), wdyt? could it be useful for this case?

@Steboss Steboss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I love this job, a few comments but overall ready for approval

## Keep the direct path alive

Alongside the JAX-native wrapper, maintain a `cute.compile`-style direct
invocation of the same kernel instance (concrete arrays via the DSL's

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not an expert on dlpack, but if I see from JAX doc they say that external mutation of a DLPack-backed JAX array may lead to undefined behaviour. Could this be a problem?

Comment on lines +119 to +137
```python
@cute.jit
def _launcher(stream, x, meta, out, aux, *, scale: float):
_zero_f32(aux).launch( # prologue: aux is accumulated into
grid=(cute.ceil_div(cute.size(aux), 256), 1, 1),
block=(256, 1, 1), stream=stream)
_kernel(x, out, aux, meta, cutlass.Float32(scale), stream)

@functools.partial(jax.jit, static_argnums=())
def op(x, meta):
return cjax.cutlass_call(
_launcher,
output_shape_dtype=[
jax.ShapeDtypeStruct(x.shape, x.dtype), # out
jax.ShapeDtypeStruct(aux_shape, jnp.float32), # aux — shape from
], # vendor allocation!
softmax_scale=...,
)(x, meta)
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this example tested?

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