Skip to content

fix(kernels): reject triton_op kernels needing more than 48 KiB of shared memory - #4877

Open
narendasan wants to merge 1 commit into
mainfrom
narendasan/triton-op-smem-limit
Open

narendasan wants to merge 1 commit into
mainfrom
narendasan/triton-op-smem-limit

Conversation

@narendasan

@narendasan narendasan commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • A kernel may use more than 48 KiB of dynamic shared memory per block only after its CUfunction opts in through cudaFuncAttributeMaxDynamicSharedMemorySize. TensorRT's AOT plugin launch does not, so a triton_op kernel over the limit compiles, registers and builds into an engine, then fails on every execution with Failed to enqueue status -1 from pluginUtilsRuntime.cpp and a Myelin "Custom layer callback ... failed" -- nothing that points at shared memory.
  • Measured on an RTX 5090 (TensorRT 11.3): the same Triton GEMM runs at 24 KiB and fails at 96 KiB, below the 99 KiB hardware limit; a flash-attention kernel failed at 72 KiB and ran at 34 KiB.
  • Reject such kernels in _validate_launch_metadata, at registration, with the kernel's requirement and the knobs that lower it (num_stages, block sizes).

Tests

🤖 Generated with Claude Code

…ared memory

A kernel may use more than 48 KiB of dynamic shared memory per block only
after its CUfunction opts in through
`cudaFuncAttributeMaxDynamicSharedMemorySize`. TensorRT's AOT plugin launch
does not, so a `triton_op` kernel over the limit compiles, registers and
builds into an engine, then fails on every execution with
`[...]: Failed to enqueue status -1` from `pluginUtilsRuntime.cpp` and a
Myelin "Custom layer callback ... failed" -- nothing pointing at shared
memory.

Measured on an RTX 5090 (TensorRT 11.3): the same Triton GEMM runs at 24 KiB
and fails at 96 KiB, below the 99 KiB hardware limit; a flash-attention kernel
failed at 72 KiB and ran at 34 KiB.

Reject such kernels in `_validate_launch_metadata`, at registration, with the
kernel's requirement and the knobs that lower it (num_stages, block sizes).

Tests: the launch-metadata parametrization gains a 48 KiB + 1 case and a stub
test accepts exactly 48 KiB; the new case fails without the change.
`pytest tests/py/kernels`: 247 passed, 34 skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@narendasan
narendasan force-pushed the narendasan/triton-op-smem-limit branch from b2ecc02 to 2c18909 Compare November 23, 2026 23:06
@narendasan narendasan added this to the v2.16.0 milestone Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant