Authoritative source: Targets, placement, and transfer

Targets, placement, and transfer

A target is a typed environment in which an artifact can execute: native code, a managed runtime, a browser, an accelerator, another process, a container, or a remote service all fit one model.

Current status: LLVM native is the sole execution backend. General target discovery, placement planning, transfer routes, fallback, and additional providers remain incomplete.

Policies are values

value compute : TargetPolicy =
    prefer(capability(ParallelCompute), current);

There is no policy declaration keyword or processor-specific syntax. Policies are pure descriptions interpreted by planning.

Declaration placement

function matrixMultiply(a:Matrix(f,m,k), b:Matrix(f,k,n))
    : Matrix(f,m,n) on compute = ...;

Callers still write matrixMultiply(a,b). A module may declare default target compute; to avoid repetition. Placement is not part of the Pi type.

Target blocks

target FastAccelerator {
    function matrixMultiply(a,b) = intrinsic;
    instance Lane(Float32) = intrinsic;
    handler DeviceClock : Clock = {
        function clockNanos() = intrinsic
    };
};

A target block supplies implementations for canonical declarations. It cannot introduce a public API available only on one target and is not expression-level conditional compilation.

No call-site target switch

runOn, runAt, @device, call-site on, implicit marshal, and expression target switches are not language forms. Expert scheduling uses ordinary typed target handles and effectful library APIs.

Transfer and fallback

Cross-target movement is an explicit Transfer bridge with effects, costs, ownership, and representation constraints. Pure fallback may be transparent; effectful retry requires safety evidence so an operation is never silently performed twice.

One canonical artifact pipeline

Every provider consumes the same closed, verified, optimized RuntimeCore artifact. A future backend may not add a private front end or reinterpret surface semantics.

Common mistakes

Do not place a target switch at a call site, introduce a public declaration only inside a target block, or assume effectful fallback may repeat work. Placement selects a conforming provider; it does not change the function’s meaning.

Recap

Policies and declaration metadata guide static planning. Typed transfer handles movement, while every selected provider consumes the same canonical artifact.

Normative details: Language Reference §16 and Target Design.