Since functions whose constants are left undefined compile (a2e34a9d2f),
the runtime made a pipeline state of a function made by
newFunctionWithName: whose function declares function constants. Plain
Metal ends its process there, at every creator's descriptor validation
(probes/undefined_function_constant_values.m, new cases <how>:<shape>,
on the M3 Max under macOS 27.0.1, MTL_DEBUG_LAYER unset, exit 134):
"Compute Pipeline Descriptor Validation / function ko cannot be used to
build a pipeline state. Use newFunctionWithName:constantValues:... to get
the specialized function"; the render and mesh creators name
vertexFunction, fragmentFunction, objectFunction and meshFunction, and
the tile creator says "without setting constant values first". It does
so for an optional constant read only where is_function_constant_defined
says (ko) and for a constant that only gates arguments (kg). Made: a
function made by name that declares none (kn, plain, tile-plain,
mesh-plain), and every shape made with constant values that hold none or
by newFunctionWithDescriptor: without them (each then answers an empty
functionConstantsDictionary; ko stored 7, kn 9).
- metal2vulkan: FunctionDescriptor gains `specialized` (false by default,
a function made by name; a descriptor with constant values is
specialized whatever it says) and with_specialized, and
needs_specialization(budget, entries) answers whether Metal makes no
state of the stage: not specialized and a non-empty
functionConstantsDictionary. A module function's constants are read
through the StageEntries' module decodes (constants_dictionary_with),
which the stage's compile copies, so the check decodes nothing the
compile does not. The compile itself is unchanged.
- metal2vulkan-runtime: Function::function_descriptor marks the stage
specialized where the function was made with constant values or by
descriptor. pipeline/unspecialized.rs refuses before anything is
compiled, Invalid with the new Problem::UnspecializedFunction { stage,
name }: compute and tile states (of_kernel), render states (vertex,
fragment) and mesh states (object, mesh, fragment). A linked function
keeps its own rule (LinkProblem::UnresolvedConstant).
- Pipeline records carry the stage's specialized flag, RECORD_FORMAT 3:
without it every specialized stage's record read back unspecialized
and went unrecorded.
- The owned fixture engine/unspecialized_stage_functions (the probe's
shapes at every stage); its golden rows, inventory and printout are
new rows only (11 functions by 2 forms in each table).
- docs/API.md ("Function constants"), the FunctionConstantValues and
creators' docs, the runtime README, docs/REFUSALS.md regenerated, the
signatures blessed (FunctionDescriptor.specialized, with_specialized,
needs_specialization, Problem::UnspecializedFunction).
Verified:
- metal2vulkan tests::engine_unspecialized 2/2 (every declaring function
of the fixture needs specialization made by name, no free one does,
and the eleven answers read one module decode, (1, 10); specialized or
valued, none does, decoding nothing).
- On MoltenVK (M3 Max) through maclock, --cfg m2v_gpu:
runtime_lane::unspecialized_functions 3/3 (by name: guarded and gate
kernels, vertex, fragment, tile, mesh and object refused; free kernel
stores 9; plain render state made; empty-valued and descriptor-made
guarded kernels store 7, gate kernels made, render states made; tile
and mesh states of them not refused as unspecialized) and
runtime_lane::linked_functions 2/2.
- metal2vulkan-runtime suite 1177/1177; tests::warm_record 4/4.
- metal2vulkan and metal2vulkan-air: 3748 of 3753 before blessing, the 5
failures the new fixture's table rows; after blessing they and the
signature and surface tests pass.
- Negative controls: needs_specialization answering false fails
engine_unspecialized's by-name test; function_descriptor without the
specialized flag fails all three lane tests (the empty-valued and
descriptor-made functions refused); the stage flag removed from the
record's writes and reads fails the four warm_record tests.
(Carried to development from steelbrain/reims-graphics-kext 116efd0dfe.)