Skip to content

Run the CUDA kernels on ROCm - #10

Open
kashif wants to merge 5 commits into
NX-AI:mainfrom
kashif:rocm-support
Open

Run the CUDA kernels on ROCm#10
kashif wants to merge 5 commits into
NX-AI:mainfrom
kashif:rocm-support

Conversation

@kashif

@kashif kashif commented Jul 20, 2026

Copy link
Copy Markdown

This makes the compiled flashrnn kernels build and run on AMD GPUs through HIP, while leaving the CUDA path unchanged.

What's in here:

  • get_cuda_version no longer crashes when there is no CUDA toolkit (CUDA_HOME is None on ROCm and CPU only boxes, which raised a TypeError before)
  • on ROCm we hipify the sources, force include a small compat header for the few cuBLAS enums and math intrinsics hipify does not translate, compile the pybind glue with hipcc, and link hipBLAS instead of cuBLAS
  • a bf16 atomicAdd fallback for GPUs without native bf16 atomics (RDNA)

Tested on ROCm 7.2 (gfx1150, torch 2.13+rocm7.2): the full tests/test_slstm.py suite passes, 870 tests, covering the cuda and cuda_fused backends for both forward and backward.

Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@kashif

kashif commented Jul 20, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1bea03137b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread flashrnn/flashrnn/cuda_init.py Outdated
kashif added 2 commits July 21, 2026 00:01
Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
@superbock
superbock requested a review from martinloretzzz July 21, 2026 07:51
@kashif

kashif commented Jul 21, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79c171f989

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread flashrnn/flashrnn/cuda_init.py
Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
@kashif

kashif commented Jul 21, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d28502180f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread flashrnn/flashrnn/cuda_init.py
…fy cache

Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
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.

1 participant