r/CUDA • • 4h ago

ink4060ti: Native CUDA C++20 engine for Inkling-2-Mini (26.4B MoE + Vision) on 16 GB RTX 4060 Ti — lossless NVFP4 Loop-Core, 1,956 tok/s prefill, 156K VRAM ctx + compiled Blackwell sm_120a NVFP4 MMA (seeking 5060 Ti testers!)

5 Upvotes

I built ink4060ti (Apache-2.0), a zero-config C++20/CUDA inference engine specifically engineered to deliver a major jump in BOTH speed and reasoning quality for Inkling-2-Mini-Unbound (26.4B MoE + native vision + DSpark Block-8 speculative decoding) on a single 16 GB RTX 4060 Ti on Windows.

Why both quality AND speed jump on 16 GB 4060 Ti

On a 16 GB card, Strata SQ-15 spills 189 experts over PCIe and OOMs past ~16K context, while Strata SQ-10 takes a noticeable quality hit (KLD 0.0720 / Top-1 92.35%) and doesn't persist prefix KV across requests/restarts.

Because Inkling-2-Mini executes its inner Loop-Core MoE layers (L6..17) 3× per token, ink4060ti uses asymmetric per-role quantization:

  • Loop-Core MoE (L6..17, 3×/token): kept 100% lossless native NVFP4 (SQNR = ∞ dB, cos = 1.000000)
  • Outer MoE (L0..5, L18..23, 1×/token): NF3_G32_E4M3 (3.25 bpw)
  • Dense Attention + Unembed: Q6_G32 (cos = 0.9997) · DSpark Drafter: Q8_G32 (cos = 0.99999)
  • Embed + Vision: 100% lossless BF16 (Vision loads lazily on demand = 0 MiB permanent VRAM, ~200 ms warm encode)

Measured on physical RTX 4060 Ti 16 GB (Windows 11 WDDM)

Metricink4060ti (12g-tight + k4v4)Strata SQ-10 (0.1.67)Strata SQ-15 (0.1.67)
GPU Weights + Drafter12,553 MiB (0 spill)13,322 MiBSpills 189 experts (942 MB PCIe)
Max Full-VRAM Context156,576 tok (auto, 0 spill)100K (manual)16K (OOM beyond)
Quality vs Lossless (sq15-lossless)KLD 0.0216 / Top-1 96.90% (k8v4: 0.0138 / 97.38%)KLD 0.0720 / Top-1 92.35%KLD 0.0107 / Top-1 96.68%
Prefill (2K / 16K / 64K / 100K / 150K)1,956 / 1,810 / 1,497 / 1,316 / 1,136 tok/s1,563 / 1,378 / 970 / 790 / —962 / OOM
Decode (DSpark ON)53–62 short · 46–55 (16K–64K) · 28.6 (150K)79–95 short · 56.8 (64K)39.5–42.0 tok/s
Prefix Reuse & SSD Restart99%+ reuse · 4.9s (64K) / 9.2s (150K)Unsupported (reused=0)Unsupported
Vision (Screenshots / 4K)0 MiB permanent VRAM (~200 ms warm)Permanent VRAMSupported
  • Huge dual gain: 3.3× lower KLD than Strata SQ-10 (0.0216 vs 0.0720, 150K needle recall EXACT PASS) + +25% to +67% faster prefill (2× faster than SQ-15) + 156K zero-spill context + 200 GiB SSD 3-tier cache (VRAM ↔ 25% RAM ↔ SSD). (Honest trade-off: raw short-prompt decode still trails SQ-10's 79–95 tok/s.)
  • Zero-config portable Windows ZIP (5.6 MiB): No CUDA Toolkit, Python, or VC++ redist needed — extract and double-click start.bat (auto-picks HuggingFace vs hf-mirror.com + SHA-256 verify, opens Web UI at 127.0.0.1:18088).
  • Coding Agent Ready: Native Anthropic /v1/messages + count_tokens + thinking + tools + vision (drop-in for Claude Code) & OpenAI /v1/chat/completions (Cursor / Cline / Roo Code).

Looking for RTX 5060 Ti 16 GB (sm_120a) testers!

The portable binary includes a compiled Blackwell sm_120a native NVFP4 MMA path verified against NVIDIA CUTLASS SM120_16x8x64_TN_VS specs and full model scale bounds, but I don't own a physical 5060 Ti — so 5060 Ti support is theoretical/untested (Experimental). If you have a 5060 Ti 16 GB on Windows and want to test it (INK4060_DISABLE_SM120_FP4=1 falls back to BF16 Tensor Core), feedback and benchmark issues are very welcome!


r/CUDA • • 6h ago

[Open Source] Virtualizing a 16 TB FP16 cuFFT into 450 MB VRAM (71.1x speedup, 1.03 ms/batch) + Tensor-Core Beam-CVP on a 4 GB RTX 3050 Laptop

2 Upvotes

I built an open-source CUDA benchmark suite (MIT License) exploring extreme memory virtualization and mixed-precision GPU computing on a **4 GB VRAM RTX 3050 Laptop** (`sm_86`, 15 GB RAM), applied to the 256-bit ECDSA Hidden Number Problem (Bleichenbacher Fourier + Albrecht–Heninger lattice CVP, synthetic test vectors only).

**GitHub Repo:** https://github.com/jcube2024/secp256k1-gpu-audit

### Key CUDA / Systems Optimizations

  1. **`v4 FP16 cuFFT` (`71.1×` speedup over v1 FP32, `1.03–1.16 ms` per `2^22` batch):**

    - Virtualizes a **`2^40`-point (`16 TB`)** DFT into **`~450 MB` VRAM** via CSR binning (`4 B/pair`: 18-bit high index + 14-bit quantized phase).

    - `K = 8` register-level complex phase recurrence (eliminates redundant `__sincosf` calls).

    - Mixed-precision accumulation in FP32 registers + `1/32` pre-scaling into `CUDA_C_16F` (`__half2`) avoids FP16 overflow while preserving exact FP32 SNR (`8.99`).

  2. **GPU `CUB DeviceRadixSort` + Merge Wagner (`30.0×` vs 16-core CPU):**

    - `32M`-element Wagner merge round drops from `1.354 s` (`__gnu_parallel::sort`) to **`0.045 s`** on RTX 3050 (100% bit-exact).

  3. **5-Bucket NVMe Streaming Merge (`< 5 GB` RAM):**

    - Processes `600M` virtual pairs on a 15 GB RAM laptop with monotonically shrinking SSD footprint (`19.2 GB → 9.6 GB → 0 GB`).

  4. **cuBLAS TF32 Tensor-Core `Beam-Sieve-CVP` + GPU 256-bit Predicate:**

    - Solves batched nearest-neighbor search over `G6K` lattice sieve databases (`R @ U^T`) + FP64 GPU Babai-lifting in `0.21 s`.

Includes 8 standalone `.cu` engines (`make -j4 all`), a patched CUDA 12 `G6K-GPU-Tensor`, and a 4-part technical writeup. Happy to discuss any of the CUDA kernel details!


r/CUDA • • 8h ago

Libxc 7.1.2's GPU build keeps functional data in managed memory, so GPU DFT segfaults or runs at half speed when concurrentManagedAccess = 0 (WSL2, Windows)

1 Upvotes

This came up while building the GPU engine for an open-source quantum chemistry app, and it may save someone a debugging session.

Libxc is the exchange-correlation functional library that most DFT codes use, and GPU4PySCF ships a CUDA build of Libxc 7.1.2 (gpu4pyscf-libxc-cuda12x 0.9.0). That build keeps functional parameter data in CUDA managed memory, and the host reads it between kernel launches. On a GPU where concurrentManagedAccess is 0, which includes GPUs under WSL2 and on native Windows, the host can't touch managed memory while kernels are in flight. GPU DFT then segfaults, and it only runs with CUDA_LAUNCH_BLOCKING=1, at about half speed.

The patch keeps that data in host memory and allocates the device buffers with cudaMalloc. The engine tests check that the patched libxc.so never calls cudaMallocManaged.

Measured on an RTX 3070 under WSL2 (driver 610.88), B3LYP-D3(BJ)/def2-SVP optimisation plus frequencies, median of three runs:

  • Unpatched with synchronous launches: water 46.1 s, ethanol 101.3 s
  • Patched with normal launches: water 22.9 s, ethanol 46.1 s
  • Energies match the CPU to within 1e-10 Eh

The cause and fix are reported to Libxc (https://gitlab.com/libxc/libxc/-/issues/647) and GPU4PySCF (https://github.com/pyscf/gpu4pyscf/issues/1067). Libxc's maintainer replied that Libxc 8 rewrites GPU support as templated C++, so a 7.x fix is unlikely, and the engine carries the patch until a Libxc 8 build passes its tests.

The patch, the build stage and the measurements are in the repo: https://github.com/quachem/quachem-workbench/tree/main/docs/evidence/2026-11-26-libxc-engine-patch

This was debugged and written up with a lot of help from Claude.


r/CUDA • • 22h ago

Compiling Python to SASS

Thumbnail a-r-r-o-w.github.io
11 Upvotes

r/CUDA • • 22h ago

Remote Async CUDA/GPU Kernel, Open-Source GitHub Maintainer & Algorithmic Coding Contracts ($50-$200/hr USD)

6 Upvotes

For GPU/CUDA kernel engineers, active GitHub open-source maintainers, and competitive programmers (Codeforces/Kaggle)

I started a side project that tracks remote work on 15+ platforms, and there's currently roles offering $50-$120/hr USD for CUDA/GPU kernel engineering, and $45-$120/hr USD for algorithmic problem setters and Kaggle medalists.

Basically if you send me a brief blurb with your country, degree, years of experience, tGitHub/CUDA/CP (i.e. technologies) background (no personal information please), I'll send you a custom Google doc with a list of referrals to roles that match your information. I also provide guides for each of the platforms to help with onboarding.


r/CUDA • • 1d ago

One kernel addressing a VRAM region and a pinned system-RAM region at once

6 Upvotes

Repo: https://github.com/Furox-Art/vram-stream - MIT, 0.4.0.

Install: python -m pip install vram-stream or npm install -g vram-stream - both registries carry 0.4.0.

The pattern this wraps is the mapped-memory one: allocate a pinned host buffer with the device-mapped flag, get its device pointer, and pass it to the kernel alongside a normal device allocation. Two addresses, one kernel, no explicit memcpy between them. The library turns that into a workspace object so you are not hand-rolling the attribute flags and the context bookkeeping each time.

The self-check is the part I would run first, since mapped memory is where driver and platform differences show up:

vram-stream memory --device 0 --vram-mib 16 --ram-mib 16

It allocates both regions in the selected context, launches one kernel that combines values read from VRAM and system RAM, writes results back to both, synchronises, and verifies the first and last aligned 32-bit word of each region. The bundled PTX kernel is compiled by the driver at run time, so nothing is precompiled against a specific CUDA version. From Python, open_cuda_workspace(vram_bytes=..., ram_bytes=...) exposes vram_device_pointer, ram_device_pointer and gpu_accessible_bytes, releases both on exit and restores the calling thread's previous context.

For repeated reads there is a block cache (open_cuda_cache): one pinned RAM buffer and one VRAM buffer per slot, copies and kernels on separate streams, CUDA events protecting the pinned buffer while a prefetch is in flight.

The limit is the link. Mapped RAM traffic crosses PCIe or NVLink at that link's bandwidth and latency, and the driver and OS cap how much you can pin, so this pays off for read-mostly data with locality you can plan for - not as a general replacement for keeping a working set in VRAM.


r/CUDA • • 1d ago

How do you test CUDA code on a remote GPU when using Claude Code or Codex?

10 Upvotes

I use Claude Code on my laptop, but my GPU is in Colab. I used to copy each kernel change into the notebook, run it, and paste the error or benchmark numbers back into Claude.
How does that work in your setup? Can your agent launch the GPU run and read the output itself? If so, how did you connect the two?


r/CUDA • • 2d ago

Compiler explorer now supports Java to CUDA and cuTile with Tornadovm

Post image
6 Upvotes

r/CUDA • • 2d ago

How to get a job?

26 Upvotes

Hey guys, I want to get a job as an Inference Engineer/ CUDA Programmer. I’m currently working as an AI and Data Engineer at a Vehicle Parts company in USA. I have been learning CUDA since the beginning of this year, I started with Metal(Apple) then shifted to CUDA, have a few good PRs and have 3 open PRs in vLLM. I would like your suggestion on what I can do differently and what I should do to get a job in Inference. My target is May-June next year as it will be 1 year at my current company.


r/CUDA • • 2d ago

Scaling from a single GPU to multi-GPU and multi-node systems | Free webinar

13 Upvotes

We're hosting a free technical webinar with Henry Wu, Henry Wu, Executive Director on ML/AI at Wells Fargo and bestselling author of Distributed AI Systems on December 5 at 11 AM ET.

The session will explore:

  • Scaling workloads across multiple GPUs and nodes
  • Inter-GPU communication and performance bottlenecks
  • Data, tensor and pipeline parallelism
  • GPU memory management and utilization
  • Experimenting with distributed workloads using affordable cloud GPUs

Thought this might be useful to those working with GPU computing and distributed systems.

Free registration: From One GPU to Thousands


r/CUDA • • 2d ago

Does HIP add overhead on NVIDIA? I timed two CaRtGS builds on one RTX 4090

3 Upvotes

I expected the benchmarks to settle whether I should worry about the HIP source path on NVIDIA. What I came away with was a better question about how to measure sub-percent differences.

We replayed six captured CaRtGS rasterizer backward workloads on one RTX 4090. Both builds used CUDA 12.8, CUDA LibTorch, and CCCL 2.8.2. The HIP source path still builds with nvcc and uses the CUDA runtime on this card. CaRtGS upstream · AMD HIP compilation and platforms

Saved workloadCUDA median (ms)HIP median (ms)Median paired change
Replica room0 · step 1000.197090.19661−0.28%
Replica room0 · step 5000.329360.32893−0.11%
Replica room0 · step 1,5000.356270.35701+0.24%
TUM fr1/desk · step 1000.130100.12956−0.42%
TUM fr1/desk · step 5000.208250.20815−0.04%
TUM fr1/desk · step 1,5000.216270.21621+0.02%

The metric is synchronized host wall time around one backward API call, including host-side launch work, any allocations inside the call, and synchronization. Four interleaved pairs per workload, 30 samples per mode per pair after warm-up. The percentages are medians of the paired ratios. Negative favors HIP. One early Replica pair came out at −15.47% and stayed in the calculation.

As a sanity check, the 300-frame Replica mapping run took 12.28–12.31 s with the HIP source path and 12.33–12.35 s with the CUDA source path. Two runs per mode, 2,900 mapper updates each. That’s a small pilot, so I’m treating the sub-percent differences as descriptive.

The reason I care is maintenance. CaRtGS and RTG-SLAM both build on Graphdeco’s original differentiable rasterizer. Their implementations share the same CUB inclusive scan and radix-sort calls for binning splats by image tile and depth. That gives us a concrete place to share a HIP wrapper and test, while keeping each project’s specialized kernels. CaRtGS rasterization code · RTG-SLAM depth rasterization code · My RTG-SLAM ROCm port

If you’re writing a new custom GPU kernel for a paper or side project, try starting with HIP and adding both build targets while the kernel is still small. On NVIDIA you can still use nvcc, CUDA libraries, and your usual profiling tools. Keep vendor-specific primitives behind a small interface, and check the same saved inputs on both GPUs.

I’m sharing the project with a few GPU communities. I’m posting here specifically for feedback on how we measured the NVIDIA builds.

For those who benchmark this kind of change, would you start with CUDA events around the individual GPU stages, longer interleaved batches, or both?


r/CUDA • • 3d ago

Why the gap with Mac?

5 Upvotes

Doing generative video (like ComfyUI + MiniMax) on Mac seems to be much slower than running on a similarly-priced Nvidia GPU.

Is this just an inherent tradeoff in how Apple is architecting their chips, and what they’re optimizing for?

Or is the gap likely to be closed over time as the kernels and other software elements mature for Metal, etc?

Local AI is a very exciting space, and Mac + generative media seem like a very natural fit. But their current performance with gen video seems much more limited thank what RTX cards can do.

This isn’t intended to bash on Mac - I love the Mac. I just want to better understand how likely it is to achieve parity with Nvidia/CUDA, specifically for video. Any insights from CUDA/Metal peeps?


r/CUDA • • 3d ago

Learning CUDA @ 16 yrs w/ 8gb 50 series

Post image
32 Upvotes

I just bought my first NVIDIA card in hopes of learning cuda programming, I'm already knowledgeable in C and C++ but is this a good choice? 5060 Ti 8gb (sadly not the 16gb) and I think it'd be a decent card for basic stuff related to cuda or other things like LLM hosting.

I plan on taking some free courses to earn some certifications and do my own studies about the coding languages and CUDA as a whole, opinions on the matter, tips, or questions?

PM on Discord for more info: someoneresides
Email: r2wosolution@gmail.com
Icloud: r2wosolution@icloud.com


r/CUDA • • 4d ago

PSA: NVIDIA DGX Spark has terrible CUDA & software compatibility; and seems like a handheld gaming chip.

Thumbnail reddit.com
0 Upvotes

r/CUDA • • 6d ago

Built a ternary (BitNet-style) inference engine in Rust/CUDA: 8x faster than dense f32 on one CPU core. Looking for GPU testers

Thumbnail reddit.com
1 Upvotes

r/CUDA • • 6d ago

Sm_120 RTX 5070 causal conv1d and Ssm wheels

6 Upvotes

RTX 5070/5080/5090 (sm_120, compute 12.0) currently fails with "no kernel image is available" because setup.py only builds for 70;80;90.

I built working wheels for Blackwell:

\- Patch: TORCH_CUDA_ARCH_LIST=12.0 and replace sm_70/sm_80/sm_90 with sm_120 in setup.py

\- Tested on 5070 WSL2 + torch 2.11.0+cu128 + py3.10

\- Wheels here for anyone stuck: https://github.com/Rapa2026/mamba-ssm-5070-blackwell-wheels

Happy to PR the sm_120 fix if you want it.

Test: Mamba2(d_model=64).cuda() -> OK


r/CUDA • • 6d ago

Replaced most inline PTX with MLIR ops, cutting asm regions from 499 to 81 across 20 kernels.

12 Upvotes

While building a high-level language with a rich type system, a core goal is reducing the need for low-level escape hatches like inline asm.

In glm-vx(GLM-5.3 serving engine with kernels in Vx-lang, checkpoint loading, and streaming HTTP), we replaced most inline PTX with MLIR ops, cutting asm regions from 499 to 81 across 20 kernels.

When LLVM sees the surrounding code, it can simplify logic and cut spills thus generating better code.

e.g., A bf16 store. The epilogue of the GEMM converts each f32 result to bf16 and stores 16 bits. The asm converted into a 16-bit register and then widened it to 32 bits with cvt.u32.u16, only for the store to use the low 16 bits again. Now the store takes the 16-bit register, and fp8_gemm_m64 has 64 fewer instructions:

// before
{ .reg .b16 h; cvt.rn.bf16.f32 h, %r393; cvt.u32.u16 %r199, h; }
st.global.b16  [%rd65], %r199;

// after
cvt.rn.bf16.f32  %rs1, %r327;
st.global.b16    [%rd74], %rs1;

But when hoisting/reordering hurts (like %laneid or mma scheduling on H200), we have no option to keep the asm. Link to the full writeup in comments.

EDIT:

the generated SASS was also better in the topk examples from the post but in the above case it was identical.


r/CUDA • • 6d ago

why it's so hard to make SASS assembler?

Thumbnail redplait.blogspot.com
17 Upvotes

summary:

  • only ~80% of ELF sections currently known
  • ~50% of EIATTRs
  • instruction scheduler is highly gpu specific and can't be implemented based on llvm machine scheduler. And np-hard

r/CUDA • • 7d ago

Tencent gave Google's Guetzli a GPU. I volunteered to keep it alive. v3.0.0 is out.

Thumbnail reddit.com
3 Upvotes

r/CUDA • • 8d ago

exact-gpu-jpeg: CUDA JPEG decode/encode that’s byte-identical to libjpeg-turbo and Pillow

8 Upvotes

GPU JPEG decoders are fast, but their pixels differ from the CPU libraries'. On 102 public test images, nvJPEG matched libjpeg-turbo on none of them, by up to 110 levels at 4:2:0. That quietly breaks reproducible ML pipelines, test baselines and caches whenever decoding moves between CPU and GPU.

exact-gpu-jpeg decodes on the GPU and returns libjpeg-turbo's pixels byte for byte (accurate IDCT, fancy upsampling), and its encoder writes the same bytes as Pillow. Anything it can't reproduce exactly, progressive files for example, goes to libjpeg-turbo itself, so the output is always the reference.

On a 2016 GTX 1070: a 30 MP camera photo decodes in 11.3 ms, against 185 ms for libjpeg-turbo on one core and 164 ms for nvJPEG on the same card. Batches of small images: 7,310 images/s. Encoding: 5.5x faster than Pillow with identical files.

Where it loses is listed near the top of the README: one small image at a time, small encodes against 8 CPU threads, progressive files. Everything so far is from one machine, so results from other GPUs are very welcome: `python bench/reproduce.py --quick`, and there's a pinned issue for them.

The parallel Huffman stage (Weißenberger & Schmidt's self-synchronising method) is drawn in docs/huffman-sync.md, and there's a white paper in docs/ covering the method, the evidence and the limits.

https://github.com/mrluker/exact-gpu-jpeg


r/CUDA • • 8d ago

My CPU won all 38 final-state tests. The RTX 5060 pulled ahead when I returned every step.

0 Upvotes

I’m working on Ohio at Primitive. I wanted to see where an RTX 5060 actually beats native C for a simple workload: update a lot of integer states and get the results back to the host.

When I only returned the final state, the CPU had the lower median in all 38 test conditions.

When I returned every step for 100,000 entities over 120 updates, the GPU pulled ahead on both seeds. On seed 97, it was 10.50 ms on the RTX 5060 with PyTorch CUDA vs 14.43 ms in native C. The outputs matched exactly. Those are warm timings with transfers included.

One thing I’d change before running it again: I returned 12 million states as int64. Every value fits in a byte, so the output could go from 96 MB to 12 MB.

If you were running that comparison, what CPU and CUDA implementations would you put side by side for the uint8 run?

[Primitive’s public GitHub](https://github.com/Primitivelabai/primitive-open). The code and timing logs for this run are still private.