Skip to main content

CUDA-to-Ascend ecosystem compatibility bridge — fixes the last mile between torch_npu and your existing CUDA code

Project description

cuda-morph

Run PyTorch workloads on non-NVIDIA hardware with minimal code changes.

Python 3.8+ Alpha status Apache 2.0 license

cuda-morph dark hero

Existing CUDA-style PyTorch scripts keep running — cuda-morph redirects calls to available backends or falls back to CPU.


Why this exists

A lot of ML code assumes torch.cuda everywhere. On non-NVIDIA setups, that often means immediate runtime errors and expensive rewrites.

cuda-morph is a runtime compatibility layer that helps you keep the same workflow and ship faster.


Visual walkthrough

cuda-morph workflow dark

  1. Start with existing CUDA-oriented code.
  2. Activate cuda-morph.
  3. Run with backend-aware routing and fallback behavior.

Quick start

pip install cuda-morph
import ascend_compat
ascend_compat.activate()

# Existing CUDA-style code stays the same
model = model.cuda()
cuda-morph info
cuda-morph check model.py

Core capabilities

  • Zero-rewrite activation for many CUDA-style PyTorch flows.
  • Backend routing across Ascend / ROCm / Intel XPU / CPU fallback paths.
  • CLI tooling for environment checks, porting hints, and validation commands.
  • Ecosystem patches for key libraries (current depth varies by backend).

Full matrix: docs/compatibility_matrix.md


Validation snapshot

cuda-morph cli dark ROCm .cuda() proof screenshot

  • 460+ tests passing in CPU-fallback mode.
  • Real hardware proof captured on RunPod AMD ROCm: .cuda() matmul ran on cuda:0 and reported AMD Radeon Graphics.
  • Core .cuda() routing on non-NVIDIA hardware is now validated; broader operator and ecosystem coverage is still in progress.

If you can test on non-NVIDIA accelerators, feedback is highly valuable: open an issue.


Backend status (current)

Backend Hardware Status
Huawei Ascend 910B, 310P Full shim + ecosystem patches (flash-attn, HuggingFace, DeepSpeed, vLLM). Needs hardware validation.
AMD ROCm MI210, MI250X, MI300X Detection + device routing. Ecosystem patches not yet implemented.
Intel XPU Max 1550, Flex, Arc Detection + device routing. Ecosystem patches not yet implemented.
Cambricon MLU370, MLU590 Detection + device routing. Ecosystem patches not yet implemented.

CLI

cuda-morph check model.py     # check a script for compatibility issues
cuda-morph port model.py      # generate porting suggestions
cuda-morph doctor             # environment diagnostics
cuda-morph doctor --full
cuda-morph verify --device npu
cuda-morph bench overhead
cuda-morph info

Development

git clone https://github.com/JosephAhn23/cuda-morph.git
cd cuda-morph
pip install -e ".[dev]"
pytest tests/ -v
pytest tests/ -v --run-hardware

See also

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cuda_morph-0.9.1.tar.gz (151.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cuda_morph-0.9.1-py3-none-any.whl (143.2 kB view details)

Uploaded Python 3

File details

Details for the file cuda_morph-0.9.1.tar.gz.

File metadata

  • Download URL: cuda_morph-0.9.1.tar.gz
  • Upload date:
  • Size: 151.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cuda_morph-0.9.1.tar.gz
Algorithm Hash digest
SHA256 d04d6894e4e63051dffe9df827f623505492f5d4da23279ed05d4a8b77e6cc30
MD5 502e2329523663740b14deb5eaf963c0
BLAKE2b-256 7329c9823b2d5148df6a57c7dd99791d9a6c4a5ebd990d62a1cf1a3ea8c5767d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cuda_morph-0.9.1.tar.gz:

Publisher: publish.yml on JosephAhn23/cuda-morph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cuda_morph-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: cuda_morph-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 143.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cuda_morph-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 98f9b099f715c5e737c4c8ae0fa0a8198b7f263a5094d7a0b03412030de27b99
MD5 16f7b8fbc0c624d68b9628ae6950ab66
BLAKE2b-256 9f3fc9dc9b915667ca71f082c64dd3f73d6d224c9ac8a9789c9405fef4c1ba6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cuda_morph-0.9.1-py3-none-any.whl:

Publisher: publish.yml on JosephAhn23/cuda-morph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page