Here is a complete GPU program in Mica. It contains no kernel, no launch configuration, no device pointer, and no memory management — and its two printed lines carry identical digits.

The example is examples/GpuHello in the tutorial repository.

Getting the file

make -C examples/GpuHello run
host   = -0.289062 0.304688 0.093750 -0.015625
device = -0.289062 0.304688 0.093750 -0.015625

Running needs an NVIDIA GPU of compute capability 7.0 or newer — the Volta generation of 2017, and everything after it — with the resident NVIDIA driver. Nothing else is installed: no vendor toolkit, no build step, because the compiler ships its own device code. On a machine without a device the example still compiles cleanly, and make run says what is missing.

The placement is the whole feature

var
    a  : matrix[4, 4] of float32;
    da : matrix[4, 4] of float32 on gpu;

on gpu moves the storage, not the type. da is the same matrix[4, 4] of float32 the host variable is — same shape rules, same operators, same refusals — and its value lives in device memory. That one fact decides where computation happens: an expression over device-resident operands runs on the device, because that is where its data is.

da := ToDevice(a);
db := ToDevice(b);
dc := (da * db) * Rate + da;    { the same sentence, computed device-side }
c := ToHost(dc);

There is no third verb. A value is host-resident or device-resident, and every crossing is written where it costs — which is the whole discipline a performance reader wants, because the crossings are where GPU programs lose their time.

The wall between the worlds

Mixing the two residencies in one expression is refused at compile time, in a sentence that names the fix (error 5480):

the operator ‘multiplication’ cannot mix storage worlds: got ‘matrix[4, 4] of float32’ and ‘matrix[4, 4] of float32 on gpu’ — an operation across placements would smuggle the very transfer the placement axis makes visible; move one operand with ToDevice or ToHost, so the crossing is written where it costs

And an assignment across the line without a verb is refused the same way (error 5481):

the assignment crosses storage worlds … a copy between host and device memory is a transfer, and a transfer is a verb — write ToDevice or ToHost, so the crossing is visible where it costs

Hidden transfers are the classic silent cost of GPU frameworks. In Mica they are unwritable.

Identical digits, by design

The two printed lines agree to the last digit because the device computation keeps the exact arithmetic order the host computes in — the placement law the compiler’s device probe pins on real hardware. Where the arithmetic is exact, host and device answer the same bits; a result does not change because the storage moved. The AI course carries this all the way up: a GPU-resident training run prints the same loss column, digit for digit, as the host run beside it.

Where this sits

The device residency covers the tensor verbs — the vocabulary the tracked-values chapter teaches records on the device too, which is what makes GPU-resident training an ordinary Mica program. The requirement, stated once more the way the platform page states it: an NVIDIA GPU, compute capability 7.0 or newer, resident driver, nothing else.