The Vulkan backend: Adreno and other GPUs
MTL5 runs dense float products on GPUs through Vulkan compute, with its own shaders. It was built for Qualcomm Adreno GPUs, which have no vendor BLAS, and it runs on any Vulkan 1.0 device with a compute queue. It is the fourth backend on the accelerator core, after Metal, CUDA and HIP, and follows the accelerator backend architecture. Tracked in issue 1022, under the umbrella #225.
The decision: Vulkan, not OpenCL
Section titled “The decision: Vulkan, not OpenCL”Issue 1022 asked for the compute API to be chosen per target device, with the devices named first.
The target device is an Arduino Ventuno Q board:
- Chip: a Qualcomm QCS8300 (“Monaco”) with an Adreno 623 GPU, 8 CPU cores and 14 GiB of memory.
- Software: Ubuntu 24.04 with Qualcomm’s 6.8 kernel.
- Driver: the GPU runs on the upstream
msmDRM driver, so its Vulkan driver is Mesa’s Turnip: Mesa 25.2.8, Vulkan 1.3.
What that driver reports:
| Property | Adreno 623 (Turnip) |
|---|---|
| FP64 in shaders | no |
| FP16, int64 in shaders | yes |
| Shared memory per workgroup | 32 KiB |
| Invocations per workgroup | 2048 |
| Subgroup size | 128 |
| Largest storage buffer | 128 MiB |
| Memory | one 11.2 GiB heap, device-local and host-visible, with a coherent, cached type |
Vulkan compute was chosen (decided 2026-12-03):
- Qualcomm’s own OpenCL is not available. It needs Qualcomm’s
kgslkernel driver, which this board does not run. - The only OpenCL is Mesa’s rusticl, which is younger on Adreno than Turnip. With it, CLBlast would supply BLAS but no factorizations.
- Either API needs MTL5’s own kernels for everything beyond BLAS. With Vulkan the products are MTL5’s shaders too.
- Vulkan carries to the other Adreno platforms. It is the better-supported compute API on Windows on Snapdragon X and on newer Android drivers.
Nothing in the backend is specific to Adreno, so the option is named for the API, MTL5_WITH_VULKAN, and the runtime is runtime::vulkan.
Enabling it
Section titled “Enabling it”cmake -B build -DMTL5_WITH_VULKAN=ONIt needs the Vulkan headers and loader and glslc: libvulkan-dev and glslc on Debian and Ubuntu, or the LunarG Vulkan SDK.
- The shaders: the GLSL shaders in
src/vulkan/are compiled to SPIR-V byglslcwhen the library is built, and embedded in it. - The library:
MTL5::vulkanis a static library, built fromsrc/mtl5_vulkan.cpp. It linksVulkan::Vulkanand definesMTL5_HAS_VULKAN. - Without it: code built without the option is unchanged.
target_link_libraries(my_app PRIVATE MTL5::vulkan)An installed MTL5 built with the option exports MTL5::vulkan, and its package configuration finds Vulkan for the consumer.
Memory
Section titled “Memory”runtime::vulkan names memory by a buffer and a byte offset, not a pointer, as runtime::metal does. The handle is runtime::vulkan::buffer<T>.
| Space | Vulkan allocation | Host access |
|---|---|---|
memory_space::device<runtime::vulkan> | a VkBuffer, device-local where the device has it | none through MTL5 |
memory_space::shared<runtime::vulkan> | a VkBuffer in host-visible, coherent memory, mapped | yes |
- Zero-filled. Every allocation is zero-filled, so it holds only element types whose value is all-zero bytes, as on the other backends (
include/mtl/memory/zero_fill.hpp). - Shared memory costs no copies on an integrated GPU. On the Adreno, and on any GPU that shares the CPU’s memory, it is the GPU’s own memory, mapped for the host. The host touches it only between calls: every MTL5 call waits for the GPU before it returns.
- Device memory on a discrete GPU is memory the host cannot map, reached by staging copies. On an integrated GPU it is the same memory as shared memory, which the backend maps for its own copies only.
- No pinned memory. Shared memory is already host memory the GPU reads in place, so pinned memory is not offered.
#include <mtl/mtl.hpp>#include <mtl/interface/vulkan.hpp>
using shrd = mtl::memory_space::shared<mtl::runtime::vulkan>; // or shared<> in a Vulkan buildmtl::mat::dense2D<float> A = ..., B = ...;auto sA = mtl::copy_to<shrd>(A);auto sB = mtl::copy_to<shrd>(B);auto sC = mtl::copy_to<shrd>(mtl::mat::dense2D<float>(A.num_rows(), B.num_cols()));mtl::mult(sA, sB, sC); // src/vulkan/sgemm.compfloat c00 = sC(0, 0); // read in placeOperations
Section titled “Operations”| Call | Operands | Runs as |
|---|---|---|
mult(A, B, C) | dense2D<float>, all in Vulkan memory | src/vulkan/sgemm.comp, or src/vulkan/sgemm_staged.comp when neither B’s columns nor A’s rows are adjacent in memory (see the kernels below) |
mult(A, x, y) | dense2D<float> and dense_vector<float>, all in Vulkan memory | src/vulkan/sgemv.comp |
lu_factor(A, pivot), cholesky_factor(A) | dense2D<float> in Vulkan memory | blocked: the host factors each panel, the GPU does the rest (see the factorizations below). With LAPACK linked, the host factors orders below lu_gpu_min_order and cholesky_gpu_min_order, by default every order |
lu_solve, cholesky_solve | the factor or a vector in Vulkan device memory | the host routine on host copies, with x copied back. In shared memory alone the host solves in place |
floatonly. The shaders compute infloat, and most Adreno GPUs have no FP64, sosupports<double>is false. Adouble(or custom-typed) container in shared memory takes the host routines; in device memory it does not compile. A non-defaultAccumulator(#585) never reaches the GPU either.- Placement follows the operands. If every operand is in Vulkan device or shared memory, in any mix, the call runs on the GPU. A pinned operand keeps the call off the GPU. The dispatch trace counts
gemm_vulkanandgemv_vulkan, and for the factorizationsgetrf_vulkan,potrf_vulkan,getrf_vulkan_hostandpotrf_vulkan_host(handed to host LAPACK),getrs_vulkanandpotrs_vulkan. - Orientation is free. Each shader addresses its operands by an element offset and a row and a column stride, so every mix of row-major and column-major operands runs without a transposed copy.
- Synchronous. Each call submits its work and waits for it, as phase 1 of the design promises, and reports a Vulkan failure as
std::runtime_error. One mutex serializes the backend’s queue, so calls from several threads are safe but do not overlap. - Aliasing. A product whose result shares memory with an operand goes through a temporary.
- A failed factorization is the host’s. The factorizations work on
Ain place and keep a device copy of the input. A pivot that is zero or NaN (LU), or a diagonal entry that is not positive (Cholesky), stops the GPU, and the host routine factors the copy, so the return code and the contents ofAare exactly the host’s. The pivots follow the host’s convention, which is also LAPACK’s.
The kernels
Section titled “The kernels”-
sgemm: two shaders with one tile. A workgroup of 16 × 8 = 128 invocations, the most Vulkan guarantees on every device, computes a 64 × 128 tile ofC. Each invocation keeps an 8 × 8 block ofCin registers, so each step of the inner index loads 8 elements ofAand 8 ofBfor 64 multiply-adds. Each element sums its products in the order of the inner index.sgemm.compreadsAandBstraight from their buffers, with no shared memory. It is the fast one whenB’s columns are adjacent in memory: the 16 invocations of a row then read 16 adjacent elements ofB.sgemm_staged.compstages 8 steps ofBat a time in shared memory, loaded along whichever of its dimensions is adjacent. It runs only whenB’s columns are not adjacent andA’s rows are not either.- The choice: a product whose
Bhas adjacent columns runssgemm.comp. One whoseAhas adjacent rows instead is computed asCᵀ = Bᵀ Aᵀ, which has that form, and the shader writesCthrough its transposed strides. The rest runsgemm_staged.comp.mtl5_vulkan_sgemm_staged_submissionscounts those, for tests. - Three builds of each: as is, with
Cwriteonly; withACCUMULATE, where each sum starts from the value inC, for the later parts of a long inner index; and withUPDATE,C += A Bwith the sums formed from 0 and added toCat the end, as BLAS’ssgemmwithbeta = 1rounds, for the factorizations’ trailing updates: about 50 GFLOP/s on such an update, whereACCUMULATEran at 45. Cis read through a second binding. The two builds that readCtake it from binding 3, the same buffer boundreadonly, and write it through binding 2, stillwriteonly. Read and written through one read-write binding, the Adreno ran them at 24 to 26 GFLOP/s, against 57 for the plain build. SPIR-V lets a compiler assume that two variables without theAliaseddecoration do not overlap, and GLSL cannot sayAliased, so the backend adds it to both variables when it loads those builds; it cost nothing on the Adreno.
-
sgemv: one workgroup of 64 invocations computes one element ofy. Each invocation sums a strided share of the row, and the partial sums are added as a tree. -
Speed of
sgemm, on the Adreno 623 (issue 1022, second part). The first shader, with a 16 × 16 tile and two elements ofCper invocation, ran at about 17 GFLOP/s. A standalone harness timed variants at n = 1024 with all operands row-major:variant GFLOP/s the first shader 18.5 shared-memory tiles, 8 × 4 per invocation 40 no shared memory, 8 × 4 per invocation 54 no shared memory, 8 × 8 per invocation ( sgemm.comp)69 the same, 8 × 16 per invocation 4, presumably register spills vec4loads along the contiguous dimensions52 - Orientation. Reading
Bdirectly is fast only when its columns are adjacent: withBcolumn-major it fell to 17 GFLOP/s. StagingBin shared memory (sgemm_staged.comp) runs 44 to 51 GFLOP/s in every orientation, which is why it covers the case the transposed form cannot. - The GPU’s peak. A shader of independent multiply-adds runs at about 300 GFLOP/s, so
sgemm.compreaches about a quarter of it. - Through
mult,mtl5_bench’saccelarea on device memory: 64 GFLOP/s at n = 1024 and 66 at 2048, against 17.6 and 17.4 before. The board’s four Cortex-A78C cores reach 120 and 123 at those sizes with OpenBLAS (the backends page’s host row), so the CPU is still the faster one forsgemm.
- Orientation. Reading
-
sgemvis a first version, written for correctness and every orientation.
The factorizations
Section titled “The factorizations”lu_factor and cholesky_factor are blocked and right-looking, in panels of 128 columns (mtl5_vulkan_sgetrf and mtl5_vulkan_spotrf in src/mtl5_vulkan.cpp). The host does the narrow, sequential work: pivot searches and many small steps, which a GPU runs at a submission per step. The GPU does the products, which are most of the FLOPs.
- Panels move through cached scratch. The GPU copies each panel (
saxpy2d.comp, an exact copy) into a mapped scratch buffer, where the host factors it, and copies it back. On the Adreno every memory type is host-visible, and A’s device memory is the uncached one, which the CPU reads at about 230 MB/s: reading the panels in place took 37 ms of LU’s 330 at n = 2048. The scratch buffer takes the memory a staging buffer does, which is cached there, and the allocation slot kept for one, as the panel transfers did before. The copy also serves a discrete GPU, whose device memory the host cannot map, and either order of A. Device memory’s own policy is unchanged. - Usually one or two submissions per panel. A recorder in the runtime puts a panel’s dispatches, each followed by a barrier, into one command buffer, where each was its own submission and wait (about 0.35 ms each on the Adreno, dozens per panel). A submission also ends where the sgemm work in it would pass the dispatch budget (see the limits below), so either phase of the look-ahead can take several. The budget counts only sgemm’s work: a submission also carries the panel’s copies, row interchanges and triangular solves, which are small beside its update, so it can run somewhat longer than one standalone sgemm submission.
- Look-ahead. The first phase of a panel ends with the next panel’s columns updated and copied to the host, and the host waits for it. The second, the rest of the update, runs while the host factors the next panel. On the Adreno the host’s panel took about as long as the GPU’s update.
For each panel:
- LU:
- The host factors the panel (rows k to n), with partial pivoting, recursively: each half of the panel’s columns is factored and applied to the other half as a small triangular solve and product. The panel then stays in cache, where a column at a time sweeps all of it once per column. Except for the first, it does so while the GPU finishes the previous panel’s update.
srowperm.compmakes the panel’s interchanges in the other columns, in one pass: their net effect permutes at most 256 rows, which each workgroup moves through shared memory, 8 columns at a time.- The block row, U12 = L11⁻¹ A12, by forward substitution in place (
strsm.comp): the next panel’s columns in the first phase, the others in the second. Not as a product with L11’s inverse, which can lose all accuracy where the substitution does not: with L11 = [[1, 0, 0], [−1, 1, 0], [−1, −1, 1]], which partial pivoting allows, and a column [2²³, 1, −2²⁴], the inverse rounds the last entry of U to 0 instead of 1. - The trailing update, A22 += (−L21) U12: sgemm’s
UPDATEbuild, with −L21 copied from the host’s panel to scratch, where its rows are adjacent. The next panel’s columns first, then that panel to the host; the rest in the second phase.
- Cholesky:
- The host factors the diagonal block, L11, in the order of MTL5’s host routine (
tag::subtract_sum): each sum of products is formed, then subtracted, so a diagonal entry that should fail is not rounded to a positive one. Except for the first, it does so while the GPU finishes the previous panel’s update. - The block column, L21 = A21 L11⁻ᵀ, by forward substitution in place, as L11 L21ᵀ = A21ᵀ (
strsm.compon a transposed view).saxpy2d.compthen writes W = −L21 and L21ᵀ to scratch, where their elements are adjacent. - The trailing update, A22 += W L21ᵀ, in up to 4 blocks of rows, each from A22’s first column through its own diagonal block: 1 + 1/blocks times the work of the lower triangle, where the whole square would be twice. With L21ᵀ’s columns adjacent, the update runs
sgemm.comp. The first block, which always covers the next diagonal block, ends the first phase, and that block goes to the host; the others are the second. - The upper triangle is overwritten by those blocks, so it is copied back at the end from the input’s copy (
saxpy2d.comp, above the diagonal, a plain load and store), and the factorization leaves it as it was, as the host’s does.
- The host factors the diagonal block, L11, in the order of MTL5’s host routine (
Speed on the Adreno 623, mtl5_bench’s accel area, in device memory, GFLOP/s:
| n = 1024 | 2048 | 4096 | |
|---|---|---|---|
| LU on the GPU | 12.5 | 23.5 | 36.0 |
| LU on the GPU, before batching and look-ahead | 7.1 | 17.4 | 31.1 |
| LU, MTL5’s generic host routine | 5.2 | 4.3 | 3.9 |
| LU, OpenBLAS on the four Cortex-A78C cores | 25.3 | 33.3 | 41.0 |
| Cholesky on the GPU | 8.9 | 15.5 | 26.3 |
| Cholesky on the GPU, before batching and look-ahead | 4.1 | 12.3 | 20.6 |
| Cholesky, MTL5’s generic host routine | 2.3 | 2.3 | 2.2 |
| Cholesky, OpenBLAS | 20.7 | 29.9 | 40.5 |
The GPU rows and OpenBLAS’s come from one run (2026-12-05). An earlier run measured OpenBLAS’s Cholesky at 32.2 / 40.8 / 50.7; the generic routines are from that run.
- Where LU’s time goes now, at n = 2048 (about 220 ms): the host’s panels, 91 ms, are the critical path, with the GPU’s second phases done within them; the first phases take 47 ms; and the first panel and the input’s copy (for the host fallback) most of the rest. At n = 4096 the GPU’s update is the critical path. Cholesky’s host work is small, so its time is the GPU’s.
- Against OpenBLAS the GPU does not win at any order the 128 MiB buffers allow (n ≤ 5792), though LU comes within 12% at n = 4096. So with LAPACK linked,
lu_gpu_min_orderandcholesky_gpu_min_orderdefault to the largeststd::size_t, and the host factors. A program on a GPU that wins sets them to the order where it does.mtl5_benchsets them to 0, so its device rows time the GPU in a LAPACK build too. - Without LAPACK the GPU always factors. Below n = 512 the two are within a few milliseconds of each other, and a matrix of one panel (n ≤ 128) is factored on the host in any case; the GPU path’s fixed cost shows most in Cholesky at n = 128, 1.4 ms against the host’s 0.4. From n = 512 the GPU is faster, and at n = 2048 and 4096 4 to 10 times faster.
- What batching and look-ahead took: the panels’ reads from uncached memory, about 0.35 ms per submission, and the host’s panel and the GPU’s update one after the other. Moving U12’s substitution for the columns past the next panel into the second phase gained little: the GPU was then the bound.
- What it took, at n = 2048: the first version ran LU at 11 GFLOP/s and Cholesky at 4. The read-write binding of
Chalved the update’s speed (above); a column-at-a-time panel spent 260 ms on the host where the recursive one spends about 100; a sequential swap shader took 5 ms per panel; and a Cholesky update by many blocks of rows took two submissions and a masked add per block.strsm.compfirst solved one column per invocation, reading the solved elements back throughB’s read-write binding, which halved both factorizations again; it now gives each row an invocation, which keeps its row of 16 columns in registers, and adds the products in the same order. - A matrix the shaders cannot bind, a buffer larger than
maxStorageBufferRange, is found before the GPU changes it, and the host routine factors it, as it did before this backend factored.mtl5_vulkan_inject_fault(3)stands in for one, for tests. - Near the edge of definiteness, blocked differs from unblocked. Within a panel the host forms each sum and then subtracts it, as MTL5’s host routine does, but across panels each panel’s update is subtracted in turn. A matrix whose last pivot is within rounding of 0 can then pass on the GPU where the unblocked host routine rejects it, or the reverse, as with LAPACK’s blocked
spotrf. Such a matrix is singular atfloatprecision either way. - The panel width is 128, the fastest overall: with 64, LU at n = 4096 ran at 16 GFLOP/s, and with 96 at 22, where Cholesky was within the run-to-run spread.
mtl5_vulkan_set_factor_blockchanges it, for tests, up to 128, the mostsrowperm.compallows.
Limits
Section titled “Limits”- Buffer size. Each operand’s whole buffer is bound, so a buffer larger than the device’s
maxStorageBufferRangecannot be used: 128 MiB on the Adreno 623, a 5792 × 5792floatmatrix. Such a call throwsstd::runtime_error. - 32-bit indices. Sizes and offsets are passed to the shaders as 32-bit integers, which that limit already bounds.
- Long GPU jobs. A GPU driver resets a job that runs too long: on the Adreno 623 under the
msmdriver, one dispatch of about a second loses the device (n = 1792sgemmtook 0.91 s and passed, n = 2048 at 1.4 s did not). Sosgemmsplits a product into submissions that aim at 4 GFLOP each, about 70 ms there when the tiles fill the GPU, and 0.15 to 0.25 s for a single tile. The smallest submission, one row of tiles and one step of k, can exceed that: for a product more than about 31 million columns wide, which the buffer limit below allows only for k = 1 (128 MiB holds 33.5 million floats). The device must still accept that many workgroups (maxComputeWorkGroupCount); a product that needs more is refused withstd::runtime_error.- The work is counted as the shader does it. Every invocation of a 64 × 128 tile runs all its steps of the inner index, even past the edge of
C, so a row of tiles costs 2 · 64 · (w rounded up to 128) FLOPs per step, where w is the width of the product the shader writes: C’s columns, or C’s rows when it writes Cᵀ (a column-major C, or the transposed form above). A 1 × k times k × 1 product is one workgroup running k steps, about 0.6 µs each on the Adreno: k = 2²² (4,194,304) would be one job of about 2.5 s. - Blocks of rows in whole tiles, as many as fit the budget, shared out evenly so the last block is not a sliver.
- Parts of the inner index when one row of tiles is already over the budget: k is split into the fewest equal parts that fit. Each part after the first runs the shader built with
ACCUMULATE, which starts each sum from the value inC, so the products are added in the same order and the result has the same bits as from one submission. The common case keeps itswriteonlyC, which was about 5% faster. mtl5_vulkan_set_dispatch_budgetchanges the budget andmtl5_vulkan_sgemm_submissionscounts the submissions, for tests.
- The work is counted as the shader does it. Every invocation of a 64 × 128 tile runs all its steps of the inner index, even past the edge of
- Allocations. Each container is one Vulkan memory allocation. The device caps how many may be live (
maxMemoryAllocationCount), and the backend keeps the last one for its staging transfers. When a heap runs out, the next compatible memory type is tried. Running out raisesstd::bad_alloc; a backend that cannot run raisesstd::runtime_errorwith Vulkan’s message. - Alignment. The host addresses shared memory through
vkMapMemory, whose pointer Vulkan aligns to at least 64 bytes, so shared memory holds types aligned to 64 bytes or less. Device memory has no such limit.
When the GPU fails
Section titled “When the GPU fails”- Memory that runs out raises
std::bad_alloc: Vulkan’s out-of-memory results, the allocation count, or a heap too small. The backend keeps working. - Any other failed Vulkan call raises
std::runtime_errorfrom the MTL5 call that made it, with Vulkan’s message. The backend keeps working, unless the device was lost. - A lost device disables the backend: later calls raise
std::runtime_error, and so does host access to shared memory, whose contents Vulkan no longer guarantees. Pointers taken before the loss must not be used. Containers can still be destroyed, since Vulkan treats a lost device’s resources as no longer in use. - Waiting for submitted work. Every call is synchronous: when it returns, the GPU no longer touches its buffers. If waiting for the work fails, other than by losing the device, the wait is retried, and then the whole device is waited for. If either wait succeeds, the call returns normally. If neither does, the process aborts with a message rather than hand the caller shared memory the GPU might still write; this is the one failure a caller cannot catch. A factorization, which lets some submissions run while the host works, waits for all of them before it returns, on failure too.
- A borrowed result. A result in a memory space that does not allocate (caller-owned buffers) works as any other: when it overlaps an operand, the product goes through a temporary in Vulkan device memory and is copied back.
Choosing the device
Section titled “Choosing the device”The backend uses one Vulkan device for the whole process.
- By default it takes the first discrete GPU, else the first integrated GPU, else the first other GPU, and only then a CPU implementation such as Mesa’s lavapipe.
MTL5_VULKAN_DEVICE=<i>names the device by its index invkEnumeratePhysicalDevicesorder.vulkaninfo --summarylists them.runtime::vulkan::device_name()says which device was chosen.runtime::vulkan::init_error()says why none could be used.
Testing
Section titled “Testing”tests/unit/vulkan/ checks MTL5’s host routines against the GPU’s results for:
- Allocations and copies, including unaligned byte copies and copies through staging buffers.
- Every orientation of
mult, at sizes across the shader’s tile edges, and operands at offsets inside a larger buffer. - LU and Cholesky in both orientations, in device and shared memory, across the panel edges (with 8-column panels and the default 128), in device memory the host does not map, and against the host routines: the factor, the pivots, the untouched upper triangle, and the solves. The GPU path is also called directly, so a factorization that always fell back to the host would fail. Singular, NaN and indefinite matrices return the host’s code and factor.
- The factorizations’ submissions: how many a factorization makes (
mtl5_vulkan_submissions), so the batching cannot quietly come undone; factorizations with many submissions in flight at once (a dispatch budget of one FLOP); and a submission that fails after 0 to 30 that succeed (mtl5_vulkan_inject_fault_after(4, skips)), which reports a Vulkan error and leaves the backend working. - The edge cases: empty dimensions and aliasing.
- The paths that stay off the GPU: the host path for
double, and pinned operands.
A test skips itself on a machine without a Vulkan device, and fails instead when MTL5_REQUIRE_VULKAN is set.
- Failures injected.
mtl5_vulkan_inject_faultmakes the next memory allocation run out, the next fence reset fail withVK_ERROR_UNKNOWN, a factorization find its matrix unbindable, or a factorization’s next submission fail;mtl5_vulkan_inject_fault_afterlets that many calls at the site succeed first. The tests check that running out raisesstd::bad_alloc, that any other failure raisesstd::runtime_error, and that the backend keeps working after either. - Device memory without the mapping. Device memory is mapped for copies where the device allows it, which on the Adreno and on lavapipe is always. The tests turn that off with
mtl5_vulkan_set_device_mapping(0), so the staging-buffer and transfer-command paths a discrete GPU takes run too. - In CI: GitHub’s hosted runners have no GPU, but Mesa’s lavapipe implements Vulkan on the CPU. CI’s
Linux x64 Vulkan (lavapipe)lane builds the library and the tests and runs them there on every PR, withMTL5_REQUIRE_VULKANset. - On the board: lavapipe is not the Adreno. Timing, and how a real driver behaves, are checked on the board.
The procedure on the Adreno board
Section titled “The procedure on the Adreno board”The board needs the build tools and Vulkan’s development packages:
sudo apt install cmake ninja-build glslc libvulkan-dev vulkan-toolsvulkaninfo --summary # should list "Adreno623" (Mesa Turnip), and llvmpipeThen build and run the tests with gcc and with clang. Ubuntu 24.04’s clang has no clang-scan-deps, which CMake’s Ninja generator wants for C++20 targets. MTL5 uses no modules, so turn the scan off:
cmake -S . -B build-gcc -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ \ -DMTL5_WITH_VULKAN=ON -DMTL5_BUILD_EXAMPLES=OFFcmake --build build-gcc -j4 --target vulkan_test_vulkanMTL5_REQUIRE_VULKAN=1 ctest --test-dir build-gcc -R '^vulkan_' --output-on-failure
cmake -S . -B build-clang -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_CXX_SCAN_FOR_MODULES=OFF -DMTL5_WITH_VULKAN=ON -DMTL5_BUILD_EXAMPLES=OFFcmake --build build-clang -j4 --target vulkan_test_vulkanMTL5_REQUIRE_VULKAN=1 ctest --test-dir build-clang -R '^vulkan_' --output-on-failure
# The same tests on the board's lavapipe, as CI runs them. Replace 1 with# lavapipe's index from `vulkaninfo --summary` (GPU1, "llvmpipe", on the board):MTL5_VULKAN_DEVICE=1 MTL5_REQUIRE_VULKAN=1 build-gcc/tests/unit/vulkan_test_vulkanOn 2026-12-03 all 19 test cases (226 assertions) passed on the Adreno 623 and on the board’s lavapipe, with gcc 13.3 and clang 18.
Not done yet
Section titled “Not done yet”- Faster shaders: register blocking, wider tiles, and
sgemvtuned for each orientation. - A board session on the backends page:
platform.sh --variants vulkanruns the device benchmarks; the Arduino board’s session follows once this code is onmain. - Faster factorizations: a host panel on several cores, which is LU’s critical path at n = 2048; a faster
strsm.comp; and no copy of the input where the host fallback can do without one. Whether custom number types should reach the GPU overlaps with domain flow on the KPU (#251). - The other Adreno targets: Windows on Snapdragon X and Android are untested.
- macOS through MoltenVK: the backend enables Vulkan’s portability extensions when the loader and device offer them, so MoltenVK’s devices are listed and usable, but it has not been run there. Apple GPUs have the Metal backend.
- Streams (
stream<runtime::vulkan>), so calls can overlap.