A team profiles their inference path, sees latency they don’t like, and hears that Heterogeneous System Architecture (HSA) will make the GPU faster. That framing is where the trouble starts. HSA is not a way to make a compute-bound kernel run quicker — it is a programming model that removes the explicit host-to-device copies and command marshalling that sit around the kernel. If your profiled cost lives in data movement between CPU and accelerator, HSA can help. If it lives in the matmul itself, HSA moves complexity without moving the bottleneck. That distinction is the whole article. Everything below is about how to tell which case you’re in before you commit engineering time to a port. What does working with HSA programming involve in practice? HSA is a specification originally driven by the HSA Foundation (with AMD as the primary hardware backer) that defines how a CPU and one or more accelerators — typically the integrated GPU on an APU — share a single view of memory and dispatch work to each other with minimal ceremony. Two mechanisms carry almost all of its practical value. The first is shared virtual memory (SVM). On a coherent HSA platform, the CPU and GPU address the same virtual pages. A pointer the CPU allocates is a valid pointer on the GPU. There is no separate device buffer, no cudaMemcpy-style transfer, and — on fully coherent hardware — no explicit flush to reconcile the two views. The accelerator reads the data where the CPU left it. The second is the user-mode queueing model. In a classic explicit-copy stack, dispatching a kernel involves the driver, kernel-mode transitions, and command marshalling. HSA lets an application enqueue packets into a queue the hardware reads directly, cutting the per-dispatch software overhead. For workloads that fire many small kernels with tight CPU-GPU hand-offs, that overhead is not noise — it is often the thing you measured. Put plainly: HSA’s wins come from cutting marshalling and copy overhead on tightly coupled CPU-GPU work. It does not touch the arithmetic throughput of a kernel that is already saturating the compute units. This is the single most important thing to internalise before evaluating it, and it is the same lens we apply across any heterogeneous inference target that divides work across CPU, GPU, and WASM — the model is only as good as the bottleneck it addresses. Which inference workloads see real gains from HSA’s unified memory model — and which do not? The honest answer is that it depends entirely on where your time goes, and the split is sharp enough to tabulate. Where HSA helps vs where it doesn’t Workload shape Dominant cost HSA verdict Many small kernels with CPU pre/post-processing between them Copies + dispatch marshalling Strong fit — unified memory removes copies, user-mode queues cut dispatch cost Pipeline that stages tensors host→device→host repeatedly PCIe / copy transfer time Strong fit — zero-copy eliminates the round trips Single large model, one dispatch, compute-bound matmul Kernel arithmetic No help — the copy is amortised; HSA has nothing to cut Batched throughput serving on a discrete data-center GPU Kernel + interconnect at scale Usually irrelevant — HSA targets tightly coupled APUs, not discrete PCIe accelerators Small-batch, latency-sensitive edge inference on an APU Copy + dispatch overhead per request Often strong fit — this is HSA’s natural home The pattern is consistent: HSA rewards coupling, not compute. A workload that hands small tensors back and forth between CPU stages and GPU kernels many times per inference is dominated by marshalling and copy overhead, and that is precisely what the model removes. A workload that copies one large input once and then spends milliseconds in a compute-bound kernel has already amortised its copy cost — there is nothing meaningful left for HSA to take. How does shared virtual memory reduce host/device copy overhead compared to explicit CUDA or OpenCL transfers? In an explicit-transfer model — the default mental image most engineers carry from CUDA — the host allocates a buffer, the device allocates a separate buffer, and every hand-off requires a copy across the interconnect. On a discrete GPU that copy crosses PCIe; even on an integrated part, an explicit clEnqueueWriteBuffer or cudaMemcpy moves bytes and burns a synchronisation point. HSA’s shared virtual memory collapses that. Because both processors address the same physical pages, the “transfer” becomes a cache-coherency event rather than a byte copy. On fully coherent hardware the GPU simply reads what the CPU wrote. The overhead you were paying — allocation of a second buffer, the copy itself, and the barrier that serialised it — disappears. It is worth being precise about the boundary here, because it is easy to overstate. NVIDIA’s Unified Virtual Memory model, which we cover in its own right, gives a single pointer across host and device but on discrete GPUs still migrates pages on demand across PCIe — the copy is hidden, not eliminated. HSA on a coherent APU eliminates the physical copy because there is one physical memory. The two look similar in source code and diverge sharply in what actually happens on the bus. Treating them as interchangeable is a common and expensive error. What hardware and runtime support does HSA actually require? This is where most evaluations should end quickly, because the constraint is real and narrow. Full HSA — coherent shared virtual memory with hardware page coherency — requires an APU or SoC where the CPU and GPU share a memory controller and a coherency fabric. AMD’s APU line historically provided this through the ROCm software stack and the HSA runtime (hsa-runtime). The programming model is exposed today more commonly through HIP and ROCm rather than raw HSA runtime calls; if you are porting a CUDA path, you will most likely meet HSA’s benefits indirectly through a HIP-based port off the CUDA lock-in rather than by writing to the HSA API directly. The constraints that matter for a decision: Coherent hardware is not universal. A discrete data-center GPU on PCIe does not give you HSA’s zero-copy guarantee. You get UVM-style demand paging at best. If your deployment target is a rack of discrete accelerators, HSA is largely off the table. Coherency has degrees. Some platforms offer fine-grained coherency (every access is coherent) and some coarse-grained (coherency at synchronisation boundaries only). Coarse-grained still requires explicit release/acquire operations, which claw back some of the “no ceremony” promise. The runtime stack matters as much as the silicon. The same physical APU can behave very differently depending on driver, ROCm version, and allocator. This is (observed across TechnoLynx porting engagements, not a published benchmark) one of the most common sources of “HSA didn’t help” disappointment — the hardware was capable, the software path fell back to copies. How do I judge from a profiling baseline whether HSA addresses my actual bottleneck? Before you port anything, you profile the existing path and answer one question: what fraction of my per-inference time is spent moving data between host and accelerator, versus computing? HSA can only ever reclaim the first fraction. A pre-port diagnostic checklist Measure copy time explicitly. Instrument cudaMemcpy / clEnqueueWriteBuffer / clEnqueueReadBuffer durations, or use the profiler’s memory-transfer timeline. Sum them per inference. Measure dispatch count and marshalling. Count kernel launches per inference and estimate per-launch overhead. Many small launches with tight CPU hand-offs is the signature HSA rewards. Measure kernel compute time. The wall-clock the accelerator spends inside kernels, not around them. Compute the ratio. If copy + marshalling is, say, under roughly 10–15% of per-inference wall-clock (a rough planning threshold, not a hard rule), the theoretical ceiling of an HSA port is that same small fraction — usually not worth it. Check the target hardware. Confirm your deployment silicon is a coherent APU. If it is a discrete PCIe GPU, stop here. Estimate the realistic gain against the baseline. Not the copy time you can see, but the portion HSA can plausibly remove given coarse- vs fine-grained coherency on your part. This mirrors the discipline we bring to any port: profiling the path before you move it is what separates a justified port from a speculative one. The most common failure we see is a team porting an inference path to a shared-memory target where the bottleneck was model compute all along — the port ships, the complexity rises, and the latency barely moves. Our [portable-inference engineering practice](GPU engineering) exists partly to catch exactly that mistake at the profiling stage rather than after the port. If you’re weighing heterogeneous deployment more broadly, our engineering work spans the full stack. How does an HSA target compare to a WASM or native accelerator path? These are not competing answers to the same question — they answer different questions, and conflating them produces bad ports. Path What it optimises Natural target Copy model HSA / shared-memory APU CPU-GPU coupling overhead Coherent APU, edge or embedded Zero-copy on coherent hardware WASM inference Portability across browsers/sandboxes Client-side, no native install Linear memory, no GPU coherency Native discrete-GPU (CUDA/HIP) Peak kernel throughput Data-center GPU Explicit copy or UVM demand paging A WASM path buys you reach — code that runs anywhere a runtime exists — at the cost of raw throughput and any notion of CPU-GPU coherency. An HSA path buys you the removal of copy overhead on a specific class of tightly coupled hardware. A native discrete-GPU path buys you the highest kernel throughput and interconnect scaling, and accepts the explicit copy in exchange. The right choice is dictated by where your workload’s cost lives and where it will be deployed, not by which model sounds most modern. FAQ What should you know about HSA programming in practice? HSA is a programming model that lets a CPU and accelerator on a coherent APU share a single virtual address space and dispatch work to each other through user-mode queues. In practice it removes explicit host-to-device copies and cuts the command-marshalling overhead of launching kernels. It does not change how fast a kernel’s arithmetic runs — its wins are in the data movement and dispatch that sit around the kernel. What kinds of inference workloads see real gains from HSA’s unified memory model, and which do not? Workloads that fire many small kernels with tight CPU-GPU hand-offs, or that stage tensors back and forth repeatedly, see real gains because copy and marshalling overhead dominate their time. Single large compute-bound kernels see essentially none — their one copy is already amortised against milliseconds of arithmetic. HSA rewards coupling, not compute. How does HSA’s shared virtual memory reduce host/device copy overhead compared to explicit CUDA/OpenCL transfers? In an explicit model, host and device hold separate buffers and every hand-off is a byte copy across the interconnect plus a synchronisation point. HSA’s shared virtual memory has both processors address the same physical pages, so the transfer becomes a cache-coherency event rather than a copy. On fully coherent hardware the physical copy disappears entirely — unlike UVM on discrete GPUs, where the copy is hidden but still crosses PCIe. What hardware and runtime support does HSA actually require, and what are its constraints? Full HSA needs an APU or SoC where CPU and GPU share a memory controller and coherency fabric, exposed today mostly through HIP and the ROCm stack. Discrete PCIe GPUs do not provide HSA’s zero-copy guarantee. Coherency also comes in fine-grained and coarse-grained forms, and the runtime/driver stack can silently fall back to copies even on capable silicon. How do I judge from a profiling baseline whether HSA addresses my actual bottleneck? Profile the existing path and split per-inference time into data movement versus compute. HSA can only reclaim the data-movement fraction, so if copy and marshalling are a small slice of wall-clock, the port’s ceiling is that same small slice. Confirm the deployment target is a coherent APU before going further. How does an HSA target compare to a WASM or native accelerator path for the same inference workload? They answer different questions: WASM buys portability across sandboxes at the cost of throughput and coherency; native discrete-GPU buys peak kernel throughput and accepts explicit copies; HSA buys removal of copy overhead on coherent APUs. The right pick is set by where the workload’s cost lives and where it deploys, not by which sounds newest. When does targeting HSA make sense versus staying with an explicit copy-based heterogeneous model? Target HSA when profiling shows copy plus dispatch overhead is a meaningful share of per-inference time and your deployment hardware is a coherent APU. Stay with the explicit copy-based model when the bottleneck is kernel compute, when you deploy on discrete PCIe accelerators, or when the copy is already amortised against long-running kernels. Where this leaves the port decision The temptation with any unified-memory model is to treat it as a general accelerator and expect it to erase whatever latency you happen to observe. HSA is narrower and more honest than that: it removes copies and dispatch ceremony on coherent, tightly coupled hardware, and it does nothing for a compute-bound kernel. The teams who get value from it are the ones who profiled first, found their cost in data movement rather than arithmetic, and confirmed their silicon was actually coherent before writing a line of ported code. When an HSA-targeted path does reach deployment, the coherency guarantees and runtime fallbacks become release-readiness considerations for heterogeneous hardware in their own right — a port that works on the developer’s APU can quietly fall back to copies on a slightly different driver. The failure class to watch is the same one that motivates the whole exercise: shipping a port that moves complexity without moving the bottleneck.