Top Tweets for #cuBLAS
finally implemented the RXTX algorithm using triton (2.11x speedup)
benchmark (8192 x 8192):
cuBLAS (torch) : 60.280 ms
Triton TC : 28.603 ms
code - https://t.co/Zj3FjJnquF
paper - https://t.co/wyNMzwjIuL

Just came across a CUDA course that’s worth more than most CS degrees 😮💨
It’s 12 hours long, completely free, and finally explains GPUs the way engineers wish they were taught.
No fluff. No “just use this library.”
You actually build the same MLP trainer four times:
→ PyTorch
→ NumPy
→ C
→ CUDA
Same model. Same dataset.
Four levels deeper each time.
By the end, you understand why PyTorch is fast.
And it covers the stuff nobody teaches:
- How GPU architecture really works
- Writing kernels that aren’t painfully slow
- Profiling like a systems engineer
- When cuBLAS helps (and when it doesn’t)
- CUDA vs Triton (huge)
- PyTorch extensions that actually matter
It’s the kind of course that turns you from “API user” into “GPU engineer.”
If you’ve been meaning to level up your low-level ML skills…
this is the one.
Who’s starting this weekend?

NVIDIA CUDA 13.1 released December 2024.
Key changes:
-Version renumbered from 13.2 → 13.1 to avoid future 13.13 confusion
-Full production support for NVIDIA GH200 Grace Hopper Superchip
-New L2 cache management APIs: persistent lines, cache hint instructions, and set-aside controls
-Significantly faster multi-GPU peer-to-peer access on systems with NVSwitch/NVLink
-Enhanced FP8 and INT8 tensor core performance in cuBLAS and cuDNN
-New cooperative group algorithms and stream-ordered memory allocators
-Python wheels now include Python 3.12 support
Removed support for compute capability 5.0 and 5.3 (Maxwell GPUs)
Delivers measurable speedups for large-scale training and inference on H100, L40S, and GH200 clusters when paired with latest PyTorch, Triton, and cuDNN builds.
Day 22 of CUDA: (experiment on RTX 4060)
>Occupancy ~67%, limited by registers, shared memory, and block warps.
>GPU compute usage ~84% (near peak).
> ~7.9 TFLOPS
>L1 heavily used & DRAM usage low.
>finally realized the need for using cuBLAS to peak the performance. Stay tuned people.

Day 21 of CUDA:
>maxxing out things in CUDA and getting expected TFLOPS is damn tough.
>one side project in this language is enough to reboot my 20 days journey.
>familiarizing with @ubuntu 's nsight compute currently for the project
>it will probably take 2-3 days to drop the repo with my expected results.

Day 11 of CUDA Programming:
>Basic tiled SGEMM: ~2 TFLOPS (13% efficiency)
>CuBLAS: ~13 TFLOPS (86% efficiency).
>Lesson: Tensor Cores + fusion = massive gap.
>just 2 more sem-end exams, to fully lock in on this.

Day 10 of CUDA Programming:
>attempted ReLU on @LeetGPU
>applied naive matrix mul from Day 2 of @Anshul627 CUDA series on 4060
>throughput (CuBLAS): ~7.5 TFLOPS
>I am on pretty familiar with beginner level (good with terminologies of CUDA)

Hi Everyone,
I'm creating a 30-day CUDA programming video series, with daily uploads. Till now, I have finished two.
The first covers a hello world and vector addition kernel to start your CUDA journey.
The second implements a naive matrix multiplication kernel, comparing its performance with cuBLAS.
Tomorrow, we'll explore shared memory and other ways to optimize the naive kernel.
Video link in the reply

This is the second video in CUDA Programming Series.
We have covered writing a naive matrix multiplication kernel & comparing the performance with CuBLAS implementation.
👇 Link to the video in the replies. Do watch the part 1 too if you also want to start your journey.

Why NVIDIA’s Designs Are Architecturally Unbeatable :
1. NVIDIA’s AI compute dominance derives from end-to-end optimization:
custom ASICs, NVLink/NVSwitch fabrics, PTX/CUDA compilers, and TensorRT/cuDNN libraries form a co-optimized stack yielding exponential efficiency gains via hardware-software co-design iterations.
Parallel Compute Efficiency
Blackwell B200 integrates 144 SMs with 20,736 FP32 cores, delivering 4.5 PFLOPS FP8 dense (9 PFLOPS sparse).f0a565 Warp scheduling (32-thread SIMT) employs reconvergence stacks to mitigate divergence, achieving >95% occupancy in GEMM via cuBLAS. Asynchronous grids overlap compute/memory via streams, pushing roofline P = min(F_peak, I · B_mem) to compute-bound for AI (I ≈ 200–1000 FLOPs/byte). AMD CDNA3's wavefronts (64-thread) incur higher divergence penalties, limiting to 75% in MLPerf.327021
2. Tensor Cores and Mixed Precision :
5th-gen Tensor Cores execute 1024 FMAs/cycle on 8x8 matrices, supporting FP4/FP6/FP8 (E4M3) with TF32 accumulate. Quantization yields 4–8× speedup over FP32, with <0.05% accuracy loss in QAT-tuned LLMs via entropy-minimizing rounding. Sparsity engines prune 2:4 patterns, doubling effective FLOPs. AMD Matrix Cores lack native FP4/sparsity, requiring software emulation with 20–30% overhead.
3. Memory and Interconnect Bandwidth :
B200 provides 8 TB/s HBM3e from 180 GB, with NVLink-5 at 1.8 TB/s bi-dir per GPU.aa7fc0 NVSwitch-4 clusters 72 GPUs in GB200 NVL72 for 130 TB/s aggregate, enabling coherent access with <5 µs latency via RDMA/NCCL collectives (>98% all-reduce efficiency at 10^7 batch).b02f07 AMD MI300X's 5.3 TB/s HBM3 exceeds per-GPU, but Infinity Fabric's 10–20 µs cross-die latency bottlenecks scaling.bb70d0
https://t.co/7FQNDtl4cd
4. Compiler and Software Stack
CUDA :
12+ fuses kernels via NVRTC, specializing warps for ILP/TLP, and auto-quantizes via AMP for >97% saturation. TensorRT optimizes graphs with polyhedral fusion/polyhedral scheduling. ROCm's HIP fusion lags, yielding 60–80% in MLPerf v5.1 vs NVIDIA's 95%+.39ecb0
5. Co-Designed Systems :
DGX B200 unifies 8 B200s + Grace CPUs via NVLink, with 1.44 TB coherent HBM and 72 PFLOPS FP8.0dcc94 MIG partitions SMs for multi-tenancy, minimizing interference. Competitors' PCIe/InfiniBand incur 50–100× serialization latency.
6. Ecosystem Lock-In and Optimization Loop :
95% frameworks target PTX, with 10^6+ tuned kernels. Co-evolution loop: e.g., Transformer Engine accelerates QKV projections, feeding PyTorch updates. Porting to SYCL/ROCm demands 10^7 FLOPs-equivalent re-optimization.
Conclusion:
NVIDIA's dominance is a mathematical inevitability from architectural coherence: massively parallel SM arrays (O(10^4) cores) + Tensor Core precision scaling (O(10^3) FMAs/cycle) + NVLink's low-latency bandwidth (O(10^2) GB/s) + CUDA's optimization depth (>95% saturation) = unreplicable synergy. Competitors are not comparable due to fragmented ecosystems; AMD/TPU require fundamental rewrites to match CUDA's maturity, incurring exponential costs in time and accuracy. As AI scales to 10^15+ parameters, NVIDIA's co-evolved stack remains the structural optimum, with Blackwell further widening the gap through 10 TB/s die links and FP4 .
winter arc #3 (8.5hrs):
-> read deepseek-r1 paper
-> finished most of chapters in the rlhfbook
-> watched @hkproj vid on rlhf
-> contemplated some future paths
-> opinionated rl blog @jsuarez
-> went through cublas docs
-> watched @elliotarledge tensor core vids

I would like to share #rust GPU Kernel Batching -- a first-principles simulator to study optimization opportunities in modern inference engines in isolation:
⚡ Lock-free shared memory queue
⚡ Shape-based strided batching
⚡ 90%+ fewer launches in decode
⚡ 22% faster FP16 workloads
It strips everything down to just the kernel launch bottleneck, showing how batching identical GEMMs into one cuBLAS call slashes overhead. Modern engines already do many such optimizations - this was about understanding the barebones mechanics.
GH repo in comments.
Achieved 93.5K ops/sec & 0.011ms latency using shared memory + float4 vectorization for small-batch financial ML inference on a GTX 1650!
7.3× faster than PyTorch/cuBLAS Consumer GPU: GTX 1650 Sub-ms latency
📖 Article: https://t.co/nAH49rwJJF
🔗 GitHub: https://t.co/ndXSAzLQit
https://t.co/h8TrkQnLsQ Below is a deep dive into the unique capabilities D brings to building and deploying neural networks and large-language models—capabilities you won’t find (or won’t find as easily) in C++ or Python—and how those translate into real-world business advantages across development time, infrastructure cost, forecasting accuracy, and robustness.
1. Compile-Time Graph Specialization & Metaprogramming
What D offers
Compile-time function mixins & UDA
Define network layers, activation functions, and even entire computation graphs in D’s template-mixins or via User-Defined Attributes (UDAs).
The compiler “bakes in” constant shapes, unrolls loops, and inlines operations without runtime dispatch.
Why C++/Python can’t match it
C++ templates are powerful but syntactically heavy and error-prone. Python’s dynamic graphs (PyTorch) or static graphs (TF) rely on a separate graph-build API and JIT, adding runtime overhead or warm-up cost.
Business impact
Development time is shortened: one language, one build step, zero boilerplate graph-definition DSL.
Inference latency drops by up to 10–30% on small-batch or single-request workloads (no JIT warm-up; zero virtual calls).
Forecasting pipelines that must serve thousands of small inference calls per minute see a direct cost saving from fewer compute‐node hours.
2. Optional, Configurable Garbage Collection
What D offers
GC is on by default but can be completely disabled or confined to non‐critical modules.
Built-in scoped allocators (std.experimental.allocator) let you pre-allocate tensor buffers or memory pools, avoiding any pause during live inference.
Why C++/Python can’t match it
C++: pure manual memory management or smart pointers—safe but verbose.
Python: global interpreter lock (GIL) + GC pauses; even “no GC” modes (like PyPy sandboxing) still incur unpredictability.
Business impact
SLA compliance: no out-of-band GC pause means 99.9th-percentile latency targets are rock solid.
Compute economics: shave off “over-provisioning” margin that’s normally kept to absorb GC jitter—fewer instances required at peak.
3. Single-Binary, Zero-Dependency Deployments
What D offers
Statically link your model code, math libraries (Mir), and even CUDA drivers into one executable.
No Python runtime, no wheel compatibility issues, no container “bloat.”
Why C++/Python can’t match it
C++ often still drags in dozens of shared libs or requires careful version pinning.
Python inherently depends on a separate interpreter, plus pip wheels for tens of dependencies.
Business impact
Deployment time: cut CI/CD rollback risk by removing runtime mismatches.
Operational cost: smaller container images (100 MB vs. 1–2 GB) ⇒ faster cold starts in Kubernetes or AWS Lambda, lower storage fees.
Forecast reproducibility: precise version-for-version parity between dev/staging/prod.
4. Unified CPU/GPU Code Path with Minimal FFI Overhead
What D offers
You write tensor ops in D slices; at compile time you tag kernels for CPU vs. GPU.
extern(C) calls to cuBLAS/cuDNN incur zero trampoline overhead.
Why C++/Python can’t match it
C++: you still need to switch between host and device code, manage streams manually, and write boilerplate kernels.
Python: PyBind11 or CFFI wrappers add ~10–50 µs per call, hurting sub-batch throughput.
Business impact
Prediction throughput on GPUs improves by 5–15%, especially for micro-batch sizes.
Cost per query falls, since you extract more operations per GPU-hour.
5. Deterministic Builds & Reproducibility
What D offers
Full control of compiler flags, allocator strategy, and graph-generation at compile time.
No hidden JIT caches or Python environment drift.
Why C++/Python can’t match it
C++ reproducibility is good but still depends on system package versions.
Python dependency hell (even with virtualenv/Conda) can slide in GPU-library mismatches.
Business impact
Forecast accuracy audits become straightforward: exact same binary = exact same numerical behavior.
Regulated industries (finance, healthcare) gain easier certification and fewer compliance headaches.
6. Integrated Parallelism & Vectorization
What D offers
std.parallelism for task-parallel loops + core.simd for explicit SIMD types—all in-language.
GPU offload directives via community packages (e.g. cuda-d).
Why C++/Python can’t match it
C++: you choose between OpenMP (external pragma), TBB, or CUDA; each comes with its own build setup.
Python: limited to high-level parallelism (multiprocessing, asyncio) and relies on C extensions for SIMD.
Business impact
Forecasting models that blend CPU pre-/post-processing with GPU inference can share data buffers and threads seamlessly.
Time-to-market for hybrid pipelines (e.g. streaming data → preprocess → inference → postprocess) shrinks by weeks.
7. Predictive Cost Modeling & Grounded Robustness
Example: Time-to-Value Forecast
D Build: 30 min compile (once), single deployable.
C++ Build: 45 min compile + manual link fixups.
Python Deploy: 5 min build + 60 min environment cert tests.
Result: D saves ~75 min per release cycle in CI, translating to ~1.25 developer-days per month.
Example: Inference Cost per Million Queries
D: 200 µs latency, 5 instances @ 4 vCPU each → $500/month.
Python: 300 µs latency, 7 instances @ 4 vCPU each → $700/month.
Economics: $200/mo saving = $2.4k/yr per model endpoint.
Conclusion
D combines the raw speed and control of C++ with the metaprogramming expressiveness and developer ergonomics that Python aspires to. You get:
Faster dev cycles through compile-time graph generation.
Rock-solid SLAs via optional GC and deterministic builds.
Lower infra spend with tiny binaries, zero wrapper overhead, and unified CPU/GPU code.
Clear audit trails for forecasting accuracy in regulated sectors.
If your business depends on sub-millisecond inference, tight cost controls, and bulletproof reproducibility—especially in streaming-prediction or high-frequency inference settings—D’s unique feature set can drive both technical and financial ROI that C++ or Python simply can’t match out of the box.
Below is a deep dive into the unique capabilities D brings to building and deploying neural networks and large-language models—capabilities you won’t find (or won’t find as easily) in C++ or Python—and how those translate into real-world business advantages across development time, infrastructure cost, forecasting accuracy, and robustness.
1. Compile-Time Graph Specialization & Metaprogramming
What D offers
Compile-time function mixins & UDA
Define network layers, activation functions, and even entire computation graphs in D’s template-mixins or via User-Defined Attributes (UDAs).
The compiler “bakes in” constant shapes, unrolls loops, and inlines operations without runtime dispatch.
Why C++/Python can’t match it
C++ templates are powerful but syntactically heavy and error-prone. Python’s dynamic graphs (PyTorch) or static graphs (TF) rely on a separate graph-build API and JIT, adding runtime overhead or warm-up cost.
Business impact
Development time is shortened: one language, one build step, zero boilerplate graph-definition DSL.
Inference latency drops by up to 10–30% on small-batch or single-request workloads (no JIT warm-up; zero virtual calls).
Forecasting pipelines that must serve thousands of small inference calls per minute see a direct cost saving from fewer compute‐node hours.
2. Optional, Configurable Garbage Collection
What D offers
GC is on by default but can be completely disabled or confined to non‐critical modules.
Built-in scoped allocators (std.experimental.allocator) let you pre-allocate tensor buffers or memory pools, avoiding any pause during live inference.
Why C++/Python can’t match it
C++: pure manual memory management or smart pointers—safe but verbose.
Python: global interpreter lock (GIL) + GC pauses; even “no GC” modes (like PyPy sandboxing) still incur unpredictability.
Business impact
SLA compliance: no out-of-band GC pause means 99.9th-percentile latency targets are rock solid.
Compute economics: shave off “over-provisioning” margin that’s normally kept to absorb GC jitter—fewer instances required at peak.
3. Single-Binary, Zero-Dependency Deployments
What D offers
Statically link your model code, math libraries (Mir), and even CUDA drivers into one executable.
No Python runtime, no wheel compatibility issues, no container “bloat.”
Why C++/Python can’t match it
C++ often still drags in dozens of shared libs or requires careful version pinning.
Python inherently depends on a separate interpreter, plus pip wheels for tens of dependencies.
Business impact
Deployment time: cut CI/CD rollback risk by removing runtime mismatches.
Operational cost: smaller container images (100 MB vs. 1–2 GB) ⇒ faster cold starts in Kubernetes or AWS Lambda, lower storage fees.
Forecast reproducibility: precise version-for-version parity between dev/staging/prod.
4. Unified CPU/GPU Code Path with Minimal FFI Overhead
What D offers
You write tensor ops in D slices; at compile time you tag kernels for CPU vs. GPU.
extern(C) calls to cuBLAS/cuDNN incur zero trampoline overhead.
Why C++/Python can’t match it
C++: you still need to switch between host and device code, manage streams manually, and write boilerplate kernels.
Python: PyBind11 or CFFI wrappers add ~10–50 µs per call, hurting sub-batch throughput.
Business impact
Prediction throughput on GPUs improves by 5–15%, especially for micro-batch sizes.
Cost per query falls, since you extract more operations per GPU-hour.
5. Deterministic Builds & Reproducibility
What D offers
Full control of compiler flags, allocator strategy, and graph-generation at compile time.
No hidden JIT caches or Python environment drift.
Why C++/Python can’t match it
C++ reproducibility is good but still depends on system package versions.
Python dependency hell (even with virtualenv/Conda) can slide in GPU-library mismatches.
Business impact
Forecast accuracy audits become straightforward: exact same binary = exact same numerical behavior.
Regulated industries (finance, healthcare) gain easier certification and fewer compliance headaches.
6. Integrated Parallelism & Vectorization
What D offers
std.parallelism for task-parallel loops + core.simd for explicit SIMD types—all in-language.
GPU offload directives via community packages (e.g. cuda-d).
Why C++/Python can’t match it
C++: you choose between OpenMP (external pragma), TBB, or CUDA; each comes with its own build setup.
Python: limited to high-level parallelism (multiprocessing, asyncio) and relies on C extensions for SIMD.
Business impact
Forecasting models that blend CPU pre-/post-processing with GPU inference can share data buffers and threads seamlessly.
Time-to-market for hybrid pipelines (e.g. streaming data → preprocess → inference → postprocess) shrinks by weeks.
7. Predictive Cost Modeling & Grounded Robustness
Example: Time-to-Value Forecast
D Build: 30 min compile (once), single deployable.
C++ Build: 45 min compile + manual link fixups.
Python Deploy: 5 min build + 60 min environment cert tests.
Result: D saves ~75 min per release cycle in CI, translating to ~1.25 developer-days per month.
Example: Inference Cost per Million Queries
D: 200 µs latency, 5 instances @ 4 vCPU each → $500/month.
Python: 300 µs latency, 7 instances @ 4 vCPU each → $700/month.
Economics: $200/mo saving = $2.4k/yr per model endpoint.
Conclusion
D combines the raw speed and control of C++ with the metaprogramming expressiveness and developer ergonomics that Python aspires to. You get:
Faster dev cycles through compile-time graph generation.
Rock-solid SLAs via optional GC and deterministic builds.
Lower infra spend with tiny binaries, zero wrapper overhead, and unified CPU/GPU code.
Clear audit trails for forecasting accuracy in regulated sectors.
If your business depends on sub-millisecond inference, tight cost controls, and bulletproof reproducibility—especially in streaming-prediction or high-frequency inference settings—D’s unique feature set can drive both technical and financial ROI that C++ or Python simply can’t match out of the box.
"Incredibly, the costs have come down dramatically over the last 5 years due to improvements in compute hardware (H100 GPUs), software (CUDA, cuBLAS, cuDNN, FlashAttention) and data quality (e.g. the FineWeb-Edu dataset)."
AGI will be achieved only and only if this trend holds.
In 2019, OpenAI announced GPT-2 with this post:
https://t.co/jjP8IXmu8D
Today (~5 years later) you can train your own for ~$672, running on one 8XH100 GPU node for 24 hours. Our latest llm.c post gives the walkthrough in some detail:
https://t.co/XjLWE2P0Hp
Incredibly, the costs have come down dramatically over the last 5 years due to improvements in compute hardware (H100 GPUs), software (CUDA, cuBLAS, cuDNN, FlashAttention) and data quality (e.g. the FineWeb-Edu dataset). For this exercise, the algorithm was kept fixed and follows the GPT-2/3 papers.
Because llm.c is a direct implementation of GPT training in C/CUDA, the requirements are minimal - there is no need for conda environments, Python interpreters, pip installs, etc. You spin up a cloud GPU node (e.g. on Lambda), optionally install NVIDIA cuDNN, NCCL/MPI, download the .bin data shards, compile and run, and you're stepping in minutes. You then wait 24 hours and enjoy samples about English-speaking Unicorns in the Andes.
For me, this is a very nice checkpoint to get to because the entire llm.c project started with me thinking about reproducing GPT-2 for an educational video, getting stuck with some PyTorch things, then rage quitting to just write the whole thing from scratch in C/CUDA. That set me on a longer journey than I anticipated, but it was quite fun, I learned more CUDA, I made friends along the way, and llm.c is really nice now. It's ~5,000 lines of code, it compiles and steps very fast so there is very little waiting around, it has constant memory footprint, it trains in mixed precision, distributed across multi-node with NNCL, it is bitwise deterministic, and hovers around ~50% MFU. So it's quite cute.
llm.c couldn't have gotten here without a great group of devs who assembled from the internet, and helped get things to this point, especially ademeure, ngc92, @gordic_aleksa, and rosslwheeler. And thank you to @LambdaAPI for the GPU cycles support.
There's still a lot of work left to do. I'm still not 100% happy with the current runs - the evals should be better, the training should be more stable especially at larger model sizes for longer runs. There's a lot of interesting new directions too: fp8 (imminent!), inference, finetuning, multimodal (VQVAE etc.), more modern architectures (Llama/Gemma). The goal of llm.c remains to have a simple, minimal, clean training stack for a full-featured LLM agent, in direct C/CUDA, and companion educational materials to bring many people up to speed in this awesome field.
Eye candy: my much longer 400B token GPT-2 run (up from 33B tokens), which went great until 330B (reaching 61% HellaSwag, way above GPT-2 and GPT-3 of this size) and then exploded shortly after this plot, which I am looking into now :)

C++製の数値計算ライブラリ"monolish"を開発してます
https://t.co/tE661NxkDq
ハードウェア、型、行列構造に合わせたコード変更をなくすことを目的としており、PythonやJuliaのような簡単なインタフェースで、MKL、 cuBLAS、cuSPARSE、cuSOLVER、BLAS、LAPACKを統一したAPIを提供します
C++製の数値計算ライブラリ"monolish"を開発してます
https://t.co/tE661NxkDq
ハードウェア、型、行列構造に合わせたコード変更をなくすことを目的としており、PythonやJuliaのような簡単なインタフェースで、MKL、 cuBLAS、cuSPARSE、cuSOLVER、BLAS、LAPACKを統一したAPIを提供します
Most Popular Users

Elon Musk 
@elonmusk
240.1M followers

Barack Obama 
@barackobama
118.6M followers

Cristiano Ronaldo 
@cristiano
114.4M followers

Donald J. Trump 
@realdonaldtrump
111.7M followers

Narendra Modi 
@narendramodi
106.9M followers

Rihanna 
@rihanna
98.6M followers

NASA 
@nasa
92.1M followers

Justin Bieber 
@justinbieber
91.7M followers

KATY PERRY 
@katyperry
89.9M followers

Taylor Swift 
@taylorswift13
83.9M followers

Lady Gaga 
@ladygaga
75.4M followers

Virat Kohli 
@imvkohli
73.3M followers

Kim Kardashian 
@kimkardashian
70.8M followers

YouTube 
@youtube
68.6M followers

Neymar Jr 
@neymarjr
66.3M followers

Bill Gates 
@billgates
65.2M followers

Selena Gomez 
@selenagomez
63M followers

The Ellen Show
@theellenshow
62.1M followers

CNN 
@cnn
61.7M followers

X 
@x
60.6M followers













