Skip to main content

//clika-runtime/io.clika.runtime/ClikaRt

ClikaRt

[jvm]
object ClikaRt

The Kotlin binding over the ClikaRT C core ABI (v0 call slice).

Loading order is the cross-language invariant: the runtime artifact loads FIRST (System.loadLibrary("ClikaRT") below; the .so ships in the app's jniLibs, delivered by the runtime distribution), then the JNI bridge resolves that already-loaded image (RTLD_NOLOAD inside) and load performs the two-arm handshake: clika_rt_get_api must serve the abi version, and the served api table must carry the layout fingerprint this binding was generated from. Either refusal happens before the first call.

Properties

NameSummary
ABI_VERSION[jvm]
const val ABI_VERSION: Int
The C ABI version this binding is written against: the generated surface's constant (emitted from the C header), never a literal typed here.
FLOAT32[jvm]
val FLOAT32: Int
The Float32 dtype value, read from the C enum itself, never hand-copied.
INT32[jvm]
val INT32: Int
The Int32 dtype value, read from the C enum itself.
INT64[jvm]
val INT64: Int
The Int64 dtype value, read from the C enum itself.
LAYOUT_FINGERPRINT[jvm]
const val LAYOUT_FINGERPRINT: String
The api-table layout fingerprint this binding was generated from: the generated surface's constant (emitted from the C header), never a literal typed here. load compares it against the runtime's table before the first call.

Functions

NameSummary
addScalar[jvm]
fun addScalar(t: Tensor, scalar: Double): Tensor
t + scalar, elementwise. CONSUMES t (the donation law: an op operand transfers the caller's reference); t is invalid after; use the returned tensor.
load[jvm]
@JvmOverloads
fun load(libPath: String? = null, abiVersion: Int = ABI_VERSION, layoutFingerprint: String = LAYOUT_FINGERPRINT)
Handshake and bind the api table, then arm the generated surface (ClikaRtGen.load): one call readies the whole binding (idempotent). The runtime must serve abiVersion, and its table must carry layoutFingerprint; either refusal throws before any table slot is called. libPath defaults to the already-loaded libClikaRT.so.
probeAbi[jvm]
@JvmOverloads
fun probeAbi(libPath: String? = null, abiVersion: Int, layoutFingerprint: String = LAYOUT_FINGERPRINT): Boolean
True when the runtime serves abiVersion and its table carries layoutFingerprint; the reject probe.
tensorFull[jvm]
fun tensorFull(shape: LongArray, value: Double, dtype: Int): Tensor
A shape-extent tensor filled with value at dtype.
toString[jvm]
fun toString(t: Tensor): String
The tensor's human-readable summary (shape, dtype, first values).
version[jvm]
fun version(): String
The runtime's version string (e.g. "0.1.0").