Skip to content

[Feature][QDP] Add AMD GPU support via Triton backend#1158

Draft
400Ping wants to merge 17 commits intoapache:mainfrom
400Ping:qdp/AMD-GPU-Support
Draft

[Feature][QDP] Add AMD GPU support via Triton backend#1158
400Ping wants to merge 17 commits intoapache:mainfrom
400Ping:qdp/AMD-GPU-Support

Conversation

@400Ping
Copy link
Copy Markdown
Member

@400Ping 400Ping commented Mar 8, 2026

Related Issues

Closes #1155

Changes

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Why

QDP currently assumes the CUDA/native _qdp path, which makes the Python API effectively NVIDIA-only.
This change adds an AMD/ROCm execution path so QDP can run on AMD GPUs while keeping the existing CUDA route intact.

The goal of this PR is to:

  • reduce NVIDIA vendor lock-in for QDP users
  • keep a single QdpEngine entry point for backend selection
  • document and test the AMD/ROCm route without regressing the existing CUDA/native path

User-Facing Behavior

CUDA:

from qumat.qdp import QdpEngine

engine = QdpEngine(device_id=0, backend="cuda")
qtensor = engine.encode(data, num_qubits=2, encoding_method="amplitude")

AMD/ROCm:

from qumat.qdp import QdpEngine

engine = QdpEngine(device_id=0, backend="amd", precision="float32")
tensor = engine.encode(data, num_qubits=2, encoding_method="amplitude")

Testing

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes

Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping 400Ping self-assigned this Mar 8, 2026
@400Ping 400Ping marked this pull request as ready for review March 8, 2026 16:25
Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping
Copy link
Copy Markdown
Member Author

400Ping commented Mar 8, 2026

Just noticed that colab doesn't have AMD GPU options, so we may need to ask AMD for collaboration. Or I will looked into modal if I can rent one.

@400Ping 400Ping marked this pull request as draft March 8, 2026 18:01
@400Ping
Copy link
Copy Markdown
Member Author

400Ping commented Mar 8, 2026

On second thought, let me see if I can rent one first.

@400Ping 400Ping marked this pull request as ready for review March 13, 2026 02:28
@400Ping 400Ping requested a review from rich7420 March 13, 2026 03:21
@guan404ming
Copy link
Copy Markdown
Member

Let's turn this one to draft to prevent early review.

@guan404ming guan404ming marked this pull request as draft March 16, 2026 11:22
@400Ping 400Ping marked this pull request as ready for review April 6, 2026 12:10
Comment thread qdp/qdp-python/benchmark/benchmark_triton_amd.py Outdated
Comment thread qdp/qdp-python/qumat_qdp/triton_amd.py Outdated
400Ping added 4 commits April 17, 2026 16:49
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping
Copy link
Copy Markdown
Member Author

400Ping commented Apr 17, 2026

# python qdp/qdp-python/benchmark/benchmark_triton_amd.py --qubits 12 --batch-size 64 --batches 200 --encoding-method amplitude
TRITON AMD BASELINE
- Encoding: amplitude
- Qubits: 12
- Batch size: 64
- Batches: 200
- Duration: 0.0153 s
- Throughput: 835843.1 vectors/sec
- Latency: 0.001196 ms/vector

Tested on AMD Instinct MI300X

400Ping added 3 commits April 18, 2026 02:13
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping
Copy link
Copy Markdown
Member Author

400Ping commented Apr 18, 2026

cc @viiccwen to take a look

Copy link
Copy Markdown
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Thanks for the patch, just left some nit comments.

Comment thread qdp/qdp-python/qumat_qdp/__init__.py Outdated
Comment thread qdp/qdp-python/TRITON_AMD_BACKEND.md Outdated
Comment thread qdp/qdp-python/qumat_qdp/backend.py Outdated
Comment thread qdp/qdp-python/qumat_qdp/backend.py Outdated
Comment thread qdp/qdp-python/qumat_qdp/backend.py Outdated
Comment thread qdp/qdp-python/src/dlpack.rs
400Ping added 2 commits April 18, 2026 10:54
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping 400Ping requested a review from guan404ming April 18, 2026 04:50
Copy link
Copy Markdown
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Great, I think we could work on this and refine this. Thanks!

Copy link
Copy Markdown
Member

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

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

This PR introduce two ways for amd GPUs to run qdp, could be refine later.

Could be a followup.

Copy link
Copy Markdown
Contributor

@rich7420 rich7420 left a comment

Choose a reason for hiding this comment

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

thanks for the patch! left some comments

Comment thread qdp/qdp-python/qumat_qdp/backend.py Outdated
Comment thread qdp/qdp-python/qumat_qdp/backend.py Outdated
@400Ping 400Ping marked this pull request as draft April 19, 2026 10:46
@400Ping
Copy link
Copy Markdown
Member Author

400Ping commented Apr 19, 2026

I am fixing some of the implementations, putting this to draft.

Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping 400Ping marked this pull request as ready for review April 19, 2026 11:33
Signed-off-by: 400Ping <jiekaichang@apache.org>
@400Ping 400Ping marked this pull request as draft April 19, 2026 17:10
400Ping added 4 commits April 20, 2026 12:18
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
Signed-off-by: 400Ping <jiekaichang@apache.org>
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.

[Feature][QDP] Add AMD GPU support via Triton backend

5 participants