Measured on this M3 Max under macOS 27.0.1 (binary_function_linking.m, plain
and with MTL_DEBUG_LAYER=1, source libraries and metallibs alike), the runtime
now answers what plain Metal answers rather than what its validation layer
stops:
- One name in `functions` and `binary_functions`, or twice in
`binary_functions`, one function or two: made, where the runtime refused
`Invalid(DuplicateLinkedFunction)`. `duplicate_linked_name` keeps only a name
`functions` repeats, which plain Metal's creation fails ("error: duplicated
symbol", code 3). With the previous commit, a call calls the `functions` one
and a table holds each.
- A function only `binary_functions` holds that a stage calls directly:
`Compile(NeedsInput(LinkedFunction))`, as Metal fails with code 3, where the
runtime linked it (previous commit).
- A function not compiled to a binary in a stage's `binary_functions`: plain
Metal fails the creation once the stage links, code 2 ("Internal error
during compute pipeline creation", "... tile pipeline creation", an empty
description for render and mesh-fragment stages), after a reference it
leaves unresolved (code 3 first). The runtime answered
`Invalid(BinaryFunctions(NotPrecompiled))` before the compile; it now
answers `Error::MetalError` with that problem, the M3 Max's domain and
Metal's code and text, right after the compile (`additions::check_precompiled`).
Added to a made state's stage: `MetalError` code 1 ("Failed to allocate a new
pipeline"). Added to a stage the state lacks: taken, as plain Metal makes it
(it was refused).
- A mesh pipeline's object or mesh stage linking binary functions ends plain
Metal's process ("Binary linked functions are not supported for object and
mesh shaders"): `Invalid(BinaryFunctions(ObjectOrMeshStage))`, a new problem,
where the runtime made the state.
The module docs of `pipeline/additions.rs` record the measurements, the error
and README docs follow, REFUSALS.md and the API signatures are regenerated.
RUNTIME_VERSION 1713: creation answers change class.
Verified on this Mac (MoltenVK, --cfg m2v_gpu, under maclock and memcap):
runtime_lane::tests::a_kernel_runs_the_functions_its_descriptor_links and
runtime_lane::function_tables::{binary_functions_link_as_plain_metal_links_them,
binary_functions_and_required_threads_answer_as_metal_s_do,
functions_added_to_a_stage_a_drawing_state_lacks_are_left_out} pass; each
asserts an answer the previous runtime gave otherwise. The runtime unit test of
`duplicate_linked_name` passes.
(Carried to development from steelbrain/reims-graphics-kext 580daa4338.)