Basic Examples (3)

Build and reduce a tiny term:

Needs["WolframInstitute`THVMLink`"];
TInit[];
TWnf[TApp[TLam[x, x], TLam[y, y]]]

Build a UOp graph and realize it on the active backend:

x = TTensorCreate[{1., 2., 3., 4.}];
y = TTensorCreate[{10., 20., 30., 40.}];
TTensorData @ TRealize[TUOpAdd[x, y]]

Take a gradient through a small expression (every float leaf is auto-graded, no marking):

w = TTensorCreate[{1., 2., 3.}];
x = TTensorCreate[{4., 5., 6.}];
TRealize @ TGrad[TUOpReduce[TUOpMul[w, x], 0, "SUM"]];
TTensorData @ TRealize @ TGradOf[w]

Scope (2)

Render the live interaction-net heap as an IC string diagram, seeded at a particular term:

THeapGraph @ TApp[TLam[w, TUOpAdd[w, w]], TTensorCreate[{1., 2.}]]

Snapshot the live runtime to a transportable Wolfram expression, restore it across a fresh kernel:

snap = TContextSnapshot[TLam[x, TUOpAdd[x, x]]];
TFree[]; TInit[];
TInitialize[snap]

Applications (2)

Project the schedule the materializer produces from a small neural-net forward pass and gate it through the memory planner:

W = TGlorot[{4, 10}]; b = TZeros[{10}]; xs = TTensorCreate[ConstantArray[1., {1, 4}]];
loss = TL2Loss @ TLinear[xs, W, b];
TMaterialize[loss];
TMemoryPlanReport @ TMemoryPlan[]

Prove a small equational theorem with the C-engine ATP and reconstruct it as a Wolfram ProofObject:

Needs["WolframInstitute`THVMLink`ATP`"];
TFindProof[
    Inactive[Equal][x ⊗ y ⊗ z, z ⊗ y ⊗ x],
    "AbelianGroupAxioms",
    TimeConstraint -> 10
]

Properties and Relations (1)

Per-kernel introspection - source, autotune candidates, and dispatch counters live on (PackageLink[TKernel, paclet:WolframInstitute/THVMLink/ref/TKernel, WolframInstitute/THVMLink Package Symbol]):

TRealize @ TUOpAdd[TTensorCreate[Range[1., 8.]], TTensorCreate[Range[1., 8.]]];
k = TKernel[1];
{k["DispatchKind"], k["DispatchCount"], TKernelProposed[1]}

Possible Issues

The default make target does not rebuild the WL paclet dynamic library; the host .wlt tests and notebooks dispatch through the stale LibraryResources/THVMLink.dylib. Always run make && make wl from the repository root after touching C sources.