Why a gaming graphics card can run AI at home
A graphics card is a crowd of small workers. One RX 7900 XTX with 24 GB held a 27B model at 17.0 GB peak, but a 21 GB model left almost no room for anything else.
Posts with this tag: 17
A graphics card is a crowd of small workers. One RX 7900 XTX with 24 GB held a 27B model at 17.0 GB peak, but a 21 GB model left almost no room for anything else.
On our 7900 XTX, 55 to 68 percent of flash attention's wave cycles went to the LDS, a small shared memory. Packing the intermediate results into registers cut the forward kernel by 22 to 24 percent and the dq kernel by 17 percent, byte for byte equal. A fused backward kernel was withdrawn on arithmetic.
A strided tensor layout made AOTriton attention run 6 times slower than on the same data made contiguous. One small custom node that makes the data contiguous fixed it, and two hand-built kernel rewrites bought nothing.
Circular padding makes a texture tile but changes what SDXL draws. Our default is now a plain render, a half-roll and a seam-band inpaint, with a checker that fails real seams.
Game-sized settings, one environment variable for a spinning math library, and a different attention backend took one prop from 325 s to 84 s. Each step was measured, checked and looked at.
A Goose version of the nearest-triangle search ran in 0.79 s against 3.63 s for scipy, but only after we split the tree build from the queries. In the real pipeline it saved 1.4 s per prop.
Noise images from a LoRA at the wrong strength, a cache that times itself, a silently dropped graph branch, a node pack that vanished, and a LoRA trained inside ComfyUI in 4.5 minutes. Each has a cheap guard.
Memory budget flags, int8 weights and a step and size sweep did the work. A roofline calculation showed that a faster kernel could not reach 2 seconds, and a 2 second polling loop was hiding in every timing.
GPU idle was 60 percent of decode wall time, and the largest share was host-to-device copies running at 3.1 to 3.4 GB/s against 28.5 GB/s on a healthy boot. The root port negotiated 2.5 GT/s. Several timed A/Bs from that boot are void, one fusion ratio survives, and the machine is still on the slow link.
Std.math exp disagreed between the CPU and the GPU on 19,437 of 40,017 inputs. A shared exp written with explicit fma matched on all 40,017, at 3.6 times the cost in an exp-bound kernel. One attention layer then matched bit for bit, and a float Freivalds certificate caught every planted fault.
The fused q4x kernels cut 1244 dispatches per decode token to 992, behind a gate that had never been red. One nudge of about 5e-7 per kernel turned it red three times, each time naming its own kernel. The identity check beside it has still never been seen to fail.
Four days of a wrong verdict ("unusable with our Mojo kernels") ended when we unbound the integrated GPU. A plain kernel then read SQ_WAVES 32,768 exactly, and a second fault, counters reading zero, came out from behind the first.
40.0 GB read and 15.9 GB written per launch is 59 to 87 percent of the card's bandwidth, depending on which clock mode you trust. By the review's estimate the biggest items are repeated reads of factors and vectors, not the Jacobian we blamed.
Mojo has no ray-tracing API, yet a 20-line probe emits image_bvh_intersect_ray for gfx1100. The probe is compile only, with an all-zero descriptor and one component set, so it proves reachability and nothing more.
A day with 142 GPU jobs and 34 failures, and a week of incidents that never needed the GPU to find. The fix is not a faster GPU, it's treating the card as a shared, budgeted resource with a preflight step before anything touches it.
Square GEMM is the benchmark everyone runs; decode is M=1 streaming weights out of GDDR6 memory. Four frozen rounds, three wrong predictions, and a one-percent win that came from occupancy relief rather than fewer bytes.
Um GEMM WMMA fp16 encadeado supera o hipBLASLt em dez tamanhos de grelha no RDNA3, mas só depois de a forma do tile deixar de ser fixa. Mais uma afirmação de 2x retirada e por que o aquecimento do relógio valeu mais do que qualquer alteração de kernel.