Skip to main content

morph.toml Reference

morph.toml is the project manifest read by the CLI (ProjectConfig.cpp). Unknown top-level sections are ignored for forward compatibility except where the parser explicitly errors on bad keys inside a known section.

This page is about the project-level file generated by morph new.

If you are contributing to the compiler/framework itself, note that packages under morphs/<Package>/ also have a file named morph.toml, but it is a different schema: package identity, token requests, runtime bundles, provider import/export, and [include] globs that load nested feature.toml and block.toml fragments. Start there instead:


Minimal generated shape

morph new emits (approximately) the following sections—use this as the ground truth for new projects:

[project]
name = "my_project"
version = "0.1.0"

[package]
kind = "application"
description = "…"
repository = "https://github.com/your-org/my_project"
license = "MIT"
source_dir = "src"

[build]
main = "src/Main.mx"
build_dir = "build"
optimize = "aggressive"
emit_ir = "optimized"
target_cpu = "native"
tensor_profile = "balanced"
tensor_autotune = true
tensor_kernel_cache = "build/.morph_cache/tensor/"

[web]
canvas_id = "morph-canvas"
wgsl_cache = true
dev_server_port = 8080
enable_shared_array = true
initial_memory_mb = 64
maximum_memory_mb = 512
wasm_simd = true

[morph]
host_route = "host.llvm"
nn_route = "nn.graph"

[dependencies]
# foo = { github = "owner/repo", version = "^1.0.0" }

[vcon], [vcon.permissions], [vcon.resources], [native], [native.<Provider>], etc. are optional and only needed when you use those features.


Sections (what the parser accepts)

[project]

KeyMeaning
nameProject name (required).
versionVersion string.

Description and repository live under [package], not [project].

[package]

KeyMeaning
kindapplication or library.
description, repository, licenseMetadata.
source_dirRoot for sources (default layout uses src).

[build]

KeyMeaning
main / entryEntry .mx file.
build_dir / out_dirBuild root (default build).
optimize / opt_levelO0, O1, O2, O3, Oz, or aggressive (see parseOptimizeLevel).
emit_ir / ir_modenone, optimized, or both.
target_cpu / cpunative or generic.
tensor_profilebalanced, gemm_parity, or ai_fused.
tensor_autotunetrue / false.
tensor_kernel_cacheCache directory path string.
vconLegacy boolean mapped to VCON enablement (see parser).

There is no basic optimization level or minimal / performance tensor profile in the parser—those names will fail validation.

[dependencies]

Inline-table GitHub deps are canonical:

foo = { github = "owner/repo", version = "^1.2.0" }

Optional fields inside the table include tag and commit. A legacy shorthand name = "version" form is still accepted.

[web]

Keys: canvas_id, wgsl_cache, dev_server_port, enable_shared_array, initial_memory_mb, maximum_memory_mb, wasm_simd (all validated in ProjectConfig.cpp).

[morph]

Routing / backend selection:

KeyMeaning
host_routeHost pipeline route id.
nn_routeNeural-network route id.
host_backendOptional host backend id.
gpu_route, shader_routeOptional GPU/shader routes.

[vcon] and nested tables

[vcon] supports enabled, output, include_debug_map, hot_reload, runtime ids/paths, signing, pack options, etc. Additional nested sections include [vcon.permissions], [vcon.resources], [vcon.pack], [vcon.pack.resources], and native bridging tables such as [vcon.native] / [vcon.native.<Provider>]. See ProjectConfig.cpp Section::Vcon* cases for the exact key list.

[native] / [native.<Provider>]

Native provider manifests, artifacts, and build metadata for host interop. Errors if unknown keys appear inside a provider section.


Optimization levels

ValueRole
O0O3, OzLLVM-style discrete levels.
aggressiveFull aggressive pipeline (maps to BuildOptimizeLevel::Aggressive).

emit_ir modes

ValueRole
noneDo not emit LLVM IR files.
optimizedEmit optimized IR (per project policy).
bothEmit both raw and optimized where applicable.

Tensor profiles

ValueRole
balancedDefault balanced kernels.
gemm_parityGEMM-oriented tuning.
ai_fusedFused AI-oriented tuning.

Next Steps