PTWM
flavor

ptwm_core::flavor::native

Native cdylib loader. Loads a .so / .dylib / .dll via libloading, probes for the per-kind ABI symbols, and exposes a thin handle the dispatcher uses to invoke each method.

ptwm_core::flavor::native

Native cdylib loader. Loads a .so / .dylib / .dll via libloading, probes for the per-kind ABI symbols, and exposes a thin handle the dispatcher uses to invoke each method.

rsmod

ptwm_core::flavor::native

crates/ptwm-core/src/flavor/native.rs:1
mod native

Native cdylib loader. Loads a `.so` / `.dylib` / `.dll` via libloading, probes for the per-kind ABI symbols, and exposes a thin handle the dispatcher uses to invoke each method.

Safety invariant: the caller MUST have verified the signature against the active trust state before calling `NativeExtension::load`. The `VerifiedToken` opaque type makes this an enforced precondition.
rstype

ptwm_core::flavor::native::DeltaSchemeFn

crates/ptwm-core/src/flavor/native.rs:96
pub type DeltaSchemeFn

`delta_scheme_v1_{encode,decode}` symbol shape.

Unlike the WASM ABI's `ptwm_delta_scheme_v1_{init,cleanup,encode,decode}` (which threads an opaque state handle because WASM linear memory forces the host to manage allocation explicitly — see `extensions/ref_delta_scheme/rust/src/lib.rs`), the native (dlopen) surface carries no state handle, matching [`PlaneCodecFn`]'s existing native convention: a native contribution manages any internal state as ordinary process-local Rust/C state, not through an FFI-visible handle.
rstype

ptwm_core::flavor::native::HardwareBackendCudaDispatchDecodeFn

crates/ptwm-core/src/flavor/native.rs:130
pub type HardwareBackendCudaDispatchDecodeFn

`hardware_backend_v1_dispatch_decode_cuda`: decode `in_dev_ptr` into `out_dev_ptr`, two distinct device buffers (this is NOT an in-place transform over one buffer; "zero-copy" means no host round-trip, not a shared address). `state_bytes` carries the codec's small per-tensor state (e.g. a 16-entry codebook), in the same `(state_format_version, state_bytes)` shape `plane_codec`'s existing `decode_stateful` path already carries. `codec_id` self-describes the wire format for the extension to validate against (distinct from the backend's own canonical id, which the router already resolved to get here).

Completion contract: by the time this function returns, the kernel has FULLY COMPLETED (the extension synchronizes its own stream before returning). `out_dev_ptr`'s contents are valid and visible to any subsequent CUDA operation on any stream, with no further caller-side synchronization needed. Both launch-time and execution-time errors are visible via the return code, since the synchronize() call observes both.
rstype

ptwm_core::flavor::native::HardwareBackendCudaStreamHandleFn

crates/ptwm-core/src/flavor/native.rs:112
pub type HardwareBackendCudaStreamHandleFn

`hardware_backend_v1_cuda_stream_handle`: returns this backend's own, process-persistent CUDA stream (as a raw pointer value) for the given device ordinal. Callers pass this same handle to `tensor.__dlpack__ (stream=...)` for every tensor involved in a subsequent decode call, so PyTorch's DLPack producer inserts the correct cross-stream wait before handing back the device pointer. Returns 0 on failure (no such device, CUDA init failed).

rstype

ptwm_core::flavor::native::NativeExtension

crates/ptwm-core/src/flavor/native.rs:199
pub struct NativeExtension
rstype

ptwm_core::flavor::native::NativeSymbols

crates/ptwm-core/src/flavor/native.rs:37
pub struct NativeSymbols

Symbol set discovered at load time. Each Option carries the raw fn pointer for the corresponding ABI export, or None if absent.

`libloading::Library` must outlive every fn pointer derived from it; we hold the Library inside NativeExtension and the fn pointers alongside.
rsconst

ptwm_core::flavor::native::PLANE_CODEC_CUDA_DECODE_SYMBOL

crates/ptwm-core/src/flavor/native.rs:144
pub const PLANE_CODEC_CUDA_DECODE_SYMBOL
rsconst

ptwm_core::flavor::native::PLANE_CODEC_CUDA_ENCODE_SYMBOL

crates/ptwm-core/src/flavor/native.rs:143
pub const PLANE_CODEC_CUDA_ENCODE_SYMBOL
rsconst

ptwm_core::flavor::native::PLANE_CODEC_CUDA_STREAM_HANDLE_SYMBOL

crates/ptwm-core/src/flavor/native.rs:145
pub const PLANE_CODEC_CUDA_STREAM_HANDLE_SYMBOL
rstype

ptwm_core::flavor::native::PlaneCodecCudaDecodeFn

crates/ptwm-core/src/flavor/native.rs:163
pub type PlaneCodecCudaDecodeFn

`plane_codec_v1_decode_cuda`: decode `in_dev_ptr` into `out_dev_ptr`, two distinct device buffers. `state_bytes` carries the codec's small per-tensor state in the same `(state_format_version, state_bytes)` shape the existing `decode_stateful` path uses. `codec_id` self-describes the wire format for the extension to validate.

Completion contract: by the time this returns, the kernel has FULLY COMPLETED (the extension synchronizes its own stream). `out_dev_ptr` is valid and visible to any subsequent CUDA operation on any stream, with no further caller-side synchronization. Launch-time and execution-time errors are both visible in the return code.
rstype

ptwm_core::flavor::native::PlaneCodecCudaEncodeFn

crates/ptwm-core/src/flavor/native.rs:185
pub type PlaneCodecCudaEncodeFn

`plane_codec_v1_encode_cuda`: encode `in_dev_ptr` into `out_dev_ptr`. Same completion contract as the decode symbol.

`needed_out` exists because an encoder cannot size its output before running: when `out_cap` is insufficient the extension writes the required byte count to `*needed_out` and returns `-2`. The generic return-code decoder cannot carry that number, so it is passed explicitly. On success `*needed_out` is left untouched.
rstype

ptwm_core::flavor::native::PlaneCodecCudaStreamHandleFn

crates/ptwm-core/src/flavor/native.rs:150
pub type PlaneCodecCudaStreamHandleFn

Returns the extension's CUDA stream handle for `device_ordinal`, or 0 if unavailable. Same contract as the hardware-backend equivalent.

rstype

ptwm_core::flavor::native::PlaneCodecFn

crates/ptwm-core/src/flavor/native.rs:62
pub type PlaneCodecFn
rstype

ptwm_core::flavor::native::PlaneCodecStatefulFn

crates/ptwm-core/src/flavor/native.rs:75
pub type PlaneCodecStatefulFn

State-aware decode symbol.

Signature: `(state_version, state_ptr, state_len, in_ptr, in_len, out_ptr, out_cap) -> i64`. Return convention matches `PlaneCodecFn` (non-negative output length, or one of the negative error codes decoded by `decode_rc`).
rstype

ptwm_core::flavor::native::TransformFn

crates/ptwm-core/src/flavor/native.rs:85
pub type TransformFn
rstype

ptwm_core::flavor::native::VerifiedToken

crates/ptwm-core/src/flavor/native.rs:19
pub struct VerifiedToken

Capability token proving the caller verified the contribution's signature. Construct via `VerifiedToken::new_unchecked` only when the verifier returned Trusted.