Skip to content

Guard Triton launches by tensor device#1304

Open
kashif wants to merge 2 commits into
linkedin:mainfrom
kashif:agent/device-context-triton-launches
Open

Guard Triton launches by tensor device#1304
kashif wants to merge 2 commits into
linkedin:mainfrom
kashif:agent/device-context-triton-launches

Conversation

@kashif

@kashif kashif commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1303.

Some Triton launches can receive tensors on a non-current GPU, for example under device_map="auto". Triton uses the active device for launch and compile state, so the launch needs to enter the input tensor's device context.

This adds a small shared device_context helper and applies it directly around the RMSNorm, SwiGLU, and GeGLU launches.

This follows the same pattern as huggingface/kernels-community#1029.

Checks:

  • make checkstyle
  • python -m py_compile src/liger_kernel/ops/utils.py src/liger_kernel/ops/rms_norm.py src/liger_kernel/ops/swiglu.py src/liger_kernel/ops/geglu.py
  • git diff --check

@kashif
kashif marked this pull request as ready for review July 16, 2026 13:45
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.

Triton kernels can launch on the wrong GPU with multi-GPU inputs

1 participant