Module Metal_api.Library

type t = {
  1. handle : Metal_types.mtl_library;
  2. device : Device.t;
}
val create_from_source : Device.t -> string -> t

Compile MSL source.

Requests Metal's non-fast-math mode (backlog #125). Until this change the options argument was hardcoded None AND the binding ignored it regardless, so every Sarek Metal kernel compiled under Metal's fast-math default with no way to turn it off.

These options are NOT a contraction defence — measured on an Apple M4, a*b+c is contracted under every setting of them, and only Sarek_ir_metal.metal_fp_contract_pragma in the generated source stops it. What they buy is math-function accuracy, and that much is measured (22135 of 65536 results change on sqrt(a) + 1/a).

If mtl_compile_options_conformant returns None (older OS, missing selector, allocation failure) this falls back to null options, i.e. exactly the behaviour before backlog #125, and says so in the log rather than silently.

Metal float results are STILL outside the guarantee: test_df64 and test_real64 have never been run on a Mac, so agreement with the interpreter is not established. See docs/fp-contraction-policy.md §10.

val release : t -> unit
val get_function : t -> string -> Metal_types.mtl_function