Context.Cc_backendThe cc backend's own module, re-exported because the library's interface module is this one and a test outside arrayjit can otherwise not name it. What needs naming is Cc_backend.compiler_command: the generated-kernel census (test/operations/cc_march_census.ml, gh-ocannl-650) compiles emitted sources under foreign -march flags, and it must do so with the SAME toolchain that builds them for real -- a census against a different compiler would describe guarded arms nothing here selects. The interface is cc_backend.mli's, so this exposes no more than that file already publishes.
include Ir.Backend_impl.Lowered_no_device_backendinclude Ir.Backend_impl.Bufferval sexp_of_procedure : procedure -> Sexplib0.Sexp.tval compile :
name:Base.string ->
Ir.Indexing.unit_bindings ->
Ir.Low_level.optimized ->
procedureval compile_batch :
names:Base.string Base.array ->
Ir.Indexing.unit_bindings ->
Ir.Low_level.optimized Base.array ->
procedure Base.arrayCompiles the given procedures -- the segment kernels of one fissioned routine -- as a single compilation unit: one generated source and one C-compiler invocation, with the resulting (dyn-loaded) library shared by every returned procedure.
val link_compiled :
?lowered_bindings:Ir.Indexing.lowered_bindings ->
merge_buffer:Ir.Backend_intf.buffer_loc Base.option Base.ref ->
resolve:(Ir.Backend_intf.buffer_loc -> buffer_ptr) ->
runner_label:Base.string ->
Ir.Backend_intf.ctx_buffers ->
procedure ->
Ir.Indexing.lowered_bindings * Ir.Task.tresolve is the device's backend-private buffer_loc -> base lookup, supplied at the backend boundary so that the shared layer never handles a raw pointer: this function resolves both the context's ctx_buffers (eagerly, at link time) and the lazily-set merge_buffer (at execution time). runner_label is get_name device of the device holding the buffers. lowered_bindings, when given, supplies the static-index refs to bind (looked up by symbol) instead of freshly minted ones, and is returned as-is: procedures linked as a batch — in particular the segment kernels of one fissioned routine — must share their binding refs, so setting a static index through the routine's bindings reaches every kernel.
include Ir.Backend_impl.No_device_buffer_and_copying
with type buffer_ptr := buffer_ptrinclude Ir.Backend_impl.Buffer with type buffer_ptr := buffer_ptrval sexp_of_buffer_ptr : buffer_ptr -> Sexplib0.Sexp.tReturns (an upper bound of) the memory used for arrays, in bytes.
Raw slab primitives used by Make_slab to back the device-level Backend_intf.Slab_alloc. They allocate / free / zero contiguous backend buffers by byte size; pool-id bookkeeping lives in the shared slab wrapper.
val alloc_pool_raw : size_in_bytes:Base.int -> buffer_ptrval free_pool_raw : (buffer_ptr -> Base.unit) Base.optionval memset_zero_raw :
buffer_ptr ->
offset:Base.int ->
size_in_bytes:Base.int ->
Base.unitval offset_buffer : buffer_ptr -> bytes:Base.int -> buffer_ptrReturns a handle for the slab pointer advanced by bytes. Used by Make_slab.resolve_pool to turn a { pool_id; offset } into the concrete pointer for a sub-region of a multi-tenant pool. For bytes = 0 this must return the base unchanged.
val buffer_to_buffer :
dst:buffer_ptr ->
src:buffer_ptr ->
size_in_bytes:Base.int ->
Base.unitval host_to_buffer : Ir.Ndarray.t -> dst:buffer_ptr -> Base.unitval buffer_to_host : Ir.Ndarray.t -> src:buffer_ptr -> Base.unitThe C compiler command this backend builds kernels with: cc_backend_compiler_command when set, else the toolchain's own C compiler as reported by ocamlc -config. Exposed for the generated-kernel census (gh-ocannl-650), which must compile the emitted sources with the SAME toolchain that will build them for real -- a census run against a different compiler would describe guarded arms nothing here selects.
Resolves every executable token in a compiler command and fingerprints its path, size and modification time. Exposed for the generated-kernel census's persistent listing identity: an in-place toolchain replacement must not replay assembly from the previous executable.
The vector register width in bytes for the explicit SIMD renderings (config cc_vector_bytes; auto-probed when unset). Exposed for Schedulers.cpu_mma_limits's simd_vector_bytes.
The worker-pool width after the pool policy: the restricted class's logical CPU count when the restriction fired, the process's affinity-respecting CPU count otherwise. Sizes the auto cc_parallel_chunks.
Compact pool signature (w8P, w24, ...) identifying the pool the process executes on. Exposed for Schedulers.cpu_mma_limits's worker_pool_tag: schedules crowned on one pool do not transfer to another (gh-ocannl-530), so the tag enters the autotune disk-cache key.
A short digest of this backend's resolved codegen configuration: the compiler command and its flags, the vector width, the fp16-arithmetic support, the parallel-grid syntax and chunking, and the per-chunk privatization cap. Exposed for Schedulers.cpu_mma_limits's Ir.Backend_intf.hardware_limits.codegen_tag: these settings are consulted at codegen, after the lowered code the canonical digest names, so they enter the autotune disk-cache key (gh-ocannl-572) and a knob flip re-tunes rather than replaying a winner from another codegen regime.
Whether the configured C compiler and target execute _Float16 arithmetic natively, at twice f32's lane count (ARMv8.2-FP16, AVX512-FP16) -- as opposed to lacking the type, or having it with every operation promoted to float (correct, but no throughput win). Probed once per process by test-compiling; overridable with cc_fp16_arithmetic. Exposed for Schedulers.cpu_mma_limits's native_fp16_arithmetic and for the compute-precision decision in CC_syntax_config.