Using MIND Core v1 Today

This page gives a practical, end-to-end guide to using the MIND Core v1 toolchain: surface language → IR → autodiff → MLIR → CPU runtime → conformance.

  1. Surface languagesimple.mind
  2. IRmic@3, evidence chain
  3. Autodiffgradient IR
  4. MLIRdownstream interchange
  5. CPU runtime
  6. Conformancecpu / gpu profiles

1. Installing mindc

The fastest route is a released binary — no Rust toolchain, nothing compiled locally:

curl -sSL https://mindlang.dev/install.sh | sh

Or build from source:

git clone https://github.com/star-ga/mind.git
cd mind
cargo build --release --bin mindc
./target/release/mindc --help

Validating the install

mindc --version
mindc --stability

--version prints the compiler version and the pinned core-IR version, so you can tell which IR contract a build speaks:

mind 0.10.2
core-ir=1.0

2. Writing your first program

Create simple.mind:

fn main() -> f64 {
    let x: f64 = 2.0;
    let y: f64 = x * x + 1.0;
    return y;
}

Type-check it without emitting anything:

mindc simple.mind --verify-only

3. Emitting the canonical IR

The same IRModule shape has two canonical serialisations. Note that --emit-ir prints a lossy dataflow summary for reading — it drops control flow, calls, returns, and function bodies. The canonical, exhaustive artifact is mic@3:

mindc simple.mind --emit-ir              # human-readable summary (lossy)
mindc simple.mind --emit-mic3 simple.mic3   # canonical binary artifact
Wrote mic@3 artifact: simple.mic3 (62 bytes)

4. Emitting and verifying the evidence chain

--emit-evidence writes the same mic@3 artifact plus an evidence_chain.* MAP epilogue carrying the substrate, toolchain, determinism declaration, and a SHA-256 trace_hash over the canonical IR:

mindc simple.mind --emit-evidence simple.ev
mindc verify simple.ev
artifact:         simple.ev
substrate:        cpu
determinism:      deterministic
toolchain:        0.10.2
parent:           (root)
trace_hash_kind:  mic3-bytes
trace_hash_valid: yes
fp_mode:          strict
ssa_valid:        yes
signature:        absent
verified: IR body attested (tamper-evident) — trace_hash matches the re-emitted canonical IR
verified: IR body is SSA well-formed
note: artifact carries no signature (unsigned but attested)
note: provenance (substrate/toolchain/parent) is NOT authenticated — these MAP fields sit outside trace_hash

Read that verdict carefully: it is deliberately two-tier and does not overstate itself.

  • Attested

    The IR body

    trace_hash covers it, so tampering with the program is detected.

  • Not authenticated

    The provenance fields

    On an unsigned artifact they are not authenticated, because they live outside the hash preimage.

  • Opt-in

    Signing

    Signing is available and opt-in, never on by default.

A consumer that needs a guarantee rather than a report opts into a fail-closed gate:

mindc verify simple.ev --require-strict-fp     # reject non-strict float lowering
mindc verify simple.ev --require-deterministic # reject PRNG / clock / stdin builtins
mindc verify simple.ev --require-signed        # reject an unsigned artifact
mindc verify simple.ev --json                  # one stable receipt shape on every exit path

To read an artifact back, inspect decodes it and prints a structural summary alongside the canonical IR:

mindc inspect simple.ev

5. Using autodiff

Autodiff is feature-gated. A mindc built without it fails loud rather than silently skipping the request — error[autodiff][E4003]: autodiff requested but the 'autodiff' feature is not enabled:

cargo run --features autodiff --bin mindc -- simple.mind --func main --autodiff --emit-grad-ir

Autodiff is entered through a single-output main and is scoped to the Core v1 tensor ops. See Autodiff.

6. Lowering to MLIR

MLIR emission needs the mlir-lowering feature. It is the downstream-interchange backend for specialty targets and inspection, and the default mindc build backend today; the normative self-host path is the pure-MIND native backend, emitting ELF, Mach-O and PE/COFF (opt-in, --backend native).

mindc simple.mind --func main --emit-mlir

7. Verifying conformance

mindc ops --core-v1                 # the 17-operator Core v1 catalogue
mindc conformance --profile cpu
mindc conformance --profile gpu

The open-source build ships no GPU backend, so --profile gpu exercises the GPU profile against the CPU-delegating reference implementation. Asking the compiler for the GPU target fails explicitly rather than falling back silently: error[backend][E5001]: no backend available for target gpu. GPU execution ships with the commercial mind-runtime.