From 4c879c3d2b19e1bfe4ee4953dd8776ce24227631 Mon Sep 17 00:00:00 2001 From: Michal Harakal Date: Sun, 6 Sep 2026 09:53:53 +0200 Subject: [PATCH 1/2] Remove ExperimentalMemoryApi opt-in gate (SKEEP-003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SKEEP-003's M0/M1/M2 milestones all shipped complete in 0.49.0, so the annotation's "may still change until milestone M1 is complete" warning was stale. Delete ExperimentalMemoryApi and strip every @OptIn/ @ExperimentalMemoryApi annotation referencing it (227 files) — the sk.ainet.lang.memory API (Storage, Scope, Format, Layout, TensorView, WeightForm, WeightByteOrder, ...) is now used without opt-in. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01PLfVvtURRYZETceamLi8kP --- CHANGELOG.md | 9 +++++++++ .../sk/ainet/docs/samples/ScheduleDemo.kt | 2 -- .../kotlin/sk/ainet/apps/plan/SkainetPlan.kt | 2 -- .../sk/ainet/apps/plan/SkainetPlanTest.kt | 2 -- .../scenarios/TernaryF32GemvScenario.kt | 2 -- .../publish/schema/GenerationMetricsRecord.kt | 2 -- .../schema/GenerationMetricsRecordTest.kt | 2 -- .../backend/api/kernel/DispatchMode.android.kt | 2 -- .../api/kernel/ViewKernelPack.android.kt | 3 --- .../backend/api/kernel/BitNetGemvKernel.kt | 2 -- .../ainet/backend/api/kernel/DispatchMode.kt | 3 --- .../ainet/backend/api/kernel/KernelDispatch.kt | 3 --- .../sk/ainet/backend/api/kernel/KernelKey.kt | 6 ------ .../sk/ainet/backend/api/kernel/KernelPacks.kt | 3 --- .../backend/api/kernel/MappedCapableKernel.kt | 2 -- .../ainet/backend/api/kernel/MatmulKernels.kt | 4 ---- .../backend/api/kernel/PackedLayoutFixtures.kt | 2 -- .../api/kernel/PackedViewMatmulKernel.kt | 2 -- .../ainet/backend/api/kernel/PackedWeights.kt | 2 -- .../api/kernel/RegistryKernelCapabilities.kt | 2 -- .../backend/api/kernel/TernaryF32GemvKernel.kt | 2 -- .../backend/api/kernel/TernaryF32KernelPack.kt | 5 ----- .../backend/api/kernel/TernaryKernelPacks.kt | 4 ---- .../api/kernel/TernaryPlanesKernelPack.kt | 5 ----- .../ainet/backend/api/kernel/ViewKernelPack.kt | 4 ---- .../ainet/backend/api/kernel/BitNetGemvTest.kt | 2 -- .../backend/api/kernel/BitNetGemvTimingTest.kt | 2 -- .../api/kernel/KernelKeyDispatchTest.kt | 2 -- .../backend/api/kernel/KernelPacksTest.kt | 2 -- .../backend/api/kernel/PackedWeightsTest.kt | 2 -- .../kernel/RegistryKernelCapabilitiesTest.kt | 2 -- .../api/kernel/TernaryF32GemvKernelTest.kt | 2 -- .../api/kernel/TernaryF32KernelPackTest.kt | 2 -- .../api/kernel/TernaryKernelPacksTest.kt | 2 -- .../api/kernel/TernaryPlanesKernelPackTest.kt | 2 -- .../backend/api/kernel/DispatchMode.other.kt | 2 -- .../backend/api/kernel/ViewKernelPack.other.kt | 3 --- .../backend/api/kernel/DispatchMode.jvm.kt | 2 -- .../backend/api/kernel/ViewKernelPack.jvm.kt | 3 --- .../kernel/KernelDispatchConcurrencyTest.kt | 2 -- .../kernel/KernelPacksSegmentStorageTest.kt | 2 -- .../backend/api/kernel/DispatchMode.other.kt | 2 -- .../backend/api/kernel/ViewKernelPack.other.kt | 3 --- .../backend/api/kernel/DispatchMode.other.kt | 2 -- .../backend/api/kernel/ViewKernelPack.other.kt | 3 --- .../backend/api/kernel/DispatchMode.other.kt | 2 -- .../backend/api/kernel/ViewKernelPack.other.kt | 3 --- .../sk/ainet/exec/tensor/ops/DefaultCpuOps.kt | 6 ------ .../ainet/exec/harness/DecodeAcceptanceTest.kt | 2 -- .../sk/ainet/exec/harness/DecodeHarness.kt | 2 -- .../harness/GenerationMetricsHarnessTest.kt | 2 -- .../sk/ainet/exec/harness/M2AcceptanceTest.kt | 2 -- .../ainet/exec/harness/TernaryDecodeHarness.kt | 2 -- .../tensor/ops/FeedOrderWeightNoCopyTest.kt | 2 -- .../tensor/ops/RegistryMatmulDispatchTest.kt | 2 -- .../ops/TernaryWeightTransposeDispatchTest.kt | 2 -- .../tensor/ops/ScopedCreationOpsParityTest.kt | 2 -- .../exec/tensor/ops/ScopedOpOutputsTest.kt | 2 -- .../exec/golden/PackedDecodeGoldenTest.kt | 2 -- .../golden/PackedDispatchBridgeGoldenTest.kt | 2 -- .../exec/golden/PackedTransposeGoldenTest.kt | 2 -- .../ainet/exec/schedule/CoroutineSchedule.kt | 3 --- .../ainet/exec/tensor/ops/DefaultCpuOpsJvm.kt | 2 -- .../exec/schedule/CoroutineScheduleTest.kt | 2 -- .../tensor/ops/QuantizedMemSegMatmulTest.kt | 1 - .../tensor/ops/SlabOperandVectorPathTest.kt | 2 -- .../harness/android/M2A5DeviceMeasurement.kt | 2 -- .../sk/ainet/exec/kernel/jni/JniBitNetGemv.kt | 2 -- .../exec/kernel/jni/JniBufferPackedKernels.kt | 3 --- .../kernel/jni/JniMappedKernelPackFactory.kt | 2 -- .../ainet/exec/kernel/jni/JniTernaryF32Gemv.kt | 2 -- .../kernel/jni/JniTernaryKernelPackFactory.kt | 2 -- .../ainet/exec/kernel/jni/JniTernaryLmhead.kt | 2 -- .../kernel/FfmRowMajorKernelPackFactory.kt | 2 -- .../sk/ainet/exec/kernel/FfmRowMajorKernels.kt | 3 --- .../exec/kernel/FfmTernaryKernelPackFactory.kt | 2 -- .../exec/kernel/NativeTernaryF32GemvKernel.kt | 3 --- .../exec/kernel/NativeTernaryLmheadKernel.kt | 2 -- .../exec/kernel/FfmRowMajorDispatchTest.kt | 2 -- .../exec/kernel/KernelDispatchSelfHealTest.kt | 2 -- .../exec/kernel/KernelSupportMatrixTest.kt | 2 -- .../kernel/NativeTernaryF32GemvKernelTest.kt | 3 --- .../ainet/exec/kernel/TernaryF32FfmPackTest.kt | 2 -- .../ainet/exec/kernel/TernaryPlanesFfmTest.kt | 2 -- .../exec/kernel/NativeKnTernaryF32Gemv.kt | 3 +-- .../ainet/exec/kernel/NativeKnTernaryLmhead.kt | 3 +-- .../kernel/NativeKnTernaryLmheadParityTest.kt | 2 -- .../kotlin/sk/ainet/io/JvmMappedFile.kt | 1 - .../io/gguf/AndroidGgufLoadingHostTest.kt | 2 -- .../sk/ainet/io/gguf/AndroidGgufLoading.kt | 2 -- .../kotlin/sk/ainet/io/gguf/GgufMemoryPlan.kt | 4 ---- .../sk/ainet/io/gguf/ResolvedGgufLoading.kt | 2 -- .../io/gguf/StreamingGgufParametersLoader.kt | 4 +--- .../sk/ainet/io/gguf/dequant/DequantOps.kt | 2 -- .../sk/ainet/io/gguf/GgufMemoryPlanTest.kt | 2 -- .../sk/ainet/io/gguf/GgufTernaryLoadTest.kt | 2 -- .../kotlin/sk/ainet/io/gguf/I2sGgufLoadTest.kt | 2 -- .../sk/ainet/io/gguf/I2sMappedFastPathTest.kt | 2 -- .../sk/ainet/io/gguf/I2sOffHeapLoadTest.kt | 2 -- .../sk/ainet/io/gguf/KernelFeedOrderTest.kt | 2 -- .../ainet/io/gguf/MappedPackedStagingTest.kt | 2 -- .../gguf/PerTensorFormAndResolvedLoadTest.kt | 2 -- .../ainet/io/gguf/PlanesRequantizeLoadTest.kt | 2 -- .../kotlin/sk/ainet/io/gguf/SyntheticGguf.kt | 1 - .../ainet/io/gguf/TernaryWeightMemoryTest.kt | 2 -- .../ainet/io/gguf/WeightFormAcceptanceTest.kt | 2 -- .../io/gguf/WeightFormLoaderParityTest.kt | 2 -- .../sk/ainet/io/gguf/WeightFormTraceTest.kt | 2 -- .../sk/ainet/io/gguf/WeightOrientationTest.kt | 2 -- .../io/gguf/export/I2sAotConverterTest.kt | 2 -- .../kotlin/sk/ainet/io/onnx/OnnxMemoryPlan.kt | 3 --- .../sk/ainet/io/onnx/OnnxMemoryPlanTest.kt | 2 -- .../io/safetensors/SafeTensorsMemoryPlan.kt | 3 --- .../safetensors/SafeTensorsMemoryPlanTest.kt | 2 -- .../ainet/lang/memory/MemoryDebug.android.kt | 2 -- .../lang/memory/PlatformStorage.android.kt | 1 - .../lang/memory/trace/AndroidTraceSink.kt | 2 -- .../sk/ainet/context/ExecutionContext.kt | 8 -------- .../sk/ainet/context/ScopedExecutionContext.kt | 3 --- .../sk/ainet/lang/memory/AllocationSpec.kt | 2 -- .../kotlin/sk/ainet/lang/memory/BlockSpec.kt | 4 ---- .../kotlin/sk/ainet/lang/memory/Describe.kt | 2 -- .../ainet/lang/memory/ExperimentalMemoryApi.kt | 18 ------------------ .../kotlin/sk/ainet/lang/memory/Format.kt | 4 ---- .../kotlin/sk/ainet/lang/memory/I8Absmax.kt | 1 - .../kotlin/sk/ainet/lang/memory/Layout.kt | 1 - .../kotlin/sk/ainet/lang/memory/MemoryDebug.kt | 3 --- .../kotlin/sk/ainet/lang/memory/MemoryProbe.kt | 3 --- .../sk/ainet/lang/memory/PlatformStorage.kt | 2 -- .../kotlin/sk/ainet/lang/memory/Scope.kt | 3 --- .../kotlin/sk/ainet/lang/memory/Storage.kt | 4 ---- .../kotlin/sk/ainet/lang/memory/TensorView.kt | 5 ----- .../sk/ainet/lang/memory/TernaryCodec.kt | 2 -- .../kotlin/sk/ainet/lang/memory/Views.kt | 4 ---- .../sk/ainet/lang/memory/WindowedAttention.kt | 1 - .../kotlin/sk/ainet/lang/memory/WindowedKV.kt | 1 - .../lang/memory/plan/AllocationResolver.kt | 3 --- .../sk/ainet/lang/memory/plan/DeviceFit.kt | 5 ----- .../lang/memory/plan/KernelCapabilities.kt | 2 -- .../sk/ainet/lang/memory/plan/MemoryPlan.kt | 11 ----------- .../sk/ainet/lang/memory/plan/PlanVsActual.kt | 4 ---- .../ainet/lang/memory/plan/PlannerProfile.kt | 5 ----- .../sk/ainet/lang/memory/plan/WeightForm.kt | 6 ------ .../lang/memory/plan/WeightFormResolver.kt | 3 --- .../lang/memory/trace/GenerationMetrics.kt | 3 --- .../lang/memory/trace/GenerationPhases.kt | 9 --------- .../lang/memory/trace/PerfettoTraceExporter.kt | 2 -- .../sk/ainet/lang/memory/trace/PlanTrace.kt | 2 -- .../sk/ainet/lang/memory/trace/TraceEvent.kt | 3 --- .../sk/ainet/lang/memory/trace/TraceSink.kt | 7 ------- .../lang/tensor/data/BitNetB158TensorData.kt | 5 ----- .../lang/tensor/data/BitNetPlanesTensorData.kt | 1 - .../lang/tensor/data/NarrowFloatTensorData.kt | 1 - .../ainet/lang/tensor/data/Q4_0TensorData.kt | 1 - .../ainet/lang/tensor/data/Q4_KTensorData.kt | 1 - .../ainet/lang/tensor/data/Q5_0TensorData.kt | 1 - .../ainet/lang/tensor/data/Q5_1TensorData.kt | 1 - .../ainet/lang/tensor/data/Q5_KTensorData.kt | 1 - .../ainet/lang/tensor/data/Q6_KTensorData.kt | 1 - .../ainet/lang/tensor/data/Q8_0TensorData.kt | 1 - .../tensor/data/ScopedTensorDataFactory.kt | 2 -- .../lang/tensor/data/StorageFloatTensorData.kt | 2 -- .../sk/ainet/lang/tensor/data/TensorData.kt | 3 --- .../lang/tensor/data/TernaryTensorData.kt | 2 -- .../tensor/data/TransposedWeightTensorData.kt | 1 - .../tensor/storage/CompressedKvAttention.kt | 2 -- .../lang/tensor/storage/DefaultKvCacheStore.kt | 9 --------- .../ainet/lang/tensor/storage/KvCacheStore.kt | 9 --------- .../lang/tensor/storage/PackedBlockStorage.kt | 2 -- .../tensor/storage/TurboQuantKvCacheStore.kt | 2 -- .../ainet/context/ExecutionContextScopeTest.kt | 2 -- .../schedule/ScheduledExecutionContextTest.kt | 2 -- .../sk/ainet/lang/memory/AllocationSpecTest.kt | 1 - .../sk/ainet/lang/memory/BlockOrderTest.kt | 1 - .../sk/ainet/lang/memory/DescribeTest.kt | 1 - .../kotlin/sk/ainet/lang/memory/FormatTest.kt | 1 - .../kotlin/sk/ainet/lang/memory/LayoutTest.kt | 1 - .../sk/ainet/lang/memory/MemoryDebugTest.kt | 1 - .../sk/ainet/lang/memory/MemoryProbeTest.kt | 1 - .../ainet/lang/memory/OneViewMechanismTest.kt | 1 - .../lang/memory/PackedTensorDataViewTest.kt | 1 - .../ainet/lang/memory/PlatformStorageTest.kt | 1 - .../kotlin/sk/ainet/lang/memory/ScopeTest.kt | 1 - .../kotlin/sk/ainet/lang/memory/StorageTest.kt | 1 - .../sk/ainet/lang/memory/TensorDataViewTest.kt | 1 - .../sk/ainet/lang/memory/TensorViewTest.kt | 1 - .../ainet/lang/memory/TernaryEncodingTest.kt | 1 - .../sk/ainet/lang/memory/WindowedKvTest.kt | 1 - .../lang/memory/plan/AllocationResolverTest.kt | 2 -- .../ainet/lang/memory/plan/BitNet2BPlanTest.kt | 2 -- .../sk/ainet/lang/memory/plan/DeviceFitTest.kt | 2 -- .../lang/memory/plan/MappedBudgetPlanTest.kt | 2 -- .../ainet/lang/memory/plan/MemoryPlanTest.kt | 2 -- .../ainet/lang/memory/plan/PlanVsActualTest.kt | 2 -- .../lang/memory/plan/PlannerProfileTest.kt | 2 -- .../memory/plan/WeightFormPlanPricingTest.kt | 2 -- .../lang/memory/plan/WeightFormResolverTest.kt | 2 -- .../lang/memory/trace/GenerationMetricsTest.kt | 2 -- .../memory/trace/PerfettoTraceExporterTest.kt | 2 -- .../ainet/lang/memory/trace/TraceSinkTest.kt | 2 -- .../tensor/data/BitNetB158TensorDataTest.kt | 2 -- .../lang/tensor/data/BitNetPlanesCodecTest.kt | 2 -- .../lang/tensor/storage/KvCacheFormatTest.kt | 2 -- .../tensor/storage/KvCacheModelScopeTest.kt | 2 -- .../sk/ainet/lang/memory/MemoryDebug.other.kt | 2 -- .../sk/ainet/lang/memory/MemoryProbe.js.kt | 1 - .../ainet/lang/memory/PlatformStorage.web.kt | 1 - .../ainet/lang/memory/DirectBufferStorage.kt | 2 -- .../lang/memory/MemoryProbe.jvmAndroid.kt | 1 - .../lang/tensor/data/BufferPackedTensorData.kt | 2 -- .../kotlin/sk/ainet/lang/memory/JvmStorage.kt | 2 -- .../sk/ainet/lang/memory/MemoryDebug.jvm.kt | 2 -- .../ainet/lang/memory/PlatformStorage.jvm.kt | 1 - .../sk/ainet/lang/memory/trace/JfrTraceSink.kt | 2 -- .../tensor/data/MemorySegmentTensorData.kt | 1 - .../sk/ainet/lang/memory/JvmStorageTest.kt | 1 - .../lang/memory/PlatformStorageJvmTest.kt | 1 - .../tensor/data/BitNetB158TensorDataJvmTest.kt | 2 -- .../tensor/data/BufferPackedTensorDataTest.kt | 2 -- .../sk/ainet/lang/memory/MemoryDebug.other.kt | 2 -- .../sk/ainet/lang/memory/MemoryProbe.native.kt | 1 - .../sk/ainet/lang/memory/NativeStorage.kt | 2 -- .../lang/memory/PlatformStorage.native.kt | 1 - .../sk/ainet/lang/memory/MemoryDebug.other.kt | 2 -- .../sk/ainet/lang/memory/MemoryProbe.wasmJs.kt | 1 - .../ainet/lang/memory/PlatformStorage.web.kt | 1 - .../sk/ainet/lang/memory/MemoryDebug.other.kt | 2 -- .../ainet/lang/memory/MemoryProbe.wasmWasi.kt | 1 - .../ainet/lang/memory/PlatformStorage.web.kt | 1 - 229 files changed, 12 insertions(+), 540 deletions(-) delete mode 100644 skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/ExperimentalMemoryApi.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 490d12430..8a8727b22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,15 @@ custom quantized payloads) instead of failing on the first unmapped one. Threaded through `withPolicy`. +### Changed + +- **`ExperimentalMemoryApi` opt-in gate removed** (SKEEP-003): the `sk.ainet.lang.memory` API + (`Storage`, `Scope`, `Format`, `Layout`, `TensorView`, `WeightForm`, `WeightByteOrder`, …) no + longer requires `@OptIn(ExperimentalMemoryApi::class)` to use. The annotation's own message — + "usable, but may change until milestone M1 is complete" — was stale: M0/M1/M2 all shipped + complete in 0.49.0. `ExperimentalMemoryApi` is deleted along with every `@OptIn`/ + `@ExperimentalMemoryApi` annotation referencing it. + ## [0.53.0] - 2026-09-02 Headline: **the export pipeline emits billion-parameter models.** Tracing a 4.5B-parameter diff --git a/docs/modules/ROOT/examples/kotlin/sk/ainet/docs/samples/ScheduleDemo.kt b/docs/modules/ROOT/examples/kotlin/sk/ainet/docs/samples/ScheduleDemo.kt index ba96730a6..5625695d2 100644 --- a/docs/modules/ROOT/examples/kotlin/sk/ainet/docs/samples/ScheduleDemo.kt +++ b/docs/modules/ROOT/examples/kotlin/sk/ainet/docs/samples/ScheduleDemo.kt @@ -6,7 +6,6 @@ import sk.ainet.context.ExecutionContext import sk.ainet.context.schedule.Schedule import sk.ainet.context.withSchedule import sk.ainet.exec.schedule.CoroutineSchedule -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.RecordingTraceSink import sk.ainet.lang.memory.trace.TraceEvent import sk.ainet.lang.tensor.Shape @@ -19,7 +18,6 @@ import sk.ainet.lang.types.FP32 * the trace that says which schedule ran. Every region is included verbatim into * `tutorials/schedule-getting-started.adoc`; `SamplesTest` executes it. */ -@OptIn(ExperimentalMemoryApi::class) object ScheduleDemo { class Result( diff --git a/skainet-apps/skainet-plan/src/main/kotlin/sk/ainet/apps/plan/SkainetPlan.kt b/skainet-apps/skainet-plan/src/main/kotlin/sk/ainet/apps/plan/SkainetPlan.kt index 5dae76877..f6c9cdf0a 100644 --- a/skainet-apps/skainet-plan/src/main/kotlin/sk/ainet/apps/plan/SkainetPlan.kt +++ b/skainet-apps/skainet-plan/src/main/kotlin/sk/ainet/apps/plan/SkainetPlan.kt @@ -1,4 +1,3 @@ -@file:OptIn(ExperimentalMemoryApi::class) package sk.ainet.apps.plan @@ -8,7 +7,6 @@ import kotlinx.cli.default import sk.ainet.io.JvmRandomAccessSource import sk.ainet.io.gguf.StreamingGGUFReader import sk.ainet.io.gguf.planInput -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.Budget import sk.ainet.lang.memory.plan.KvCacheMode import sk.ainet.lang.memory.plan.MemoryPlan diff --git a/skainet-apps/skainet-plan/src/test/kotlin/sk/ainet/apps/plan/SkainetPlanTest.kt b/skainet-apps/skainet-plan/src/test/kotlin/sk/ainet/apps/plan/SkainetPlanTest.kt index 1dd17b5c6..34771690e 100644 --- a/skainet-apps/skainet-plan/src/test/kotlin/sk/ainet/apps/plan/SkainetPlanTest.kt +++ b/skainet-apps/skainet-plan/src/test/kotlin/sk/ainet/apps/plan/SkainetPlanTest.kt @@ -1,8 +1,6 @@ -@file:OptIn(ExperimentalMemoryApi::class) package sk.ainet.apps.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.plan.Budget import sk.ainet.lang.memory.plan.MemoryPlans diff --git a/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/scenarios/TernaryF32GemvScenario.kt b/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/scenarios/TernaryF32GemvScenario.kt index 627ae8675..c72e3c5ed 100644 --- a/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/scenarios/TernaryF32GemvScenario.kt +++ b/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/scenarios/TernaryF32GemvScenario.kt @@ -5,7 +5,6 @@ import sk.ainet.backend.api.kernel.TernaryF32GemvKernel import sk.ainet.backend.api.kernel.TernaryKernelPacks import sk.ainet.bench.publish.runner.Scenario import sk.ainet.exec.kernel.NativeTernaryF32GemvKernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -31,7 +30,6 @@ import kotlin.random.Random * Dims default to the BitNet-2B FFN projection (k=2560, n=6912); the n=6912 regime also crosses * the LUT kernel's internal pthread threshold. Primary metric: GOP/s over `2·k·n` ops. */ -@OptIn(ExperimentalMemoryApi::class) internal class TernaryF32GemvScenario( smoke: Boolean, private val providerName: String, diff --git a/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecord.kt b/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecord.kt index da28824ab..95c15da3e 100644 --- a/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecord.kt +++ b/skainet-backends/benchmarks/jvm-cpu-publish/src/main/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecord.kt @@ -2,7 +2,6 @@ package sk.ainet.bench.publish.schema import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.GenerationMetrics /** @@ -49,7 +48,6 @@ public data class GenerationMetricsRecord( ) /** This run's metrics as the record the benchmark JSON carries. */ -@OptIn(ExperimentalMemoryApi::class) public fun GenerationMetrics.toRecord(): GenerationMetricsRecord = GenerationMetricsRecord( prefillTokens = prefillTokens, prefillTokensPerSecond = prefillTokensPerSecond, diff --git a/skainet-backends/benchmarks/jvm-cpu-publish/src/test/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecordTest.kt b/skainet-backends/benchmarks/jvm-cpu-publish/src/test/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecordTest.kt index da351276b..0d951f5b1 100644 --- a/skainet-backends/benchmarks/jvm-cpu-publish/src/test/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecordTest.kt +++ b/skainet-backends/benchmarks/jvm-cpu-publish/src/test/kotlin/sk/ainet/bench/publish/schema/GenerationMetricsRecordTest.kt @@ -1,7 +1,6 @@ package sk.ainet.bench.publish.schema import kotlinx.serialization.json.Json -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.GenerationMetrics import sk.ainet.lang.memory.trace.ModuleCost import java.io.File @@ -17,7 +16,6 @@ import kotlin.test.assertTrue * The written fixture is the script's own test input: `./scripts/check_engine_json.sh * skainet-backends/benchmarks/jvm-cpu-publish/build/engine-json-check` must pass on it. */ -@OptIn(ExperimentalMemoryApi::class) class GenerationMetricsRecordTest { private val json = Json { prettyPrint = true; encodeDefaults = true; explicitNulls = false } diff --git a/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.android.kt b/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.android.kt index 5e510782d..d3e879ccc 100644 --- a/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.android.kt +++ b/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.android.kt @@ -1,6 +1,4 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi -@ExperimentalMemoryApi internal actual fun platformUseRegistry(): Boolean = System.getProperty(DispatchMode.PROPERTY) != "false" diff --git a/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.android.kt b/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.android.kt index df7edc218..00f86734a 100644 --- a/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.android.kt +++ b/skainet-backends/skainet-backend-api/src/androidMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.android.kt @@ -1,14 +1,12 @@ package sk.ainet.backend.api.kernel import java.util.ServiceLoader -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Android discovery for [ViewKernelPack]. `ServiceLoader` exists on Android, so the JNI packs a * consumer ships (e.g. the NEON row-major pack in `skainet-backend-jni-cpu`) are discovered the * same way as on the JVM, provided the packaging step keeps `META-INF/services` entries. */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelPacks(): List = runCatching { ServiceLoader.load(ViewKernelPack::class.java) @@ -21,7 +19,6 @@ internal actual fun installPlatformKernelPacks(): List = * `jvmMain`, which the Android source set does not see. Same two steps it performs — discover, then * register, letting [KernelRegistry] sort by priority on insertion. */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelProviders(): List = runCatching { ServiceLoader.load(KernelProvider::class.java) diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/BitNetGemvKernel.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/BitNetGemvKernel.kt index 5da53b69a..b3ce07a32 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/BitNetGemvKernel.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/BitNetGemvKernel.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.I8Absmax import sk.ainet.lang.memory.Storage @@ -25,7 +24,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * The weight's codes are read once per call, not once per row: a decode step is one row against * the whole matrix, so hoisting it is the difference between O(rows·n·k) decodes and O(n·k). */ -@ExperimentalMemoryApi public class BitNetGemvKernel(override val key: KernelKey) : ViewKernel { override val name: String get() = "bitnet_gemv/reference" diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.kt index 1e8892fcc..88ca596de 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Whether the generic (non-fast-path) matmul goes through [KernelDispatch] or the legacy @@ -11,7 +10,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * construction* instead of a `ClassCastException` (#993). The legacy path stays one flag away * while the migration settles; it is deleted once the golden parity and benchmark evidence is in. */ -@ExperimentalMemoryApi public object DispatchMode { /** Set to `false` (`skainet.dispatch.registry=false`) to force the legacy generic fallback. */ public const val PROPERTY: String = "skainet.dispatch.registry" @@ -24,5 +22,4 @@ public object DispatchMode { } /** Platform reading of [DispatchMode.PROPERTY]; defaults to `true` where there is no property store. */ -@ExperimentalMemoryApi internal expect fun platformUseRegistry(): Boolean diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelDispatch.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelDispatch.kt index 1ddac02b1..dfbbb7944 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelDispatch.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelDispatch.kt @@ -1,7 +1,6 @@ package sk.ainet.backend.api.kernel import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.TensorView @@ -23,7 +22,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * Adapters allocate in the caller's [Scope] (a `Forward` scope in a generation loop) and are * emitted as [TraceEvent.AdapterInserted] — the "hidden 12 GB" of #782 becomes a visible event. */ -@ExperimentalMemoryApi public object KernelDispatch { /** @@ -255,7 +253,6 @@ public object KernelDispatch { } /** A view of the same contiguous bytes under a different shape (rule 5: reshape is a view). */ -@ExperimentalMemoryApi public fun TensorView.reshapeContiguous(newShape: Shape): TensorView { require(isContiguous) { "reshape needs a contiguous view" } require(newShape.volume.toLong() == elementCount) { "reshape must keep the element count ($elementCount), got ${newShape.volume}" } diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelKey.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelKey.kt index 696428bd4..06c652030 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelKey.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelKey.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.TensorView import sk.ainet.lang.tensor.storage.TensorEncoding @@ -14,7 +13,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * Keys are values: equal keys select the same kernel, and a key prints as something a log or an * `UnsupportedKernel` message can show: `matmul(F32/Dense(4B) contiguous × F32/Q4_K blocked) @host`. */ -@ExperimentalMemoryApi public data class KernelKey( val op: String, val operands: List, @@ -43,7 +41,6 @@ public data class KernelKey( } /** One operand of a [KernelKey]: its [Format] plus the layout class the kernel must cope with. */ -@ExperimentalMemoryApi public data class OperandKey(val format: Format, val layout: LayoutClass) { override fun toString(): String = "$format ${layout.name.lowercase()}" @@ -77,7 +74,6 @@ public data class OperandKey(val format: Format, val layout: LayoutClass) { * orders, and #973 is what happens when that is left implicit. A kernel declares which one it * takes, and the dispatcher relayouts when the operand disagrees. */ -@ExperimentalMemoryApi public enum class LayoutClass { CONTIGUOUS, STRIDED, @@ -94,7 +90,6 @@ public enum class LayoutClass { } /** Thrown when no registered kernel and no adapter chain can serve a key; lists what is registered. */ -@ExperimentalMemoryApi public class UnsupportedKernelException( public val key: KernelKey, public val candidates: List, @@ -102,7 +97,6 @@ public class UnsupportedKernelException( ) : IllegalArgumentException(message) /** The encoding name a [KernelKey] uses for a format, matching `KernelProvider.supports`' dtype keys. */ -@ExperimentalMemoryApi public val Format.kernelEncodingName: String get() = when (val e = encoding) { is TensorEncoding.Dense -> dtype.name diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelPacks.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelPacks.kt index e074f7bb2..611320fea 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelPacks.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/KernelPacks.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -21,7 +20,6 @@ import sk.ainet.lang.types.FP32 * the dispatcher relayouts. That distinction is what #1029 was missing and what made mixing the two * a silent-wrong-numbers bug rather than a crash (#968, #971). */ -@ExperimentalMemoryApi public object KernelPacks { /** Capability marker for a provider that needs an explicit vector unit (Panama, NEON, …). */ @@ -81,7 +79,6 @@ public object KernelPacks { * output-major (`[n, k]`, the shape SKaiNET's dispatch normalises to). Unwraps each view once — * per the Phase-2 spike (#1016) — and calls the pack's strided GEMM. */ -@ExperimentalMemoryApi public class Fp32ViewMatmulKernel( providerName: String, private val kernel: Fp32MatmulKernel, diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MappedCapableKernel.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MappedCapableKernel.kt index b43c183fe..310fa2049 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MappedCapableKernel.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MappedCapableKernel.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Marks a [ViewKernel] that serves its `BLOCKED_ROW_MAJOR` weight operand straight from off-heap @@ -17,5 +16,4 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * so a kernel gaining or losing this marker without updating them fails CI instead of drifting * silently. */ -@ExperimentalMemoryApi public interface MappedCapableKernel diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MatmulKernels.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MatmulKernels.kt index 47d12ebbc..b48d9f619 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MatmulKernels.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/MatmulKernels.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.TensorView @@ -9,7 +8,6 @@ import sk.ainet.lang.memory.TensorView * *Kernel*, §5.2). Custom kernels are written against views and registered — an author never * touches a `TensorData` subclass. */ -@ExperimentalMemoryApi public interface ViewKernel { /** What this kernel serves. */ public val key: KernelKey @@ -39,7 +37,6 @@ public interface ViewKernel { * `out = a × bᵀ` in the shapes SKaiNET's dispatch normalises to: `a` is `[m, k]`, `b` is `[n, k]` * (a weight stored output-major, as GGUF does), `out` is `[m, n]`. */ -@ExperimentalMemoryApi public class ReferenceMatmulKernel(override val key: KernelKey) : ViewKernel { override val name: String get() = "reference" @@ -61,7 +58,6 @@ public class ReferenceMatmulKernel(override val key: KernelKey) : ViewKernel { public companion object { /** The reference kernel for the formats of [a] and [b]. */ - @ExperimentalMemoryApi public fun forOperands(a: Format, b: Format): ReferenceMatmulKernel = ReferenceMatmulKernel(KernelKey("matmul", listOf(OperandKey.contiguous(a), OperandKey.contiguous(b)))) } diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedLayoutFixtures.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedLayoutFixtures.kt index 200b9eac1..071ad7c3f 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedLayoutFixtures.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedLayoutFixtures.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.blockSpec import sk.ainet.lang.tensor.storage.TensorEncoding @@ -21,7 +20,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * Every fixture is **three blocks wide** on purpose. At one block per row the two orders coincide, * which is exactly the shape that hid #968. */ -@ExperimentalMemoryApi public object PackedLayoutFixtures { /** The formats the contract covers — everything with a block geometry and a matmul kernel. */ diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedViewMatmulKernel.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedViewMatmulKernel.kt index dcdcb725f..23e6d7393 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedViewMatmulKernel.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedViewMatmulKernel.kt @@ -1,7 +1,6 @@ package sk.ainet.backend.api.kernel import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -20,7 +19,6 @@ import sk.ainet.lang.types.FP32 * One row at a time: the SPI is a matrix-vector kernel, so an activation of `m` rows is `m` calls, * which is what the decode path does anyway (`m == 1`). */ -@ExperimentalMemoryApi public class PackedViewMatmulKernel( providerName: String, private val encodingName: String, diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedWeights.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedWeights.kt index aa33f16dd..4fd55d003 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedWeights.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/PackedWeights.kt @@ -1,7 +1,6 @@ package sk.ainet.backend.api.kernel import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.blockSpec import sk.ainet.lang.memory.TensorView @@ -23,7 +22,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * The relayout is O(bytes). Call it **once, at load**; a weight prepacked at load hits the packed * kernel's key directly and the dispatcher copies nothing per call (#1095). */ -@ExperimentalMemoryApi public object PackedWeights { /** diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilities.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilities.kt index 18c8afdf7..9a84effda 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilities.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilities.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.KernelCapabilities import sk.ainet.lang.tensor.storage.TensorEncoding @@ -26,7 +25,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * CPU cannot feed anything, whatever it declares. Dispatch kernels carry their requirements in * their key's capability set instead, and are filtered when they are selected. */ -@ExperimentalMemoryApi public object RegistryKernelCapabilities : KernelCapabilities { /** The activation dtype every packed matmul kernel in the tree takes. */ diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernel.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernel.kt index 6ef4a48b2..3176dc230 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernel.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernel.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -30,7 +29,6 @@ import sk.ainet.lang.types.FP32 * row-major order. Output `[rows, n]` FP32. The per-tensor scale is applied to the output — * native implementations ([TernaryF32GemvNative]) do not see it. */ -@ExperimentalMemoryApi public class TernaryF32GemvKernel(override val key: KernelKey) : ViewKernel { override val name: String get() = "ternary_f32_gemv/reference" diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPack.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPack.kt index 46f2c18e9..3d1228b03 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPack.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPack.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView import sk.ainet.lang.memory.TernaryCodec @@ -17,7 +16,6 @@ import sk.ainet.lang.memory.TernaryCodec * per-tensor scale is NOT applied here — the wrapping view kernel owns it. `inputDim` must be a * multiple of 4 (the packing is byte-per-4-elements per row). */ -@ExperimentalMemoryApi public interface TernaryF32GemvNative { /** A name for logs and traces, e.g. `ffm`, `neon`. */ public val name: String @@ -44,7 +42,6 @@ public interface TernaryF32GemvNative { * * The default is still correct everywhere: one transient snapshot, then [gemvPacked]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public fun gemvPackedStorage( activation: FloatArray, activationOffset: Int, @@ -74,7 +71,6 @@ public interface TernaryF32GemvNative { * Absence of the native artifact is a notice through [warn], never a crash — behavior is exactly * today's. */ -@ExperimentalMemoryApi public object TernaryF32KernelPack { /** What [install] returns when no native kernel is available and nothing was registered. */ @@ -119,7 +115,6 @@ public object TernaryF32KernelPack { * a strided view, or `k % 4 != 0` (the sequential packing crosses byte boundaries between rows * then) — instead of failing: the fast path is an optimization, never a correctness requirement. */ -@ExperimentalMemoryApi public class NativeTernaryF32ViewKernel( private val native: TernaryF32GemvNative, override val key: KernelKey, diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacks.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacks.kt index 1a9de3979..d495c7722 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacks.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacks.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.I8Absmax import sk.ainet.lang.memory.Storage @@ -20,7 +19,6 @@ import sk.ainet.lang.types.FP32 * why this one can be bridged into the view registry while those still wait on #973: there is no * ambiguity here, and the parity test pins it. */ -@ExperimentalMemoryApi public interface BitNetGemvNative { /** A name for logs and traces, e.g. `neon-dotprod`. */ public val name: String @@ -47,7 +45,6 @@ public interface BitNetGemvNative { * registered, so dispatch keeps working at reference speed and the caller is *told* through [warn] * rather than left to wonder why decode got slower. */ -@ExperimentalMemoryApi public object TernaryKernelPacks { /** Capability a `bitnet_gemv` pack declares when it needs ARMv8.2 dot-product instructions. */ @@ -97,7 +94,6 @@ public object TernaryKernelPacks { * activation (prefill) or storage that is not a heap array — instead of failing: the fast path is * an optimization, never a correctness requirement. */ -@ExperimentalMemoryApi public class NativeBitNetGemvKernel( private val native: BitNetGemvNative, override val key: KernelKey, diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPack.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPack.kt index d2ef09a8e..029a457da 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPack.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPack.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -22,7 +21,6 @@ import sk.ainet.lang.types.FP32 * is how [NativeTernaryPlanesViewKernel] keeps the dispatch invariant *matmul == decoded matmul*. * `inputDim % 4 == 0`; [rowScaleByteOffset] must be 2-byte aligned. */ -@ExperimentalMemoryApi public interface TernaryLmheadNative { /** A name for logs and traces, e.g. `ffm`. */ public val name: String @@ -46,7 +44,6 @@ public interface TernaryLmheadNative { * [TernaryF32KernelPack]: registration **only with a native kernel** — without it, dispatch falls * back to the decoding reference matmul (correct, slow), told through [warn], never a crash. */ -@ExperimentalMemoryApi public object TernaryPlanesKernelPack { /** What [install] returns when no native kernel is available and nothing was registered. */ @@ -77,7 +74,6 @@ public object TernaryPlanesKernelPack { * row scale) through [TernaryCodec] and accumulates in FP32. The correctness oracle and the * in-kernel fallback; deliberately not a dispatch entry on its own. */ -@ExperimentalMemoryApi public class TernaryPlanesMatmulKernel(override val key: KernelKey) : ViewKernel { override val name: String get() = "ternary_planes_matmul/reference" @@ -134,7 +130,6 @@ public class TernaryPlanesMatmulKernel(override val key: KernelKey) : ViewKernel * * Falls back to the reference for non-heap storage, strided views, or `k % 4 != 0`. */ -@ExperimentalMemoryApi public class NativeTernaryPlanesViewKernel( private val native: TernaryLmheadNative, override val key: KernelKey, diff --git a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.kt b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.kt index 2771608d0..6df1cd9e1 100644 --- a/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.kt +++ b/skainet-backends/skainet-backend-api/src/commonMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * A installable set of [ViewKernel]s for [KernelDispatch] — the view-keyed sibling of @@ -21,7 +20,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * equivalent on Kotlin/Native, wasm or JS, so those platforms install their packs manually (see * `installPlatformKernelPacks`). */ -@ExperimentalMemoryApi public interface ViewKernelPack { /** Stable identifier, used for logging and de-duplication (e.g. `"ffm-rowmajor"`). */ @@ -42,7 +40,6 @@ public interface ViewKernelPack { * JVM: `ServiceLoader`-discovered, mirroring [KernelServiceLoader]. Everywhere else: no discovery * mechanism exists, so this returns an empty list and the consumer installs packs explicitly. */ -@ExperimentalMemoryApi internal expect fun installPlatformKernelPacks(): List /** @@ -52,5 +49,4 @@ internal expect fun installPlatformKernelPacks(): List * which is `null` on an empty registry — a bootstrap that runs before any ops instance exists * would otherwise install nothing but the reference kernel. */ -@ExperimentalMemoryApi internal expect fun installPlatformKernelProviders(): List diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTest.kt index 861e59851..b40a5f0f8 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.I8Absmax @@ -24,7 +23,6 @@ import kotlin.test.assertTrue /** * #1040 (M2-F3): int8 activations against ternary weights, and the adapter that produces them. */ -@OptIn(ExperimentalMemoryApi::class) class BitNetGemvTest { private val k = 256 // one TQ block diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTimingTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTimingTest.kt index ca364170f..5caf1fbed 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTimingTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/BitNetGemvTimingTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.I8Absmax import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.Storage @@ -23,7 +22,6 @@ import kotlin.time.TimeSource * shared CI hardware, and the acceptance measurement belongs on the reference device, where this * same test is run from the Kotlin/Native binary. */ -@OptIn(ExperimentalMemoryApi::class) class BitNetGemvTimingTest { private companion object { diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelKeyDispatchTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelKeyDispatchTest.kt index 60cc15521..42632b7af 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelKeyDispatchTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelKeyDispatchTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.ScopeKind @@ -29,7 +28,6 @@ import kotlin.test.assertTrue * format — so the #993 (rank-1 decode step × packed weight) and #991 (activation subtype) cases * cannot crash. */ -@OptIn(ExperimentalMemoryApi::class) class KernelKeyDispatchTest { @AfterTest fun cleanup() { KernelDispatch.clearForTesting() } diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksTest.kt index db84119b5..b63d2f606 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -16,7 +15,6 @@ import kotlin.test.assertIs import kotlin.test.assertTrue /** SKEEP-003 §5.2: platform packs register their kernels under view keys; the reference is always present. */ -@OptIn(ExperimentalMemoryApi::class) class KernelPacksTest { @AfterTest fun cleanup() { KernelDispatch.clearForTesting(); KernelRegistry.clearForTesting() } diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/PackedWeightsTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/PackedWeightsTest.kt index 8b9b7bcf0..c4e45109a 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/PackedWeightsTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/PackedWeightsTest.kt @@ -1,7 +1,6 @@ package sk.ainet.backend.api.kernel import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.PackedBlockDecoder import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -24,7 +23,6 @@ import kotlin.test.assertTrue * point of these tests is that there is now exactly one, that it is its own inverse, and that a * change to what "canonical" means fails a test rather than shipping. */ -@OptIn(ExperimentalMemoryApi::class) class PackedWeightsTest { private val rows = 4 diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilitiesTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilitiesTest.kt index 97f05f99b..bbe4e9d20 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilitiesTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/RegistryKernelCapabilitiesTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.storage.TensorEncoding import kotlin.test.AfterTest import kotlin.test.Test @@ -10,7 +9,6 @@ import kotlin.test.assertTrue /** * #1109 slice 1: the capability answer comes from the registry, so it cannot disagree with dispatch. */ -@OptIn(ExperimentalMemoryApi::class) class RegistryKernelCapabilitiesTest { @AfterTest fun cleanup() { KernelDispatch.clearForTesting(); KernelRegistry.clearForTesting() } diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernelTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernelTest.kt index e50f06d0b..4cd2361a9 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernelTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32GemvKernelTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView import sk.ainet.lang.memory.TernaryBlockDecoder @@ -18,7 +17,6 @@ import kotlin.test.assertTrue * *decoded* weight ([TernaryCodec.decodeBitNet]). The codes-dot is exact; only summation * order may differ. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryF32GemvKernelTest { private fun ternaryValues(count: Int, seed: Int): FloatArray { diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPackTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPackTest.kt index 57be4e8c9..00c5a91e4 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPackTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryF32KernelPackTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Owner import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.ScopeKind @@ -29,7 +28,6 @@ import kotlin.test.assertTrue * and its absence changes nothing — FP32 activations keep flowing through the int8-requantize → * `bitnet_gemv` path exactly as before, with a notice instead of a crash. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryF32KernelPackTest { private val k = 64 diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacksTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacksTest.kt index 797d3f3a4..db8fb7dac 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacksTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryKernelPacksTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.I8Absmax import sk.ainet.lang.memory.Scope @@ -28,7 +27,6 @@ import kotlin.test.assertTrue * around it, which every target can check: who gets registered, what happens without the artifact, * and that the native path is only taken for the shapes it declares. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryKernelPacksTest { private val k = 256 diff --git a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPackTest.kt b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPackTest.kt index 108cb8ae2..7a2fb3e1d 100644 --- a/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPackTest.kt +++ b/skainet-backends/skainet-backend-api/src/commonTest/kotlin/sk/ainet/backend/api/kernel/TernaryPlanesKernelPackTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -24,7 +23,6 @@ import kotlin.test.assertTrue * the view kernel's two-call combination (`s0 + s4/81`) must equal the full 8-plane reference — * the dispatch invariant *matmul == decoded matmul* holds exactly. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryPlanesKernelPackTest { private val k = 32 diff --git a/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt b/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt index 94d26a87c..abf7066fd 100644 --- a/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt +++ b/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt @@ -1,7 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** No system properties here: the registry path is always on (override in tests via [DispatchMode.overrideEnabled]). */ -@ExperimentalMemoryApi internal actual fun platformUseRegistry(): Boolean = true diff --git a/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt b/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt index 071dde841..fd17dd463 100644 --- a/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt +++ b/skainet-backends/skainet-backend-api/src/jsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt @@ -1,14 +1,11 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * No `ServiceLoader` on this platform, so there is nothing to discover: packs are installed * explicitly by the consumer (the same split [KernelProvider] documents — see * `NativeKnKernelProvider`, which is registered by hand on Kotlin/Native). */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelPacks(): List = emptyList() -@ExperimentalMemoryApi internal actual fun installPlatformKernelProviders(): List = emptyList() diff --git a/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.jvm.kt b/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.jvm.kt index 5e510782d..d3e879ccc 100644 --- a/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.jvm.kt +++ b/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.jvm.kt @@ -1,6 +1,4 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi -@ExperimentalMemoryApi internal actual fun platformUseRegistry(): Boolean = System.getProperty(DispatchMode.PROPERTY) != "false" diff --git a/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.jvm.kt b/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.jvm.kt index cedf8bace..cacd1dc7d 100644 --- a/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.jvm.kt +++ b/skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.jvm.kt @@ -1,7 +1,6 @@ package sk.ainet.backend.api.kernel import java.util.ServiceLoader -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * JVM discovery for [ViewKernelPack], mirroring [KernelServiceLoader]'s handling of @@ -13,7 +12,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * optional backend must not take the process down, and the reference kernel still serves every * format correctly. */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelPacks(): List = runCatching { ServiceLoader.load(ViewKernelPack::class.java) @@ -21,6 +19,5 @@ internal actual fun installPlatformKernelPacks(): List = .toList() }.getOrElse { emptyList() } -@ExperimentalMemoryApi internal actual fun installPlatformKernelProviders(): List = runCatching { KernelServiceLoader.installAll() }.getOrElse { emptyList() } diff --git a/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelDispatchConcurrencyTest.kt b/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelDispatchConcurrencyTest.kt index 1f05114bb..6cd3f84f4 100644 --- a/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelDispatchConcurrencyTest.kt +++ b/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelDispatchConcurrencyTest.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.TensorView import sk.ainet.lang.types.FP32 @@ -19,7 +18,6 @@ import kotlin.test.assertTrue * concurrent reads while writes stay serialized — no `ConcurrentModificationException`, no * double auto-install, no lost registration. */ -@OptIn(ExperimentalMemoryApi::class) class KernelDispatchConcurrencyTest { @AfterTest fun cleanup() { KernelDispatch.clearForTesting(); KernelRegistry.clearForTesting() } diff --git a/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksSegmentStorageTest.kt b/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksSegmentStorageTest.kt index 00f970629..f6c9b038b 100644 --- a/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksSegmentStorageTest.kt +++ b/skainet-backends/skainet-backend-api/src/jvmTest/kotlin/sk/ainet/backend/api/kernel/KernelPacksSegmentStorageTest.kt @@ -1,7 +1,6 @@ package sk.ainet.backend.api.kernel import java.lang.foreign.ValueLayout -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.SegmentStorage import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -21,7 +20,6 @@ import kotlin.test.assertTrue * (the crash this masked until #325/#341's readDense fix is a separate, already-fixed bug: the * reference kernel didn't even support element access over Segment storage at all). */ -@OptIn(ExperimentalMemoryApi::class) class KernelPacksSegmentStorageTest { @AfterTest fun cleanup() { KernelDispatch.clearForTesting(); KernelRegistry.clearForTesting() } diff --git a/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt b/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt index 94d26a87c..abf7066fd 100644 --- a/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt +++ b/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt @@ -1,7 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** No system properties here: the registry path is always on (override in tests via [DispatchMode.overrideEnabled]). */ -@ExperimentalMemoryApi internal actual fun platformUseRegistry(): Boolean = true diff --git a/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt b/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt index 8610da612..a5ca2f8ba 100644 --- a/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt +++ b/skainet-backends/skainet-backend-api/src/nativeMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt @@ -1,6 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * No `ServiceLoader` on this platform, so there is nothing to discover: packs are installed @@ -10,8 +9,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * calls `NativeKnTernaryF32Gemv.install()` / `NativeKnTernaryLmhead.install()` itself, or * dispatch serves the decoding reference kernels. */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelPacks(): List = emptyList() -@ExperimentalMemoryApi internal actual fun installPlatformKernelProviders(): List = emptyList() diff --git a/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt b/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt index 94d26a87c..abf7066fd 100644 --- a/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt +++ b/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt @@ -1,7 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** No system properties here: the registry path is always on (override in tests via [DispatchMode.overrideEnabled]). */ -@ExperimentalMemoryApi internal actual fun platformUseRegistry(): Boolean = true diff --git a/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt b/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt index 071dde841..fd17dd463 100644 --- a/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt +++ b/skainet-backends/skainet-backend-api/src/wasmJsMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt @@ -1,14 +1,11 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * No `ServiceLoader` on this platform, so there is nothing to discover: packs are installed * explicitly by the consumer (the same split [KernelProvider] documents — see * `NativeKnKernelProvider`, which is registered by hand on Kotlin/Native). */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelPacks(): List = emptyList() -@ExperimentalMemoryApi internal actual fun installPlatformKernelProviders(): List = emptyList() diff --git a/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt b/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt index 94d26a87c..abf7066fd 100644 --- a/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt +++ b/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/DispatchMode.other.kt @@ -1,7 +1,5 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** No system properties here: the registry path is always on (override in tests via [DispatchMode.overrideEnabled]). */ -@ExperimentalMemoryApi internal actual fun platformUseRegistry(): Boolean = true diff --git a/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt b/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt index 071dde841..fd17dd463 100644 --- a/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt +++ b/skainet-backends/skainet-backend-api/src/wasmWasiMain/kotlin/sk/ainet/backend/api/kernel/ViewKernelPack.other.kt @@ -1,14 +1,11 @@ package sk.ainet.backend.api.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * No `ServiceLoader` on this platform, so there is nothing to discover: packs are installed * explicitly by the consumer (the same split [KernelProvider] documents — see * `NativeKnKernelProvider`, which is registered by hand on Kotlin/Native). */ -@ExperimentalMemoryApi internal actual fun installPlatformKernelPacks(): List = emptyList() -@ExperimentalMemoryApi internal actual fun installPlatformKernelProviders(): List = emptyList() diff --git a/skainet-backends/skainet-backend-cpu/src/commonMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOps.kt b/skainet-backends/skainet-backend-cpu/src/commonMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOps.kt index b18cab061..03f9f9a0a 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOps.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOps.kt @@ -204,7 +204,6 @@ public open class DefaultCpuOpsBase( // `inline` is load-bearing: a non-inlined `(Float, Float) -> Float` lambda // would box through `Function2` and reintroduce the very churn removed. - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun floatBufferOf(t: Tensor): FloatArray? = when (val d = t.data) { is FloatArrayTensorData<*> -> d.buffer // Slab-backed data (#1145/#1146) has a nonzero base offset, so it cannot hand out its raw @@ -217,7 +216,6 @@ public open class DefaultCpuOpsBase( /** Zero-copy dense-FP32 window: the backing array plus the base offset of element 0 (#1146). */ private class FloatWindow(val arr: FloatArray, val off: Int) - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun floatWindowOf(t: Tensor): FloatWindow? = when (val d = t.data) { is FloatArrayTensorData<*> -> FloatWindow(d.buffer, 0) is sk.ainet.lang.tensor.data.StorageFloatTensorData<*> -> { @@ -232,7 +230,6 @@ public open class DefaultCpuOpsBase( * The scope the factory is placing outputs in, or `Ambient` — passed to kernel dispatch so * adapter allocations (requantized activations, prepacked weights) land in the slab too (#1146). */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) protected fun dispatchScope(): sk.ainet.lang.memory.Scope = (dataFactory as? sk.ainet.lang.tensor.data.ScopedTensorDataFactory)?.currentScope ?: sk.ainet.lang.memory.Scope.Ambient @@ -715,7 +712,6 @@ public open class DefaultCpuOpsBase( * Run `matmul` through [KernelDispatch] when both operands can describe themselves as views and * the result is float-typed; `null` means "not expressible here, use the legacy path". */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) @Suppress("UNCHECKED_CAST") private fun dispatchMatmulViaRegistry(a: Tensor, b: Tensor): Tensor? { if (!sk.ainet.backend.api.kernel.DispatchMode.useRegistry()) return null @@ -1067,7 +1063,6 @@ public open class DefaultCpuOpsBase( * relayout-and-cache path its vectorized kernels can use. `null` when the operands cannot * describe themselves as views. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) @Suppress("UNCHECKED_CAST") protected fun matmulWeightTransposedViaViews(x: Tensor, weight: Tensor): Tensor? { if (!sk.ainet.backend.api.kernel.DispatchMode.useRegistry()) return null @@ -1149,7 +1144,6 @@ public open class DefaultCpuOpsBase( * same array. `null` when [tensor] is not a feed-order packed weight. */ @Suppress("UNCHECKED_CAST") - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) protected fun rewrapFeedOrderWeight(tensor: Tensor): Tensor? { if (tensor.shape.rank != 2) return null val packed = tensor.data as? sk.ainet.lang.tensor.storage.PackedBlockStorage ?: return null diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeAcceptanceTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeAcceptanceTest.kt index 6a506e1e5..8f1bfdbee 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeAcceptanceTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeAcceptanceTest.kt @@ -1,6 +1,5 @@ package sk.ainet.exec.harness -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.memory.plan.ActualMemory import sk.ainet.lang.memory.plan.PlanVsActual @@ -15,7 +14,6 @@ import kotlin.test.assertTrue * (#1032 option (c)): the memory behaviour is checked here, where the memory code lives; the real * model's tok/s and TTFT belong to `skainet-decode` in SKaiNET-transformers. */ -@OptIn(ExperimentalMemoryApi::class) class DecodeAcceptanceTest { // Enough steps to prove the staircase is flat, few enough for Karma's 2 s per-test budget in a diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeHarness.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeHarness.kt index f4d6ef7e1..20d755d32 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeHarness.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/DecodeHarness.kt @@ -1,7 +1,6 @@ package sk.ainet.exec.harness import sk.ainet.backend.api.kernel.KernelDispatch -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.ModelScope @@ -47,7 +46,6 @@ import sk.ainet.lang.types.FP32 * The real end-to-end numbers (tok/s, TTFT, peak load RSS, effective bandwidth) belong to the * `skainet-decode` sample in SKaiNET-transformers, which owns the model. */ -@OptIn(ExperimentalMemoryApi::class) public class DecodeHarness( // Deliberately tiny: the reference kernel decodes every element, and these tests run in a // browser under Karma's 2 s per-test budget as well as on the JVM. The assertions are about diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/GenerationMetricsHarnessTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/GenerationMetricsHarnessTest.kt index 7be1b473f..4a8562596 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/GenerationMetricsHarnessTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/GenerationMetricsHarnessTest.kt @@ -1,6 +1,5 @@ package sk.ainet.exec.harness -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.Counters import sk.ainet.lang.memory.trace.GenerationMetrics import sk.ainet.lang.memory.trace.PerfettoTraceExporter @@ -17,7 +16,6 @@ import kotlin.test.assertTrue * `KernelDispatch` — opens the spans the reader needs and produces numbers that make sense, * including the effective bandwidth, on every target the harness runs on. */ -@OptIn(ExperimentalMemoryApi::class) class GenerationMetricsHarnessTest { private val promptTokens = 3 diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/M2AcceptanceTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/M2AcceptanceTest.kt index e40e8908b..de4cbc2d6 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/M2AcceptanceTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/M2AcceptanceTest.kt @@ -1,6 +1,5 @@ package sk.ainet.exec.harness -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.I8Absmax import sk.ainet.lang.memory.MemoryProbe import sk.ainet.lang.memory.ScopeKind @@ -19,7 +18,6 @@ import kotlin.test.assertTrue * assert is a *model*: BitNet-2B's resident total is the planner's answer (M2-A1) and the decode * sample's measurement, not something a synthetic harness can claim. */ -@OptIn(ExperimentalMemoryApi::class) class M2AcceptanceTest { private val steps = 12 diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/TernaryDecodeHarness.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/TernaryDecodeHarness.kt index 6ed7796b7..5edaee852 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/TernaryDecodeHarness.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/harness/TernaryDecodeHarness.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.harness import sk.ainet.backend.api.kernel.KernelDispatch import sk.ainet.backend.api.kernel.TernaryKernelPacks -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.I8Absmax @@ -36,7 +35,6 @@ import sk.ainet.lang.types.FP32 * BitNet-2B numbers belong to the decode sample in SKaiNET-transformers; what belongs here is that * the memory behaviour holds, on every target, including a 2 GB ARM board. */ -@OptIn(ExperimentalMemoryApi::class) public class TernaryDecodeHarness( public val layers: Int = 2, public val hidden: Int = 256, diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/FeedOrderWeightNoCopyTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/FeedOrderWeightNoCopyTest.kt index 5fd8712a3..a134c6705 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/FeedOrderWeightNoCopyTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/FeedOrderWeightNoCopyTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.tensor.ops import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.Tensor import sk.ainet.lang.tensor.data.Q8_0BlockTensorData @@ -23,7 +22,6 @@ import kotlin.test.assertTrue * once per weight stops running at all. Asserted structurally rather than by timing: the bytes the * kernels are handed must be *the same array*, not an equal one. */ -@OptIn(ExperimentalMemoryApi::class) class FeedOrderWeightNoCopyTest { private val ctx = DirectCpuExecutionContext() diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/RegistryMatmulDispatchTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/RegistryMatmulDispatchTest.kt index e3c09c466..dcb177860 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/RegistryMatmulDispatchTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/RegistryMatmulDispatchTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.tensor.ops import sk.ainet.backend.api.kernel.DispatchMode import sk.ainet.context.DirectCpuExecutionContext -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.data.Q4_KBlockTensorData import sk.ainet.lang.tensor.data.Q8_0BlockTensorData @@ -20,7 +19,6 @@ import kotlin.test.assertTrue * activation whose `TensorData` subtype the fast path did not accept). Both must produce correct, * finite numbers — and the registry path and the legacy path must agree. */ -@OptIn(ExperimentalMemoryApi::class) class RegistryMatmulDispatchTest { @AfterTest fun reset() { DispatchMode.overrideEnabled = null } diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/TernaryWeightTransposeDispatchTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/TernaryWeightTransposeDispatchTest.kt index 0443bcc94..654ff308f 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/TernaryWeightTransposeDispatchTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/tensor/ops/TernaryWeightTransposeDispatchTest.kt @@ -1,7 +1,6 @@ package sk.ainet.exec.tensor.ops import sk.ainet.context.DirectCpuExecutionContext -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.data.BitNetB158TensorData @@ -22,7 +21,6 @@ import kotlin.test.assertTrue * which returns ternary CODES, not values — and threw `ClassCastException` (Byte → Float) on the * JVM. The oracle here is the decoded matmul. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryWeightTransposeDispatchTest { private val ctx = DirectCpuExecutionContext() diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedCreationOpsParityTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedCreationOpsParityTest.kt index 8ee9ead27..2691ab65b 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedCreationOpsParityTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedCreationOpsParityTest.kt @@ -2,7 +2,6 @@ package sk.ainet.sk.ainet.exec.tensor.ops import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.context.forwardScope -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.data.StorageFloatTensorData import sk.ainet.lang.types.FP32 @@ -17,7 +16,6 @@ import kotlin.test.assertTrue * deliberately stays off `FloatArrayTensorData`, so real CPU ops must produce numbers identical * to the Ambient path — for tensors sliced from anywhere in the slab, across resets. */ -@OptIn(ExperimentalMemoryApi::class) class ScopedCreationOpsParityTest { @Test diff --git a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedOpOutputsTest.kt b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedOpOutputsTest.kt index ee0f3d231..00f346d87 100644 --- a/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedOpOutputsTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/sk/ainet/exec/tensor/ops/ScopedOpOutputsTest.kt @@ -2,7 +2,6 @@ package sk.ainet.sk.ainet.exec.tensor.ops import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.context.forwardScope -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.StorageClosedException import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.Tensor @@ -21,7 +20,6 @@ import kotlin.test.assertTrue * results, steady-state decode reuses the slab exactly (flat `peakFloats`, zero overflow), the * numbers are bit-identical to Ambient, and a stale read after `reset()` is loud. */ -@OptIn(ExperimentalMemoryApi::class) class ScopedOpOutputsTest { private val xVals = FloatArray(8) { (it - 3).toFloat() * 0.5f } // [2, 4] diff --git a/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDecodeGoldenTest.kt b/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDecodeGoldenTest.kt index 205c8e305..a586714c2 100644 --- a/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDecodeGoldenTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDecodeGoldenTest.kt @@ -10,7 +10,6 @@ import sk.ainet.lang.tensor.data.Q5_KBlockTensorData import sk.ainet.lang.tensor.data.Q6_KBlockTensorData import sk.ainet.lang.tensor.data.Q8_0BlockTensorData import sk.ainet.lang.tensor.data.Ternary2BitTensorData -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView import sk.ainet.lang.memory.TernaryBlockDecoder @@ -24,7 +23,6 @@ import kotlin.test.Test * bit-identical floats for the same bytes. Guards the TensorData → TensorView façade migration * (M1) and every later refactor of the packed storage types. */ -@OptIn(ExperimentalMemoryApi::class) class PackedDecodeGoldenTest { private companion object { diff --git a/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDispatchBridgeGoldenTest.kt b/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDispatchBridgeGoldenTest.kt index 246a47f91..6f87b2cfc 100644 --- a/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDispatchBridgeGoldenTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedDispatchBridgeGoldenTest.kt @@ -7,7 +7,6 @@ import sk.ainet.backend.api.kernel.KernelRegistry import sk.ainet.exec.golden.GoldenSupport.Packed import sk.ainet.exec.kernel.ScalarKernelProvider import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.PackedBlockDecoder import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.Storage @@ -42,7 +41,6 @@ import kotlin.test.assertTrue * which is what `ScalarKernelGoldenTest` already pins. Every weight here is **three blocks wide**, * the case where the two orders differ. */ -@OptIn(ExperimentalMemoryApi::class) class PackedDispatchBridgeGoldenTest { private companion object { diff --git a/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedTransposeGoldenTest.kt b/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedTransposeGoldenTest.kt index fead65a6e..39fabdb59 100644 --- a/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedTransposeGoldenTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/goldenTest/kotlin/sk/ainet/exec/golden/PackedTransposeGoldenTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.golden import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.exec.golden.GoldenSupport.Packed -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.Tensor import sk.ainet.lang.tensor.data.Q4_0BlockTensorData @@ -32,7 +31,6 @@ import kotlin.test.assertTrue * Both must describe the *same matrix*. This asserts exactly that, for every packed encoding, on * JVM and Kotlin/Native alike — and records the transposed values as goldens. */ -@OptIn(ExperimentalMemoryApi::class) class PackedTransposeGoldenTest { private companion object { diff --git a/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/schedule/CoroutineSchedule.kt b/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/schedule/CoroutineSchedule.kt index 0057c2893..94cecc589 100644 --- a/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/schedule/CoroutineSchedule.kt +++ b/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/schedule/CoroutineSchedule.kt @@ -5,7 +5,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asExecutor import sk.ainet.context.schedule.Schedule -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.NoopTraceSink import sk.ainet.lang.memory.trace.TraceClock import sk.ainet.lang.memory.trace.TraceEvent @@ -38,7 +37,6 @@ import java.util.concurrent.atomic.AtomicReference * region entered from `Dispatchers.Default` deadlocked as soon as every worker was inside one — * routinely on a 4-vCPU CI runner, never on a 14-core laptop. */ -@OptIn(ExperimentalMemoryApi::class) public open class CoroutineSchedule @JvmOverloads constructor( private val dispatcher: CoroutineDispatcher = Dispatchers.Default, final override val parallelism: Int = Runtime.getRuntime().availableProcessors(), @@ -178,7 +176,6 @@ public open class CoroutineSchedule @JvmOverloads constructor( } /** [CoroutineSchedule] over an owned thread pool; [close] shuts the pool down. */ -@OptIn(ExperimentalMemoryApi::class) public class DedicatedCoroutineSchedule internal constructor( private val executor: ExecutorService, parallelism: Int, diff --git a/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOpsJvm.kt b/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOpsJvm.kt index 748ce9608..7100e9d8e 100644 --- a/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOpsJvm.kt +++ b/skainet-backends/skainet-backend-cpu/src/jvmMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOpsJvm.kt @@ -226,7 +226,6 @@ internal class DefaultCpuOpsJvm( * ([MemorySegmentBackedData]), and TensorData whose VIEW presents a * [sk.ainet.lang.memory.SegmentStorage] (SKEEP-004 off-heap scope allocations). */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun segmentActivationToHeap(x: Tensor): Tensor? { if (x.dtype != FP32::class) return null val count = x.shape.volume @@ -1019,7 +1018,6 @@ internal class DefaultCpuOpsJvm( /** Dense-FP32 window (array + base offset): plain array data at 0, slab-backed data (#1173) at its arrayOffset. */ private class FloatWin(@JvmField val arr: FloatArray, @JvmField val off: Int) - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun floatWinOf(d: sk.ainet.lang.tensor.data.TensorData<*, *>): FloatWin? = when (d) { is FloatArrayTensorData<*> -> FloatWin(d.buffer, 0) is sk.ainet.lang.tensor.data.StorageFloatTensorData<*> -> { diff --git a/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/schedule/CoroutineScheduleTest.kt b/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/schedule/CoroutineScheduleTest.kt index 9bcc0e49e..2c938b848 100644 --- a/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/schedule/CoroutineScheduleTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/schedule/CoroutineScheduleTest.kt @@ -5,7 +5,6 @@ import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import sk.ainet.context.schedule.Schedule -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.RecordingTraceSink import sk.ainet.lang.memory.trace.TraceEvent import java.util.BitSet @@ -20,7 +19,6 @@ import kotlin.test.assertSame import kotlin.test.assertTrue /** SKEEP-005: the JVM schedule honours the [Schedule.forRange] contract. */ -@OptIn(ExperimentalMemoryApi::class) class CoroutineScheduleTest { private fun coverage(schedule: Schedule, n: Int, grain: Int): Pair { diff --git a/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/QuantizedMemSegMatmulTest.kt b/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/QuantizedMemSegMatmulTest.kt index bb7a3f361..212da7601 100644 --- a/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/QuantizedMemSegMatmulTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/QuantizedMemSegMatmulTest.kt @@ -308,7 +308,6 @@ class QuantizedMemSegMatmulTest { arena.close() } - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) @Test fun `Q8 matmul with a slab-backed scoped activation matches the dense-activation result`() { val arena = Arena.ofConfined() diff --git a/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/SlabOperandVectorPathTest.kt b/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/SlabOperandVectorPathTest.kt index 96d59c9c8..55566af58 100644 --- a/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/SlabOperandVectorPathTest.kt +++ b/skainet-backends/skainet-backend-cpu/src/jvmTest/kotlin/sk/ainet/exec/tensor/ops/SlabOperandVectorPathTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.tensor.ops import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.context.forwardScope -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.Tensor import sk.ainet.lang.tensor.data.StorageFloatTensorData @@ -18,7 +17,6 @@ import kotlin.test.assertTrue * bit-for-bit against the Ambient result — the tightest possible guard against off-by-offset * reads, which produce plausible garbage rather than crashes. */ -@OptIn(ExperimentalMemoryApi::class) class SlabOperandVectorPathTest { private val n = 67 // deliberately not a multiple of any vector species length diff --git a/skainet-backends/skainet-backend-jni-cpu/src/androidTest/kotlin/sk/ainet/exec/harness/android/M2A5DeviceMeasurement.kt b/skainet-backends/skainet-backend-jni-cpu/src/androidTest/kotlin/sk/ainet/exec/harness/android/M2A5DeviceMeasurement.kt index 766e1d2be..3e0f57f45 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/androidTest/kotlin/sk/ainet/exec/harness/android/M2A5DeviceMeasurement.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/androidTest/kotlin/sk/ainet/exec/harness/android/M2A5DeviceMeasurement.kt @@ -18,7 +18,6 @@ import sk.ainet.io.MappedRandomAccessSource import sk.ainet.io.gguf.StreamingGGUFReader import sk.ainet.io.gguf.StreamingGgufParametersLoader import sk.ainet.io.gguf.planInput -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.MemoryProbe import sk.ainet.lang.memory.ModelScope @@ -82,7 +81,6 @@ import sk.ainet.lang.types.FP32 * [KernelDispatch] out of a recycled [ForwardScope], and one token's K/V goes into a * model-scoped ring — the exact memory traffic of a decode step, which is what M2-A5 measures. */ -@OptIn(ExperimentalMemoryApi::class) @RunWith(AndroidJUnit4::class) class M2A5DeviceMeasurement { diff --git a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBitNetGemv.kt b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBitNetGemv.kt index 6215c3005..537f9e118 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBitNetGemv.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBitNetGemv.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.kernel.jni import sk.ainet.backend.api.kernel.BitNetGemvNative import sk.ainet.backend.api.kernel.TernaryKernelPacks -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * The NEON `bitnet_gemv` as a [BitNetGemvNative] (SKEEP-003 §5.2/§5.3, #1041, M2-F4). @@ -12,7 +11,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * instructions is what [JniKernels.variant] already decided from `/proc/cpuinfo`, so the name — and * the capability the kernel is registered with — follows that decision rather than guessing again. */ -@OptIn(ExperimentalMemoryApi::class) public object JniBitNetGemv : BitNetGemvNative { override val name: String diff --git a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBufferPackedKernels.kt b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBufferPackedKernels.kt index c212671be..de3eb186a 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBufferPackedKernels.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniBufferPackedKernels.kt @@ -10,7 +10,6 @@ import sk.ainet.backend.api.kernel.ReferenceMatmulKernel import sk.ainet.backend.api.kernel.ViewKernel import sk.ainet.lang.memory.BlockOrder import sk.ainet.lang.memory.DirectBufferStorage -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.MappedBufferStorage import sk.ainet.lang.memory.Storage @@ -36,7 +35,6 @@ import sk.ainet.lang.types.FP32 * Contrast with [sk.ainet.backend.api.kernel.PackedViewMatmulKernel], which serves the same * encodings from heap bytes in `BLOCKED_INPUT_MAJOR` (prepacked feed) order. */ -@ExperimentalMemoryApi public class JniRowMajorMatmulKernel( encodingName: String, override val key: KernelKey, @@ -138,7 +136,6 @@ public class JniRowMajorMatmulKernel( * `KernelPacks.install(JniKernelProvider)` on Android — without it a canonical packed weight * (mapped OR un-prepacked heap) falls back to the decoding reference. */ -@ExperimentalMemoryApi public object JniMappedKernelPack { public fun install() { if (!JniKernelProvider.isAvailable()) return diff --git a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniMappedKernelPackFactory.kt b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniMappedKernelPackFactory.kt index 8bb5e2a29..df54350c2 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniMappedKernelPackFactory.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniMappedKernelPackFactory.kt @@ -1,7 +1,6 @@ package sk.ainet.exec.kernel.jni import sk.ainet.backend.api.kernel.ViewKernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * `ServiceLoader`-friendly wrapper around [JniMappedKernelPack], the Android counterpart of @@ -13,7 +12,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * packaging must preserve `META-INF/services` entries for discovery to work; a consumer whose * build strips them can still call [JniMappedKernelPack.install] directly. */ -@OptIn(ExperimentalMemoryApi::class) public class JniMappedKernelPackFactory : ViewKernelPack { override val name: String get() = "jni-rowmajor" override fun install(): Unit = JniMappedKernelPack.install() diff --git a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryF32Gemv.kt b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryF32Gemv.kt index 130ecda80..720960b3c 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryF32Gemv.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryF32Gemv.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.kernel.jni import sk.ainet.backend.api.kernel.TernaryF32GemvNative import sk.ainet.backend.api.kernel.TernaryF32KernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * The vendored NeoGPU LUT kernel as a [TernaryF32GemvNative] (#1139) — the Android/JNI face of @@ -13,7 +12,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * arm64 device can load, Cortex-A72/Pi-class included — carries the full SIMD path. Whichever * variant the loader picked, the kernel is the same. */ -@OptIn(ExperimentalMemoryApi::class) public object JniTernaryF32Gemv : TernaryF32GemvNative { override val name: String get() = if (JniKernels.isLoaded) "neon" else "unloaded" diff --git a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryKernelPackFactory.kt b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryKernelPackFactory.kt index c4a7a17fb..4b1b381bf 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryKernelPackFactory.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryKernelPackFactory.kt @@ -1,7 +1,6 @@ package sk.ainet.exec.kernel.jni import sk.ainet.backend.api.kernel.ViewKernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * `ServiceLoader` entry for the ternary kernels on Android (#1240) — the JNI counterpart of @@ -14,7 +13,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * [JniMappedKernelPackFactory] applies — a build that strips `META-INF/services` can still * call the installs directly. */ -@OptIn(ExperimentalMemoryApi::class) public class JniTernaryKernelPackFactory : ViewKernelPack { override val name: String get() = "jni-ternary" override fun install() { diff --git a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryLmhead.kt b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryLmhead.kt index 9e4b668f5..07ad8389f 100644 --- a/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryLmhead.kt +++ b/skainet-backends/skainet-backend-jni-cpu/src/main/kotlin/sk/ainet/exec/kernel/jni/JniTernaryLmhead.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.kernel.jni import sk.ainet.backend.api.kernel.TernaryLmheadNative import sk.ainet.backend.api.kernel.TernaryPlanesKernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * The vendored NeoGPU fused 4-plane lm_head as a [TernaryLmheadNative] (#1150) — the Android/JNI @@ -11,7 +10,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * Like [JniTernaryF32Gemv], no capability split: the LUT kernel needs only baseline NEON, so the * BASELINE `libskainet_jni.so` carries the full SIMD path on every arm64 device. */ -@OptIn(ExperimentalMemoryApi::class) public object JniTernaryLmhead : TernaryLmheadNative { override val name: String get() = if (JniKernels.isLoaded) "neon" else "unloaded" diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernelPackFactory.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernelPackFactory.kt index 0d6555ec0..7226a0359 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernelPackFactory.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernelPackFactory.kt @@ -1,7 +1,6 @@ package sk.ainet.exec.kernel import sk.ainet.backend.api.kernel.ViewKernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * `ServiceLoader`-friendly wrapper around [FfmRowMajorKernelPack] — the same shape @@ -13,7 +12,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * anything. [FfmRowMajorKernelPack.install] is already a no-op when the native library is missing, * so discovery on a machine without it costs a lookup and registers nothing. */ -@OptIn(ExperimentalMemoryApi::class) public class FfmRowMajorKernelPackFactory : ViewKernelPack { override val name: String get() = "ffm-rowmajor" override fun install(): Unit = FfmRowMajorKernelPack.install() diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernels.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernels.kt index 1129de03e..ee9eeb0c6 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernels.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmRowMajorKernels.kt @@ -15,7 +15,6 @@ import sk.ainet.backend.api.kernel.ReferenceMatmulKernel import sk.ainet.backend.api.kernel.ViewKernel import sk.ainet.lang.memory.BlockOrder import sk.ainet.lang.memory.DirectBufferStorage -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.MappedBufferStorage import sk.ainet.lang.memory.Storage @@ -40,7 +39,6 @@ import sk.ainet.lang.types.FP32 * Activations and outputs are heap `FloatArray`s staged per call (small: `k` and `n` floats). * Fallbacks to the decoding reference are announced to the trace sink (#1193) — never silent. */ -@ExperimentalMemoryApi public class FfmRowMajorMatmulKernel internal constructor( encodingName: String, override val key: KernelKey, @@ -139,7 +137,6 @@ public class FfmRowMajorMatmulKernel internal constructor( * Android's `JniMappedKernelPack.install()`. No-op when the native library is unavailable; * a symbol that fails to bind simply leaves that encoding to the reference kernel. */ -@ExperimentalMemoryApi public object FfmRowMajorKernelPack { private val DESCRIPTOR = FunctionDescriptor.ofVoid( diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmTernaryKernelPackFactory.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmTernaryKernelPackFactory.kt index f6f72e349..27a7fe2bd 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmTernaryKernelPackFactory.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/FfmTernaryKernelPackFactory.kt @@ -1,7 +1,6 @@ package sk.ainet.exec.kernel import sk.ainet.backend.api.kernel.ViewKernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * `ServiceLoader` entry for the ternary kernels (#1240) — the missing sibling of @@ -16,7 +15,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * `install(native?)`, which registers nothing when the bundled native library is missing — * discovery on such a machine costs a lookup and leaves dispatch to the reference kernels. */ -@OptIn(ExperimentalMemoryApi::class) public class FfmTernaryKernelPackFactory : ViewKernelPack { override val name: String get() = "ffm-ternary" override fun install() { diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernel.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernel.kt index 0310d5dd3..ba0e5632e 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernel.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernel.kt @@ -8,7 +8,6 @@ import java.lang.foreign.ValueLayout import java.lang.invoke.MethodHandle import sk.ainet.backend.api.kernel.TernaryF32GemvNative import sk.ainet.backend.api.kernel.TernaryF32KernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.SegmentStorage import sk.ainet.lang.memory.Storage @@ -39,7 +38,6 @@ import sk.ainet.lang.memory.Storage * seam so [install] can hand it to `TernaryF32KernelPack` (#1138) — the * first ternary FFM consumer. */ -@OptIn(ExperimentalMemoryApi::class) public object NativeTernaryF32GemvKernel : TernaryF32GemvNative { override val name: String get() = "ffm" @@ -123,7 +121,6 @@ public object NativeTernaryF32GemvKernel : TernaryF32GemvNative { * Activation/output still stage through a small confined arena — they're `k`/`n` floats, not * the weight matrix, so the cost is the same as [gemvPacked] pays today for those two. */ - @OptIn(ExperimentalMemoryApi::class) override fun gemvPackedStorage( activation: FloatArray, activationOffset: Int, weight: Storage, weightByteOffset: Int, diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryLmheadKernel.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryLmheadKernel.kt index ee6a610e3..bf7620ec8 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryLmheadKernel.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmMain/kotlin/sk/ainet/exec/kernel/NativeTernaryLmheadKernel.kt @@ -8,7 +8,6 @@ import java.lang.foreign.ValueLayout import java.lang.invoke.MethodHandle import sk.ainet.backend.api.kernel.TernaryLmheadNative import sk.ainet.backend.api.kernel.TernaryPlanesKernelPack -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Native (FFM) downcall to the vendored NeoGPU fused 4-plane lm_head kernel (#1150). @@ -31,7 +30,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * Copy-in/copy-out per call like every FFM kernel here — fine for benches and small heads; * a persistent off-heap weight arena is the follow-up for a 128k-vocab lm_head. */ -@OptIn(ExperimentalMemoryApi::class) public object NativeTernaryLmheadKernel : TernaryLmheadNative { override val name: String get() = "ffm" diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/FfmRowMajorDispatchTest.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/FfmRowMajorDispatchTest.kt index a074fcf06..21158fb0f 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/FfmRowMajorDispatchTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/FfmRowMajorDispatchTest.kt @@ -6,7 +6,6 @@ import kotlin.test.AfterTest import kotlin.test.Test import kotlin.test.assertTrue import sk.ainet.backend.api.kernel.KernelDispatch -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.MappedBufferStorage import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -24,7 +23,6 @@ import sk.ainet.lang.types.FP32 * names the kernel that ran. Also pins #1193's visibility contract: when the fast path cannot * serve, the fallback announces itself in the trace instead of silently decoding. */ -@OptIn(ExperimentalMemoryApi::class) class FfmRowMajorDispatchTest { @AfterTest diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelDispatchSelfHealTest.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelDispatchSelfHealTest.kt index 9393ebf50..da0f86833 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelDispatchSelfHealTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelDispatchSelfHealTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.kernel import sk.ainet.backend.api.kernel.KernelDispatch import sk.ainet.backend.api.kernel.KernelRegistry -import sk.ainet.lang.memory.ExperimentalMemoryApi import kotlin.test.Test import kotlin.test.assertTrue @@ -15,7 +14,6 @@ import kotlin.test.assertTrue * first forward pass. Forgetting it is invisible — the decoding reference kernel is correct, just * ~1000x slower — and it was forgotten by application entry points and diagnostic harnesses alike. */ -@OptIn(ExperimentalMemoryApi::class) class KernelDispatchSelfHealTest { @Test diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelSupportMatrixTest.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelSupportMatrixTest.kt index c7da44da4..bbaa68f84 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelSupportMatrixTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/KernelSupportMatrixTest.kt @@ -6,7 +6,6 @@ import kotlin.test.Test import kotlin.test.assertEquals import sk.ainet.backend.api.kernel.KernelDispatch import sk.ainet.backend.api.kernel.KernelProvider -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.StorageCapabilities import sk.ainet.lang.tensor.storage.TensorEncoding @@ -24,7 +23,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * probes the JDK incubator module / the loaded `.so`), so their *capability* is declared * here (the single place to edit when a provider gains a kernel) rather than probed. */ -@OptIn(ExperimentalMemoryApi::class) class KernelSupportMatrixTest { @AfterTest diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernelTest.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernelTest.kt index 2008976ea..a779d711d 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernelTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/NativeTernaryF32GemvKernelTest.kt @@ -1,6 +1,5 @@ package sk.ainet.exec.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.SegmentStorage import sk.ainet.lang.memory.Storage import kotlin.math.abs @@ -181,7 +180,6 @@ class NativeTernaryF32GemvKernelTest { * it's the same native call, just handed the weight's `MemorySegment` directly instead of a * copy staged into a fresh arena. */ - @OptIn(ExperimentalMemoryApi::class) @Test fun gemvPackedStorage_matches_gemvPacked_on_a_segment_backed_weight() { val inputDim = 2560 @@ -208,7 +206,6 @@ class NativeTernaryF32GemvKernelTest { } /** A storage kind the FFM face can't read directly (here: plain Heap) falls back correctly. */ - @OptIn(ExperimentalMemoryApi::class) @Test fun gemvPackedStorage_falls_back_correctly_for_non_segment_storage() { val inputDim = 256 diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryF32FfmPackTest.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryF32FfmPackTest.kt index 7ba30139a..a64dbfa54 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryF32FfmPackTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryF32FfmPackTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.kernel import sk.ainet.backend.api.kernel.KernelDispatch import sk.ainet.backend.api.kernel.TernaryF32GemvKernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -26,7 +25,6 @@ import kotlin.test.assertTrue * the NeoGPU LUT kernel serves the exact key — no requantize adapter, results equal to the f32 * reference. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryF32FfmPackTest { private val k = 2560 // BitNet-2B hidden size diff --git a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryPlanesFfmTest.kt b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryPlanesFfmTest.kt index 34d5031fc..d6abeef86 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryPlanesFfmTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/jvmTest/kotlin/sk/ainet/exec/kernel/TernaryPlanesFfmTest.kt @@ -2,7 +2,6 @@ package sk.ainet.exec.kernel import sk.ainet.backend.api.kernel.KernelDispatch import sk.ainet.backend.api.kernel.TernaryPlanesMatmulKernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Scope import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView @@ -25,7 +24,6 @@ import kotlin.test.assertTrue * Kotlin reference. The C kernel spawns its 4 pthreads at any output_dim, so every case here * also exercises its internal threading. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryPlanesFfmTest { @BeforeTest fun setUp() { diff --git a/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryF32Gemv.kt b/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryF32Gemv.kt index 89302d6ab..96302fec9 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryF32Gemv.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryF32Gemv.kt @@ -7,7 +7,6 @@ import kotlinx.cinterop.usePinned import sk.ainet.backend.api.kernel.TernaryF32GemvNative import sk.ainet.backend.api.kernel.TernaryF32KernelPack import sk.ainet.kernels.cinterop.skainet_ternary_f32_gemv -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Kotlin/Native face of the vendored NeoGPU LUT kernel (#1139): calls @@ -21,7 +20,7 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * exist. The arrays are pinned and base pointers passed; the C side applies * the offsets, no copy is made. */ -@OptIn(ExperimentalForeignApi::class, ExperimentalMemoryApi::class) +@OptIn(ExperimentalForeignApi::class) public object NativeKnTernaryF32Gemv : TernaryF32GemvNative { override val name: String get() = "cinterop" diff --git a/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmhead.kt b/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmhead.kt index e42d7201c..6b2a2709c 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmhead.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/nativeMain/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmhead.kt @@ -7,7 +7,6 @@ import kotlinx.cinterop.usePinned import sk.ainet.backend.api.kernel.TernaryLmheadNative import sk.ainet.backend.api.kernel.TernaryPlanesKernelPack import sk.ainet.kernels.cinterop.skainet_ternary_lmhead_stage1 -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Kotlin/Native face of the vendored NeoGPU fused 4-plane lm_head (#1150): calls @@ -17,7 +16,7 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * derived at `rowScaleByteOffset` (2-byte aligned by the seam's contract — unaligned uint16 * reads are legal on AArch64 anyway). */ -@OptIn(ExperimentalForeignApi::class, ExperimentalMemoryApi::class) +@OptIn(ExperimentalForeignApi::class) public object NativeKnTernaryLmhead : TernaryLmheadNative { override val name: String get() = "cinterop" diff --git a/skainet-backends/skainet-backend-native-cpu/src/nativeTest/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmheadParityTest.kt b/skainet-backends/skainet-backend-native-cpu/src/nativeTest/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmheadParityTest.kt index fc0e576de..260beba85 100644 --- a/skainet-backends/skainet-backend-native-cpu/src/nativeTest/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmheadParityTest.kt +++ b/skainet-backends/skainet-backend-native-cpu/src/nativeTest/kotlin/sk/ainet/exec/kernel/NativeKnTernaryLmheadParityTest.kt @@ -1,6 +1,5 @@ package sk.ainet.exec.kernel -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import kotlin.math.abs import kotlin.random.Random @@ -17,7 +16,6 @@ import kotlin.test.assertTrue * Runs on the host archive AND under qemu-aarch64 (`-PcrossArm64=true`); the C kernel spawns its * 4 pthreads at any output_dim, so every case exercises its threading through cinterop. */ -@OptIn(ExperimentalMemoryApi::class) class NativeKnTernaryLmheadParityTest { private fun reference( diff --git a/skainet-io/skainet-io-core/src/jvmAndroidMain/kotlin/sk/ainet/io/JvmMappedFile.kt b/skainet-io/skainet-io-core/src/jvmAndroidMain/kotlin/sk/ainet/io/JvmMappedFile.kt index 489dcb01d..b19475270 100644 --- a/skainet-io/skainet-io-core/src/jvmAndroidMain/kotlin/sk/ainet/io/JvmMappedFile.kt +++ b/skainet-io/skainet-io-core/src/jvmAndroidMain/kotlin/sk/ainet/io/JvmMappedFile.kt @@ -37,7 +37,6 @@ public class JvmMappedFile private constructor( * of the one file mapping (#1189) — the packed counterpart of [denseFloats]: zero heap bytes, * blocks left in canonical row-major file order for the buffer-reading kernels. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) override fun packedTensor( byteOffset: Long, shape: Shape, diff --git a/skainet-io/skainet-io-gguf/src/androidHostTest/kotlin/sk/ainet/io/gguf/AndroidGgufLoadingHostTest.kt b/skainet-io/skainet-io-gguf/src/androidHostTest/kotlin/sk/ainet/io/gguf/AndroidGgufLoadingHostTest.kt index 11d56a8ec..4a8c19dfe 100644 --- a/skainet-io/skainet-io-gguf/src/androidHostTest/kotlin/sk/ainet/io/gguf/AndroidGgufLoadingHostTest.kt +++ b/skainet-io/skainet-io-gguf/src/androidHostTest/kotlin/sk/ainet/io/gguf/AndroidGgufLoadingHostTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.lang.memory.plan.WeightForm -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.DeviceMemory import sk.ainet.lang.memory.plan.PlannerProfile import sk.ainet.lang.tensor.Tensor @@ -29,7 +28,6 @@ import kotlin.test.assertTrue * `AndroidGguf.deviceMemory(context)` needs a real `Context` and belongs to the instrumented smoke * test; everything downstream of it takes a [DeviceMemory] so it can be checked here. */ -@OptIn(ExperimentalMemoryApi::class) class AndroidGgufLoadingHostTest { private val mb = 1024L * 1024L diff --git a/skainet-io/skainet-io-gguf/src/androidMain/kotlin/sk/ainet/io/gguf/AndroidGgufLoading.kt b/skainet-io/skainet-io-gguf/src/androidMain/kotlin/sk/ainet/io/gguf/AndroidGgufLoading.kt index 9782b1bbd..5a39f61ab 100644 --- a/skainet-io/skainet-io-gguf/src/androidMain/kotlin/sk/ainet/io/gguf/AndroidGgufLoading.kt +++ b/skainet-io/skainet-io-gguf/src/androidMain/kotlin/sk/ainet/io/gguf/AndroidGgufLoading.kt @@ -6,7 +6,6 @@ import sk.ainet.io.RandomAccessSource import sk.ainet.io.openRandomAccessSource import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.plan.WeightResidency -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.Budget import sk.ainet.lang.memory.plan.DeviceFit import sk.ainet.lang.memory.plan.DeviceMemory @@ -31,7 +30,6 @@ import sk.ainet.lang.memory.plan.fitOn * fit check tells you which of the two pools you are about to run out of, rather than letting the * app find out by being killed. */ -@OptIn(ExperimentalMemoryApi::class) public object AndroidGguf { /** diff --git a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/GgufMemoryPlan.kt b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/GgufMemoryPlan.kt index f9357bbc8..0b542623d 100644 --- a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/GgufMemoryPlan.kt +++ b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/GgufMemoryPlan.kt @@ -1,7 +1,6 @@ package sk.ainet.io.gguf import sk.ainet.io.weights.NameMap -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.plan.KvCacheMode import sk.ainet.lang.memory.plan.ModelGeometry @@ -23,7 +22,6 @@ import sk.ainet.lang.types.Int8 * architecture metadata keys; no tensor bytes are read (PRD M0-F1). [ctx] defaults to the trained * context length of the model when the header has one. */ -@ExperimentalMemoryApi public fun StreamingGGUFReader.planInput( ctx: Int? = null, prefillChunk: Int = PlanInput.DEFAULT_PREFILL_CHUNK, @@ -56,7 +54,6 @@ public fun StreamingGGUFReader.planInput( } /** Architecture metadata (`.block_count`, `.attention.head_count`, …) as a [ModelGeometry], or `null` if the header lacks it. */ -@ExperimentalMemoryApi public fun StreamingGGUFReader.ggufGeometry(architecture: String? = fields["general.architecture"] as? String): ModelGeometry? { val arch = architecture ?: return null fun int(key: String): Int? = (fields["$arch.$key"] as? Number)?.toInt() ?: (fields["$arch.$key"] as? UInt)?.toInt() @@ -73,7 +70,6 @@ public fun StreamingGGUFReader.ggufGeometry(architecture: String? = fields["gene } /** `Format` of a GGUF tensor type: quantized types are logically FP32 with their block encoding. */ -@ExperimentalMemoryApi public fun ggufFormat(type: GGMLQuantizationType, nBytes: Long): Format { val dtype: DType = when (type) { GGMLQuantizationType.F32 -> FP32; GGMLQuantizationType.F16 -> FP16; GGMLQuantizationType.BF16 -> BF16; GGMLQuantizationType.F64 -> FP64 diff --git a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/ResolvedGgufLoading.kt b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/ResolvedGgufLoading.kt index 24637a968..bbde5c9f0 100644 --- a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/ResolvedGgufLoading.kt +++ b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/ResolvedGgufLoading.kt @@ -1,7 +1,6 @@ package sk.ainet.io.gguf import sk.ainet.io.RandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.AllocationResolver import sk.ainet.lang.memory.plan.KernelCapabilities import sk.ainet.lang.memory.plan.PlanInput @@ -30,7 +29,6 @@ import sk.ainet.lang.memory.trace.TraceSink * dense, on the managed heap. Tensors it returns `null` for get the resolver's answer. The plan and * the explanations are computed *after* overrides are applied, so what you print is what you load. */ -@ExperimentalMemoryApi public object ResolvedGguf { /** What [resolve] decided: the loader that obeys it, and the resolved input that explains it. */ diff --git a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/StreamingGgufParametersLoader.kt b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/StreamingGgufParametersLoader.kt index 803f4cf7e..e217e1c21 100644 --- a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/StreamingGgufParametersLoader.kt +++ b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/StreamingGgufParametersLoader.kt @@ -1,3 +1,4 @@ + package sk.ainet.io.gguf import sk.ainet.context.ExecutionContext @@ -548,7 +549,6 @@ public class StreamingGgufParametersLoader( * defined against. */ @Suppress("UNCHECKED_CAST") - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun i2sTensor( ctx: ExecutionContext, dtype: KClass, @@ -608,7 +608,6 @@ public class StreamingGgufParametersLoader( * about not holding the repack's result in managed-heap memory once it's large enough to * matter. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun i2sPackedTensorData(shape: Shape, packedBytes: ByteArray): sk.ainet.lang.tensor.data.BitNetB158TensorData { val offHeapThreshold = sk.ainet.lang.memory.plan.PlannerProfile.OFF_HEAP_THRESHOLD if (packedBytes.size < offHeapThreshold || !sk.ainet.lang.memory.PlatformStorage.supports(sk.ainet.lang.tensor.storage.MemoryDomain.HOST_OFFHEAP)) { @@ -636,7 +635,6 @@ public class StreamingGgufParametersLoader( * order put it. Before that, feed-order bytes in a type claiming to be canonical decoded to * plausible garbage (#1124, #973, #968). */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun feedOrdered( packed: sk.ainet.lang.tensor.storage.PackedBlockStorage, tensorInfo: StreamingTensorInfo, diff --git a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/dequant/DequantOps.kt b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/dequant/DequantOps.kt index 15e4127d3..79c4b8d4c 100644 --- a/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/dequant/DequantOps.kt +++ b/skainet-io/skainet-io-gguf/src/commonMain/kotlin/sk/ainet/io/gguf/dequant/DequantOps.kt @@ -806,14 +806,12 @@ public object DequantOps { * defined once by [sk.ainet.lang.memory.TernaryCodec], next to the `TensorEncoding.TQ2_0` * descriptor, so the loader and the ternary kernels cannot decode the same bytes differently. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun dequantTQ2_0FromBytes(bytes: ByteArray, nElems: Int): FloatArray { val blocks = bytes.size / sk.ainet.lang.tensor.storage.TensorEncoding.TQ2_0.BYTES_PER_BLOCK return sk.ainet.lang.memory.TernaryCodec.decodeTq2_0(bytes, blocks * 256) } /** `TQ1_0` → floats through the shared reference codec (#1033); see [dequantTQ2_0FromBytes]. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun dequantTQ1_0FromBytes(bytes: ByteArray, nElems: Int): FloatArray { val blocks = bytes.size / sk.ainet.lang.tensor.storage.TensorEncoding.TQ1_0.BYTES_PER_BLOCK return sk.ainet.lang.memory.TernaryCodec.decodeTq1_0(bytes, blocks * 256) diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufMemoryPlanTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufMemoryPlanTest.kt index 1bb4dd33f..f356d0df1 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufMemoryPlanTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufMemoryPlanTest.kt @@ -1,7 +1,6 @@ package sk.ainet.io.gguf import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.Budget import sk.ainet.lang.memory.plan.MemoryPlans import sk.ainet.lang.tensor.storage.TensorEncoding @@ -14,7 +13,6 @@ import kotlin.test.assertNull import kotlin.test.assertTrue /** SKEEP-003 M0-F1: the plan comes from the GGUF header alone — tensor table + metadata, no tensor bytes. */ -@OptIn(ExperimentalMemoryApi::class) class GgufMemoryPlanTest { @Test diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufTernaryLoadTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufTernaryLoadTest.kt index 5e8692fe7..8a2858bc4 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufTernaryLoadTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/GgufTernaryLoadTest.kt @@ -5,7 +5,6 @@ import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.WeightForm -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.memory.blockSpec import sk.ainet.lang.tensor.Tensor @@ -25,7 +24,6 @@ import kotlin.test.assertEquals * match `dequantize_row_tq{1,2}_0` (four *consecutive* elements per byte instead of four 32 apart), * and the loader described them as `Opaque`, so nothing downstream knew their geometry. */ -@OptIn(ExperimentalMemoryApi::class) class GgufTernaryLoadTest { @Test diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sGgufLoadTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sGgufLoadTest.kt index eb902a2d5..02fa5c304 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sGgufLoadTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sGgufLoadTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.WeightForm @@ -32,7 +31,6 @@ import kotlin.test.assertTrue * * The first ternary GGUF type that does not take the #1033 FP32 widening. */ -@OptIn(ExperimentalMemoryApi::class) class I2sGgufLoadTest { private fun randomCodes(count: Int, seed: Int): IntArray { diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sMappedFastPathTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sMappedFastPathTest.kt index 8b185aa25..0600d0e11 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sMappedFastPathTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sMappedFastPathTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.plan.WeightResidency @@ -24,7 +23,6 @@ import kotlin.test.assertIs * override it) must load through [sk.ainet.io.JvmMappedFile]'s mmap branch — zero heap bytes, * zero repack — while every other case keeps today's heap-staged repack path. */ -@OptIn(ExperimentalMemoryApi::class) class I2sMappedFastPathTest { private fun sequentialPayload(codes: IntArray): ByteArray { diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sOffHeapLoadTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sOffHeapLoadTest.kt index 406615190..09b430114 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sOffHeapLoadTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/I2sOffHeapLoadTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.memory.plan.PlannerProfile @@ -23,7 +22,6 @@ import kotlin.test.assertIs * storage instead of a permanent `ByteArray` — the fix for #1198's ART-heap-cap OOM risk — and * decodes to exactly the same values a heap-backed load would produce. */ -@OptIn(ExperimentalMemoryApi::class) class I2sOffHeapLoadTest { /** BitNet.cpp's GROUP_128 packing + 32-byte trailer, sized to cross the off-heap threshold. */ diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/KernelFeedOrderTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/KernelFeedOrderTest.kt index 401a47f13..796a1c456 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/KernelFeedOrderTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/KernelFeedOrderTest.kt @@ -6,7 +6,6 @@ import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.exec.kernel.ScalarKernelProvider import sk.ainet.io.JvmRandomAccessSource import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.WeightByteOrder import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.plan.WeightShapeOrientation @@ -33,7 +32,6 @@ import kotlin.test.assertTrue * Feed order is only meaningful at three-plus blocks per row — at one block per row the two orders * coincide and every assertion below would hold vacuously (#968). */ -@OptIn(ExperimentalMemoryApi::class) class KernelFeedOrderTest { private val outDim = 32 diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/MappedPackedStagingTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/MappedPackedStagingTest.kt index a393806b1..c4b878507 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/MappedPackedStagingTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/MappedPackedStagingTest.kt @@ -9,7 +9,6 @@ import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource import sk.ainet.lang.memory.BlockOrder -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.plan.WeightResidency import sk.ainet.lang.tensor.Tensor @@ -26,7 +25,6 @@ import sk.ainet.lang.types.FP32 * must be identical to the heap load; StagingPolicyParityTest asserts that across policies, * this test pins the *representation*. */ -@OptIn(ExperimentalMemoryApi::class) class MappedPackedStagingTest { private fun file(): File = SyntheticGguf.write( diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PerTensorFormAndResolvedLoadTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PerTensorFormAndResolvedLoadTest.kt index a72adecb6..f7a9e7968 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PerTensorFormAndResolvedLoadTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PerTensorFormAndResolvedLoadTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.KernelCapabilities import sk.ainet.lang.memory.plan.PlannerProfile @@ -25,7 +24,6 @@ import kotlin.test.assertTrue * feeds the loader what the resolvers decided; the user's override outranks the resolver; and the * decisions are priceable and explainable before the payload is read. */ -@OptIn(ExperimentalMemoryApi::class) class PerTensorFormAndResolvedLoadTest { private fun file(): File = SyntheticGguf.write( diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PlanesRequantizeLoadTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PlanesRequantizeLoadTest.kt index a01010e23..925d3be9b 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PlanesRequantizeLoadTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/PlanesRequantizeLoadTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.WeightForm @@ -28,7 +27,6 @@ import kotlin.test.assertTrue * weight (or an I2_S one) arrives as packed [BitNetPlanesTensorData], encoded once at load, * reconstructing within the format's truncation bound. */ -@OptIn(ExperimentalMemoryApi::class) class PlanesRequantizeLoadTest { private val planesForm = WeightForm( diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/SyntheticGguf.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/SyntheticGguf.kt index 0a76e66dd..a705f7fcd 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/SyntheticGguf.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/SyntheticGguf.kt @@ -91,7 +91,6 @@ object SyntheticGguf { * from [TernaryCodec], the same reference encoder the decoder is defined against, so this * fixture exercises the real GGML layout (interleave included) rather than a plausible one. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) fun ternary( name: String, type: GGMLQuantizationType, diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/TernaryWeightMemoryTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/TernaryWeightMemoryTest.kt index ecfbd80eb..1cd106936 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/TernaryWeightMemoryTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/TernaryWeightMemoryTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.tensor.Tensor @@ -23,7 +22,6 @@ import kotlin.test.assertTrue * keep-packed vs FP32-widened, byte counts compared. The packed path must hold the ~16× ratio — * 0.25 bytes per weight plus one FP32 scale against 4 bytes per weight. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryWeightMemoryTest { private fun i2sTensor(name: String, elements: Int, seed: Int): SyntheticGguf.TestTensor { diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormAcceptanceTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormAcceptanceTest.kt index 32080838a..8286d5a1d 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormAcceptanceTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormAcceptanceTest.kt @@ -5,7 +5,6 @@ import sk.ainet.backend.api.kernel.KernelRegistry import sk.ainet.context.DirectCpuExecutionContext import sk.ainet.exec.kernel.ScalarKernelProvider import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.KernelCapabilities import sk.ainet.lang.memory.plan.MemoryPlans @@ -37,7 +36,6 @@ import kotlin.test.assertTrue * no policy, no profile and no form, and is called identically on both paths. If honouring a device * ever required the caller to say something, this file would have to change to keep passing. */ -@OptIn(ExperimentalMemoryApi::class) class WeightFormAcceptanceTest { @BeforeTest diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormLoaderParityTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormLoaderParityTest.kt index 821a5ba34..d7681e68f 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormLoaderParityTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormLoaderParityTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.WeightByteOrder import sk.ainet.lang.memory.plan.WeightForm @@ -23,7 +22,6 @@ import kotlin.test.assertTrue * matrix this file used to hold retired with the flags themselves; what remains pins the form * axes the loader validates and honours. */ -@OptIn(ExperimentalMemoryApi::class) class WeightFormLoaderParityTest { /** Mixed encodings, and a 2-D weight so the shape axis has something to reverse. */ diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormTraceTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormTraceTest.kt index c57f570bc..c785624c0 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormTraceTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightFormTraceTest.kt @@ -3,7 +3,6 @@ package sk.ainet.io.gguf import kotlinx.coroutines.runBlocking import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.EncodingRequest import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.trace.RecordingTraceSink @@ -21,7 +20,6 @@ import kotlin.test.assertTrue * The question this makes answerable is "why is this model bigger than the file". Before, the * answer lived in whoever remembered which policy was set. */ -@OptIn(ExperimentalMemoryApi::class) class WeightFormTraceTest { private fun file(): File = SyntheticGguf.write( diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightOrientationTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightOrientationTest.kt index 1adf006d4..2c5018fca 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightOrientationTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/WeightOrientationTest.kt @@ -5,7 +5,6 @@ import sk.ainet.context.DefaultDataExecutionContext import sk.ainet.io.JvmRandomAccessSource import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.plan.WeightShapeOrientation -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.Tensor import sk.ainet.lang.types.FP32 @@ -22,7 +21,6 @@ import kotlin.test.assertEquals * The guard that refuses a wrongly-labelled weight lives with the relayout, and is tested in * `PackedWeightsTest`. */ -@OptIn(ExperimentalMemoryApi::class) class WeightOrientationTest { /** A Q8_0 weight whose two dimensions differ and where only one of them is block-aligned. */ diff --git a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/export/I2sAotConverterTest.kt b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/export/I2sAotConverterTest.kt index 722b433b7..d76c6e5e9 100644 --- a/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/export/I2sAotConverterTest.kt +++ b/skainet-io/skainet-io-gguf/src/jvmTest/kotlin/sk/ainet/io/gguf/export/I2sAotConverterTest.kt @@ -7,7 +7,6 @@ import sk.ainet.io.gguf.GGMLQuantizationType import sk.ainet.io.gguf.I2sGgufLayout import sk.ainet.io.gguf.StreamingGgufParametersLoader import sk.ainet.io.gguf.SyntheticGguf -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.plan.WeightForm import sk.ainet.lang.memory.plan.WeightResidency @@ -32,7 +31,6 @@ import kotlin.test.assertIs * path afterwards, proving this is a real substitute for #1204's on-device sidecar cache, not * just a same-cost repack moved earlier. */ -@OptIn(ExperimentalMemoryApi::class) class I2sAotConverterTest { private fun groupPayload(codes: IntArray, qk: Int): ByteArray { diff --git a/skainet-io/skainet-io-onnx/src/commonMain/kotlin/sk/ainet/io/onnx/OnnxMemoryPlan.kt b/skainet-io/skainet-io-onnx/src/commonMain/kotlin/sk/ainet/io/onnx/OnnxMemoryPlan.kt index 03244444f..dca71cf08 100644 --- a/skainet-io/skainet-io-onnx/src/commonMain/kotlin/sk/ainet/io/onnx/OnnxMemoryPlan.kt +++ b/skainet-io/skainet-io-onnx/src/commonMain/kotlin/sk/ainet/io/onnx/OnnxMemoryPlan.kt @@ -1,6 +1,5 @@ package sk.ainet.io.onnx -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.plan.PlanInput import sk.ainet.lang.memory.plan.PlanTensor @@ -23,7 +22,6 @@ import sk.ainet.lang.types.Int8 * ONNX carries no transformer-geometry metadata, so [PlanInput.geometry] is `null` and the plan * is weights-only: KV cache and forward slab are not modelled, and the caller should say so. */ -@ExperimentalMemoryApi public fun StreamingOnnxReader.planInput( modelName: String, ctx: Int = 1, @@ -47,7 +45,6 @@ public fun StreamingOnnxReader.planInput( } /** The [Format] an ONNX `TensorProto.DataType` describes; unknown types become an opaque encoding priced by [sizeInBytes]. */ -@ExperimentalMemoryApi public fun onnxFormat(dataType: Int, dataTypeName: String, sizeInBytes: Long): Format { val known: Pair? = when (dataType) { 1 -> FP32 to 4 // FLOAT diff --git a/skainet-io/skainet-io-onnx/src/jvmTest/kotlin/sk/ainet/io/onnx/OnnxMemoryPlanTest.kt b/skainet-io/skainet-io-onnx/src/jvmTest/kotlin/sk/ainet/io/onnx/OnnxMemoryPlanTest.kt index dcc144d60..e7cbbd447 100644 --- a/skainet-io/skainet-io-onnx/src/jvmTest/kotlin/sk/ainet/io/onnx/OnnxMemoryPlanTest.kt +++ b/skainet-io/skainet-io-onnx/src/jvmTest/kotlin/sk/ainet/io/onnx/OnnxMemoryPlanTest.kt @@ -7,7 +7,6 @@ import onnx.TensorProto import pbandk.ByteArr import pbandk.encodeToByteArray import sk.ainet.io.JvmRandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import java.nio.file.Files import kotlin.test.Test import kotlin.test.assertEquals @@ -18,7 +17,6 @@ import kotlin.test.assertTrue * #1169: footprint planning from an ONNX initializer table — including `external_data`, whose * lengths previously reported ~0 bytes for exactly the >2 GB models that do not fit. */ -@OptIn(ExperimentalMemoryApi::class) class OnnxMemoryPlanTest { private fun model(vararg tensors: TensorProto): ByteArray = diff --git a/skainet-io/skainet-io-safetensors/src/commonMain/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlan.kt b/skainet-io/skainet-io-safetensors/src/commonMain/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlan.kt index 937c86eb1..6fc991135 100644 --- a/skainet-io/skainet-io-safetensors/src/commonMain/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlan.kt +++ b/skainet-io/skainet-io-safetensors/src/commonMain/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlan.kt @@ -1,6 +1,5 @@ package sk.ainet.io.safetensors -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.plan.PlanInput import sk.ainet.lang.memory.plan.PlanTensor @@ -24,7 +23,6 @@ import sk.ainet.lang.types.Int8 * Per-tensor byte counts come from the header's `data_offsets` — authoritative even for dtypes * with no fixed per-element width. */ -@ExperimentalMemoryApi public fun StreamingSafeTensorsReader.planInput( modelName: String, ctx: Int = 1, @@ -48,7 +46,6 @@ public fun StreamingSafeTensorsReader.planInput( } /** The [Format] a safetensors dtype string describes; unknown dtypes become an opaque encoding priced by [sizeInBytes]. */ -@ExperimentalMemoryApi public fun safeTensorsFormat(dtype: String, sizeInBytes: Long): Format { val known: Pair? = when (dtype) { "F32" -> FP32 to 4 diff --git a/skainet-io/skainet-io-safetensors/src/commonTest/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlanTest.kt b/skainet-io/skainet-io-safetensors/src/commonTest/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlanTest.kt index f831ed29b..d2730acb3 100644 --- a/skainet-io/skainet-io-safetensors/src/commonTest/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlanTest.kt +++ b/skainet-io/skainet-io-safetensors/src/commonTest/kotlin/sk/ainet/io/safetensors/SafeTensorsMemoryPlanTest.kt @@ -1,7 +1,6 @@ package sk.ainet.io.safetensors import sk.ainet.io.RandomAccessSource -import sk.ainet.lang.memory.ExperimentalMemoryApi import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull @@ -10,7 +9,6 @@ import kotlin.test.assertNull * #1169: footprint planning from a safetensors header — sizes come from `data_offsets`, so they * are authoritative even for dtypes with no fixed per-element width. */ -@OptIn(ExperimentalMemoryApi::class) class SafeTensorsMemoryPlanTest { private class ByteSource(private val data: ByteArray) : RandomAccessSource { diff --git a/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/MemoryDebug.android.kt b/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/MemoryDebug.android.kt index 033d6f69c..b1e1b5b67 100644 --- a/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/MemoryDebug.android.kt +++ b/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/MemoryDebug.android.kt @@ -1,11 +1,9 @@ package sk.ainet.lang.memory -@ExperimentalMemoryApi internal actual fun platformMemoryDebugEnabled(): Boolean = System.getProperty(MemoryDebug.PROPERTY) == "true" || System.getenv(MemoryDebug.ENV).let { it == "1" || it == "true" } /** The first frame outside `sk.ainet.lang.memory` — where the allocation was actually asked for. */ -@ExperimentalMemoryApi internal actual fun platformCallSite(): String? = StackWalker.getInstance().walk { frames -> frames.filter { !it.className.startsWith("sk.ainet.lang.memory") } .findFirst() diff --git a/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/PlatformStorage.android.kt b/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/PlatformStorage.android.kt index 984236367..90a655461 100644 --- a/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/PlatformStorage.android.kt +++ b/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/PlatformStorage.android.kt @@ -6,7 +6,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain import java.nio.file.Path /** Android: off-heap = direct `ByteBuffer` (outside the ART heap limit, #922), mapped = `MappedByteBuffer` (SKEEP-002 / #921). */ -@ExperimentalMemoryApi public actual object PlatformStorage { public actual fun supports(domain: MemoryDomain): Boolean = domain == MemoryDomain.HOST_HEAP || domain == MemoryDomain.HOST_OFFHEAP || domain == MemoryDomain.MMAP_FILE public actual val supportsMappedFiles: Boolean get() = true diff --git a/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/trace/AndroidTraceSink.kt b/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/trace/AndroidTraceSink.kt index 35d7e1512..ae0d0295a 100644 --- a/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/trace/AndroidTraceSink.kt +++ b/skainet-lang/skainet-lang-core/src/androidMain/kotlin/sk/ainet/lang/memory/trace/AndroidTraceSink.kt @@ -1,7 +1,6 @@ package sk.ainet.lang.memory.trace import android.os.Trace -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * A [TraceSink] that forwards SKaiNET's events to `android.os.Trace`, so a memory-architecture @@ -14,7 +13,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * Section names are truncated to `android.os.Trace`'s limit (127 characters), and tracing is only * enabled while the OS is capturing, so a shipping build pays one boolean check per event. */ -@ExperimentalMemoryApi public class AndroidTraceSink : TraceSink { override val isEnabled: Boolean get() = Trace.isEnabled() diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt index d7293b6df..a65366887 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt @@ -18,7 +18,6 @@ public interface ExecutionContext { * insertions, allocations. Default [sk.ainet.lang.memory.trace.NoopTraceSink] — nothing is * recorded until a context opts in with a recording or exporting sink. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val traceSink: sk.ainet.lang.memory.trace.TraceSink get() = sk.ainet.lang.memory.trace.NoopTraceSink /** @@ -26,7 +25,6 @@ public interface ExecutionContext { * [sk.ainet.lang.memory.Scope.Ambient] — GC-managed, today's behaviour; a generation loop opts * in by providing a `ForwardScope` and calling `reset()` per step. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val memoryScope: sk.ainet.lang.memory.Scope get() = sk.ainet.lang.memory.Scope.Ambient public val ops: TensorOps @@ -74,7 +72,6 @@ public interface ExecutionContext { * is already what this context runs — emits [sk.ainet.lang.memory.trace.TraceEvent.ScheduleDowngraded] * so an unhonoured schedule is visible in the trace instead of silently sequential. */ - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) public fun withSchedule(schedule: sk.ainet.context.schedule.Schedule): ExecutionContext { if (schedule !== this.schedule && traceSink.isEnabled) { traceSink.emit( @@ -125,7 +122,6 @@ public interface ExecutionContext { * factory path is untouched for every context that never opts in. The region is *not* cleared: * a slab slice after `reset()` holds old bytes, so callers fill it themselves. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi private fun scopedDenseFloats( shape: Shape, dtype: KClass, @@ -135,7 +131,6 @@ public interface ExecutionContext { return sk.ainet.lang.tensor.data.StorageFloatTensorData(shape, scope.allocateFloats(shape.volume)) } - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) public fun full(shape: Shape, dtype: KClass, value: Number): Tensor { scopedDenseFloats(shape, dtype)?.let { scoped -> val s = scoped.storage @@ -148,7 +143,6 @@ public interface ExecutionContext { } - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) public fun zeros( shape: Shape, dtype: KClass @@ -177,7 +171,6 @@ public interface ExecutionContext { return fromData(data, dtype) } - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) public fun ones( shape: Shape, dtype: KClass @@ -193,7 +186,6 @@ public interface ExecutionContext { ops ) - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) public fun fromFloatArray( shape: Shape, dtype: KClass, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ScopedExecutionContext.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ScopedExecutionContext.kt index 019a5db23..959c32f3b 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ScopedExecutionContext.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ScopedExecutionContext.kt @@ -1,6 +1,5 @@ package sk.ainet.context -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.Scope import sk.ainet.lang.tensor.Shape @@ -22,7 +21,6 @@ import kotlin.reflect.KClass * workspace inside one op invocation; `memoryScope` governs *inter-op* activation lifetime across * a step. They stay separate. */ -@ExperimentalMemoryApi public class ScopedExecutionContext( private val base: ExecutionContext, override val memoryScope: Scope, @@ -84,7 +82,6 @@ public class ScopedExecutionContext( * } * ``` */ -@ExperimentalMemoryApi public inline fun ExecutionContext.forwardScope( slabFloats: Int, block: (ctx: ScopedExecutionContext, scope: ForwardScope) -> R, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/AllocationSpec.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/AllocationSpec.kt index 118614e1a..6fbd6f2c0 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/AllocationSpec.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/AllocationSpec.kt @@ -8,7 +8,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * allocates and frees — arrives with milestone M1; this enum is its `kind`, declared now so that * memory plans and allocation specs can name the lifetime without depending on the allocator. */ -@ExperimentalMemoryApi public enum class ScopeKind { /** Lives until the model is closed: weights, KV-cache backing, embedding tables. */ MODEL, @@ -33,7 +32,6 @@ public enum class ScopeKind { * @property mutable whether the bytes may be written after allocation * @property alignment required byte alignment of the start of the buffer (SIMD kernels want 16–64) */ -@ExperimentalMemoryApi public data class AllocationSpec( val format: Format, val elementCount: Long, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/BlockSpec.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/BlockSpec.kt index fe6ab2ca9..ab8a1f6d0 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/BlockSpec.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/BlockSpec.kt @@ -4,7 +4,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.Int8 /** Where an encoding keeps the scale that turns a stored code back into a value. */ -@ExperimentalMemoryApi public enum class ScalePlacement { /** No scale in the bytes — the codes *are* the values, or the scale lives outside the buffer. */ NONE, @@ -34,7 +33,6 @@ public enum class ScalePlacement { * @property activation the format a kernel is expected to quantize the *other* operand to * (`W1.58A8` → `Format(Int8, Dense(1))`), or `null` when the kernel consumes floats. */ -@ExperimentalMemoryApi public data class BlockSpec( val blockSize: Int, val bytesPerBlock: Int, @@ -73,7 +71,6 @@ public data class BlockSpec( * ([TernaryCodec]), the fixture generators and `EncodingSpecTest` all read it, so a wrong constant * fails a test rather than silently mis-decoding a file. */ -@ExperimentalMemoryApi public val TensorEncoding.blockSpec: BlockSpec? get() = when (this) { is TensorEncoding.Dense -> null @@ -107,7 +104,6 @@ public val TensorEncoding.blockSpec: BlockSpec? } /** True when this encoding stores ternary values (`-1, 0, +1`) — the M2 kernel family. */ -@ExperimentalMemoryApi public val TensorEncoding.isTernary: Boolean get() = this == TensorEncoding.TQ1_0 || this == TensorEncoding.TQ2_0 || this == TensorEncoding.TernaryPacked || this == TensorEncoding.BITNET_B1_58 diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Describe.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Describe.kt index 251dcdba9..d1202db8b 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Describe.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Describe.kt @@ -13,7 +13,6 @@ import sk.ainet.lang.tensor.storage.TensorStorage * * Example: `model.layers.blk.3.attn.q_proj.weight · Float32/Q4_K · [2048, 2048] · Q4_KBlockTensorData · — · scope — · storage —` */ -@ExperimentalMemoryApi public fun Tensor<*, *>.describe(): String = buildString { append(id?.canonical ?: "—"); append(SEP) append(formatOrNull?.toString() ?: "?"); append(SEP) @@ -25,7 +24,6 @@ public fun Tensor<*, *>.describe(): String = buildString { } /** Same rendering for a storage descriptor; origin is the file for file-backed buffers. */ -@ExperimentalMemoryApi public fun TensorStorage.describe(id: sk.ainet.lang.tensor.TensorId? = null): String = buildString { append(id?.canonical ?: "—"); append(SEP) append(format.toString()); append(SEP) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/ExperimentalMemoryApi.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/ExperimentalMemoryApi.kt deleted file mode 100644 index d7406d7cd..000000000 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/ExperimentalMemoryApi.kt +++ /dev/null @@ -1,18 +0,0 @@ -package sk.ainet.lang.memory - -/** - * Marks the SKEEP-003 memory-architecture API (`sk.ainet.lang.memory`) that is still being - * shaped through milestones M0–M1 (`Format`, `AllocationSpec`, later `Storage`, `Scope`, - * `TensorView`, …). The types are usable and tested, but their shape may still change before the - * compatibility promise applies; opt in explicitly with `@OptIn(ExperimentalMemoryApi::class)`. - */ -@RequiresOptIn( - message = "SKEEP-003 memory-architecture API: usable, but may change until milestone M1 is complete.", - level = RequiresOptIn.Level.WARNING, -) -@Retention(AnnotationRetention.BINARY) -@Target( - AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, - AnnotationTarget.TYPEALIAS, AnnotationTarget.CONSTRUCTOR, -) -public annotation class ExperimentalMemoryApi diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Format.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Format.kt index 3991d3e10..5277731a0 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Format.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Format.kt @@ -14,7 +14,6 @@ import sk.ainet.lang.types.DType * * `Format` is pure metadata: it owns no bytes and carries no shape. */ -@ExperimentalMemoryApi public data class Format(val dtype: DType, val encoding: TensorEncoding) { /** True when the bytes are the dtype's own dense representation (no block packing). */ @@ -39,13 +38,11 @@ public data class Format(val dtype: DType, val encoding: TensorEncoding) { * * @throws IllegalStateException if [Tensor.dtype] is not a concrete dtype class (e.g. `DType::class`) */ -@ExperimentalMemoryApi public val Tensor<*, *>.format: Format get() = formatOrNull ?: throw IllegalStateException("Tensor.dtype ${this.dtype} is not a concrete DType witness; cannot derive a Format") /** The [Format] of this tensor, or `null` if its dtype witness is not a concrete dtype class. */ -@ExperimentalMemoryApi public val Tensor<*, *>.formatOrNull: Format? get() { val dt = DType.fromWitnessOrNull(this.dtype) ?: return null @@ -53,6 +50,5 @@ public val Tensor<*, *>.formatOrNull: Format? } /** The [Format] of this storage descriptor: `(dtype, encoding)`. */ -@ExperimentalMemoryApi public val TensorStorage.format: Format get() = Format(dtype, encoding) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/I8Absmax.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/I8Absmax.kt index 2ad362f3c..72832d210 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/I8Absmax.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/I8Absmax.kt @@ -23,7 +23,6 @@ import kotlin.math.roundToInt * Byte layout of a `[rows, cols]` activation: `rows * cols` codes, row-major, then `rows` * little-endian FP32 scales. `value ≈ code * scale(row)`. */ -@ExperimentalMemoryApi public object I8Absmax { /** The activation format: int8 values, per-token absmax scale. */ diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Layout.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Layout.kt index 47a12a3a9..08f788b3a 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Layout.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Layout.kt @@ -47,7 +47,6 @@ public enum class BlockOrder { * [BlockOrder.ROW_MAJOR]: what a file holds. A buffer in kernel feed order says so here instead * of leaving the next reader to guess (#973). */ -@ExperimentalMemoryApi public class Layout( public val shape: Shape, public val strides: IntArray, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryDebug.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryDebug.kt index 798a5ee63..b78a78077 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryDebug.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryDebug.kt @@ -11,7 +11,6 @@ import sk.ainet.lang.tensor.TensorId * per allocation; on, it keeps a bounded ledger of live storages plus hooks a debugger or a test * can break on. */ -@ExperimentalMemoryApi public object MemoryDebug { /** Environment variable and system property that enable debug mode. */ @@ -145,9 +144,7 @@ public object MemoryDebug { } /** Platform reading of [MemoryDebug.ENV] / [MemoryDebug.PROPERTY]. */ -@ExperimentalMemoryApi internal expect fun platformMemoryDebugEnabled(): Boolean /** The current call site, when the platform can cheaply produce one (JVM: a stack frame). */ -@ExperimentalMemoryApi internal expect fun platformCallSite(): String? diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryProbe.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryProbe.kt index c7b57f075..75ff74beb 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryProbe.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/MemoryProbe.kt @@ -15,7 +15,6 @@ import sk.ainet.lang.memory.trace.counter * Every value is `null` where the platform cannot answer — a browser has no `/proc`, and neither * has a Wasm host. Callers report "—", they do not guess. */ -@ExperimentalMemoryApi public expect object MemoryProbe { /** Resident set size in bytes, or `null` when the platform cannot say. */ public fun rssBytes(): Long? @@ -28,7 +27,6 @@ public expect object MemoryProbe { } /** One sample of the process-level counters, with the fields the platform could answer. */ -@ExperimentalMemoryApi public data class ProcessMemorySample( val rssBytes: Long?, val majorFaults: Long?, @@ -56,6 +54,5 @@ public data class ProcessMemorySample( } /** Sample all three counters at once. */ -@ExperimentalMemoryApi public fun MemoryProbe.sample(): ProcessMemorySample = ProcessMemorySample(rssBytes(), majorFaults(), minorFaults()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/PlatformStorage.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/PlatformStorage.kt index a3927fdac..6ad2647f5 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/PlatformStorage.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/PlatformStorage.kt @@ -14,7 +14,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * a request for those resolves to [Storage.Heap] and [PlatformStorage.supports] says so, so the * planner can note the fallback). */ -@ExperimentalMemoryApi public expect object PlatformStorage { /** Whether this target can honour [domain] natively (false = [allocate] falls back to the heap). */ public fun supports(domain: MemoryDomain): Boolean @@ -34,7 +33,6 @@ public expect object PlatformStorage { } /** The kinds a target binds, for diagnostics (`describe()`, the planner's notes). */ -@ExperimentalMemoryApi public data class PlatformStorageInfo(val offHeap: String, val mapped: String) { override fun toString(): String = "OffHeap=$offHeap · Mapped=$mapped" } diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Scope.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Scope.kt index 74f96ae72..200f0aedf 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Scope.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Scope.kt @@ -17,7 +17,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * model-lifetime arena (tens of GB pinned) and per-call arenas (leak per matmul). A `Forward` * scope matches the forward-pass lifetime; a `Model` scope the model's. */ -@ExperimentalMemoryApi public sealed interface Scope : AutoCloseable { public val kind: ScopeKind /** Bytes currently owned and alive in this scope. */ @@ -48,7 +47,6 @@ public sealed interface Scope : AutoCloseable { * (deterministic: the JVM unmaps the file, native `free`s/`munmap`s). Idiomatic use: * `ModelScope().use { model -> … }`. */ -@ExperimentalMemoryApi public class ModelScope(override val sink: TraceSink = NoopTraceSink, public val name: String = "model") : Scope { override val kind: ScopeKind get() = ScopeKind.MODEL private val owned = ArrayList() @@ -107,7 +105,6 @@ public class ModelScope(override val sink: TraceSink = NoopTraceSink, public val * in [overflowBytes] so the planner can resize the slab). Outputs that must outlive the step are * copied out with [retain]. */ -@ExperimentalMemoryApi public class ForwardScope( public val slabFloats: Int, override val sink: TraceSink = NoopTraceSink, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Storage.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Storage.kt index ac52f3e18..cba06ad8e 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Storage.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Storage.kt @@ -16,7 +16,6 @@ import kotlin.jvm.JvmInline * debugger keys on. One `TensorId` maps to many storage ids over time (a `Forward` scope is * recycled every step); one storage may back many `TensorId`s (views, KV ring). */ -@ExperimentalMemoryApi @JvmInline public value class StorageId(public val value: Long) { override fun toString(): String = "#$value" @@ -34,7 +33,6 @@ public value class StorageId(public val value: Long) { * [Alias] keeps its parent alive and cannot free or resize, [Owned] storage is freed exactly once, * by its scope. */ -@ExperimentalMemoryApi public sealed interface Owner { /** We allocated the bytes; the scope of [scope] kind frees them. */ public data class Owned(val scope: ScopeKind) : Owner @@ -47,7 +45,6 @@ public sealed interface Owner { } /** Thrown on any access to a storage after its scope or the storage itself was closed (SKEEP-003 rule 2). */ -@ExperimentalMemoryApi public class StorageClosedException( public val storageId: StorageId, public val origin: TensorId?, @@ -65,7 +62,6 @@ public class StorageClosedException( * is released (forgotten) but never freed; every access after close throws * [StorageClosedException] carrying the id and origin — not a JVM crash, not silent corruption. */ -@ExperimentalMemoryApi public sealed class Storage : AutoCloseable { public abstract val id: StorageId public abstract val sizeBytes: Long diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TensorView.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TensorView.kt index c1a972a82..e0e7b9eb7 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TensorView.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TensorView.kt @@ -21,7 +21,6 @@ import sk.ainet.lang.types.FP32 * reference path; a production kernel unwraps the storage once per call * ([Storage.Heap.floats] / `SegmentStorage.segment()`), as the Phase-2 spike (#1016) requires. */ -@ExperimentalMemoryApi public class TensorView( public val shape: Shape, public val format: Format, @@ -350,7 +349,6 @@ public class TensorView( * Decodes one block of a packed encoding out of a [Storage] — the bridge between the block formats * (`PackedBlockStorage` implementations today, `Encoding` descriptors in M2) and [TensorView]. */ -@ExperimentalMemoryApi public interface BlockDecoder { public val blockSize: Int public val bytesPerBlock: Int @@ -377,7 +375,6 @@ public interface BlockDecoder { * is what keeps rule 4 true across a relayout: `get()` on a prepacked view returns the same value * it returned before (#973). */ -@ExperimentalMemoryApi public class RelayoutedBlockDecoder( private val delegate: BlockDecoder, private val rows: Int, @@ -408,7 +405,6 @@ public class RelayoutedBlockDecoder( } /** A [BlockDecoder] backed by an existing [PackedBlockStorage] implementation (the M1 bridge). */ -@ExperimentalMemoryApi public class PackedBlockDecoder(private val packed: PackedBlockStorage) : BlockDecoder { override val blockSize: Int get() = packed.blockSize override val bytesPerBlock: Int get() = (packed.physicalBytes / maxOf(packed.blockCount, 1)).toInt() @@ -421,7 +417,6 @@ public class PackedBlockDecoder(private val packed: PackedBlockStorage) : BlockD * Decoder for 16-bit narrow floats (FP16 / BF16) held two bytes per element — the "block" is one * element, so a narrow-float view decodes element by element through its [codec]. */ -@ExperimentalMemoryApi public class NarrowFloatDecoder(private val codec: sk.ainet.lang.types.NarrowFloatCodec) : BlockDecoder { override val blockSize: Int get() = 1 override val bytesPerBlock: Int get() = codec.bytesPerElement diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TernaryCodec.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TernaryCodec.kt index 669eb9f15..5a26e0ac5 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TernaryCodec.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/TernaryCodec.kt @@ -21,7 +21,6 @@ import kotlin.math.round * * Both round-trip exactly for ternary input: `decode(encode(v)) == v * fp16(amax)`. */ -@ExperimentalMemoryApi public object TernaryCodec { /** Powers of three, as `dequantize_row_tq1_0`'s `pow3` table. */ @@ -390,7 +389,6 @@ public object TernaryCodec { * the descriptor-driven path a `TensorView` over `TQ1_0`/`TQ2_0`/BitNet bytes decodes through * (SKEEP-003 §4.4: `get()` decodes, never a raw byte). */ -@ExperimentalMemoryApi public class TernaryBlockDecoder private constructor( private val encoding: TensorEncoding, override val blockSize: Int, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Views.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Views.kt index 1343e8f98..21456e075 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Views.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/Views.kt @@ -16,7 +16,6 @@ import sk.ainet.lang.tensor.Tensor */ /** This tensor as a [TensorView] over the *same* bytes, or `null` if its data cannot expose one. */ -@ExperimentalMemoryApi public fun Tensor<*, *>.viewOrNull(): TensorView? = data.view /** @@ -25,7 +24,6 @@ public fun Tensor<*, *>.viewOrNull(): TensorView? = data.view * @throws UnsupportedOperationException if the tensor's data has no view (a backend type that owns * its bytes elsewhere, e.g. device-resident data); use `copyToFloatArray()` for those. */ -@ExperimentalMemoryApi public fun Tensor<*, *>.view(): TensorView = viewOrNull() ?: throw UnsupportedOperationException( "${data::class.simpleName} does not expose a TensorView; it holds its bytes somewhere this milestone cannot address" ) @@ -37,7 +35,6 @@ public fun Tensor<*, *>.view(): TensorView = viewOrNull() ?: throw UnsupportedOp * The result is an ordinary [TensorView] — the same type [narrow], [transpose], [unsqueeze] and * [squeeze] return, which is the whole point of #1034. */ -@ExperimentalMemoryApi public fun TensorView.slice(slices: List>): TensorView { require(slices.size == shape.rank) { "expected one slice per axis (${shape.rank}), got ${slices.size}" @@ -60,5 +57,4 @@ public fun TensorView.slice(slices: List>): TensorView { } /** [slice] with the slices spelled out positionally. */ -@ExperimentalMemoryApi public fun TensorView.slice(vararg slices: Slice<*, *>): TensorView = slice(slices.toList()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedAttention.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedAttention.kt index 6769fa591..8c5ec4d98 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedAttention.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedAttention.kt @@ -16,7 +16,6 @@ import kotlin.math.sqrt * A kernel that cannot do this calls [WindowedKV.gather] instead and gets one contiguous view plus * one traced adapter; both paths are asserted to agree. */ -@ExperimentalMemoryApi public object WindowedAttention { /** diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedKV.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedKV.kt index eb090c0bb..f577a5a7f 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedKV.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/WindowedKV.kt @@ -22,7 +22,6 @@ import sk.ainet.lang.tensor.TensorId * @property head the first (older) run — the only one when the window does not wrap * @property tail the second (newer) run, present only after the ring wraps */ -@ExperimentalMemoryApi public class WindowedKV( public val head: TensorView, public val tail: TensorView? = null, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/AllocationResolver.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/AllocationResolver.kt index ce61e1a4c..2c5482c90 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/AllocationResolver.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/AllocationResolver.kt @@ -1,7 +1,6 @@ package sk.ainet.lang.memory.plan import sk.ainet.lang.memory.AllocationSpec -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.PlatformStorage import sk.ainet.lang.memory.ScopeKind @@ -12,7 +11,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * What the running platform's storage can actually do — the third input of [AllocationResolver], * separated from [PlatformStorage] so a test can resolve for a platform it is not running on. */ -@ExperimentalMemoryApi public data class StorageCapabilities( val supportsMappedFiles: Boolean, val supportsOffHeap: Boolean = true, @@ -69,7 +67,6 @@ public data class StorageCapabilities( * platform can do* ([StorageCapabilities]). Consumers — the plan, the loader, a context — carry the * result; none of them decide. Nothing here allocates. */ -@ExperimentalMemoryApi public object AllocationResolver { /** diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/DeviceFit.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/DeviceFit.kt index e72c6427b..c983e3f01 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/DeviceFit.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/DeviceFit.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * What a device has to offer, as **two pools** rather than one (SKEEP-002, #1038). @@ -19,7 +18,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * @property heapMaxBytes the managed-heap cap (`Runtime.maxMemory()`) * @property heapUsedBytes managed heap in use right now */ -@ExperimentalMemoryApi public data class DeviceMemory( val totalRamBytes: Long, val availableRamBytes: Long, @@ -50,7 +48,6 @@ public data class DeviceMemory( } /** One resource pool of a [DeviceFit]: what the plan needs from it, and what it has. */ -@ExperimentalMemoryApi public data class PoolFit(val name: String, val neededBytes: Long, val budgetBytes: Long) { public val fits: Boolean get() = neededBytes <= budgetBytes /** Bytes left over (negative when it does not fit). */ @@ -64,7 +61,6 @@ public data class PoolFit(val name: String, val neededBytes: Long, val budgetByt * @property weightsMapped whether the weights are loaded through `WeightResidency.MAPPED`, i.e. from * file-backed pages that never count against the managed heap. */ -@ExperimentalMemoryApi public data class DeviceFit( val plan: MemoryPlan, val device: DeviceMemory, @@ -113,7 +109,6 @@ public data class DeviceFit( * * @param weightsMapped weights come from file-backed pages (`WeightResidency.MAPPED`) */ -@ExperimentalMemoryApi public fun MemoryPlan.fitOn(device: DeviceMemory, weightsMapped: Boolean): DeviceFit { val heapNeeded = kvBytes + forwardBytes + headroomBytes + if (weightsMapped) 0L else weightsBytes val heap = PoolFit("managed heap", heapNeeded, device.heapFreeBytes) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/KernelCapabilities.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/KernelCapabilities.kt index f8ac40885..b70a68f2e 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/KernelCapabilities.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/KernelCapabilities.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.blockSpec import sk.ainet.lang.tensor.storage.TensorEncoding @@ -16,7 +15,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * [PlannerProfile] and the two are used together, while the backend modules are downstream. The * registry-backed implementation is over there, where the providers are. */ -@ExperimentalMemoryApi public interface KernelCapabilities { /** diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/MemoryPlan.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/MemoryPlan.kt index 660ee5c50..7d50cd043 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/MemoryPlan.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/MemoryPlan.kt @@ -1,7 +1,6 @@ package sk.ainet.lang.memory.plan import sk.ainet.lang.memory.AllocationSpec -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.tensor.TensorId import sk.ainet.lang.tensor.storage.TensorEncoding @@ -10,7 +9,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * One weight tensor as the planner sees it — shape and format only, never bytes (SKEEP-003 §8 item 1, * PRD M0-F1). [id] is the [TensorId] the checkpoint's `NameMap` produced, `null` when unmapped. */ -@ExperimentalMemoryApi public data class PlanTensor( val name: String, val id: TensorId?, @@ -54,7 +52,6 @@ public data class PlanTensor( } /** The transformer geometry the KV-cache and forward-slab estimates need (from the GGUF header). */ -@ExperimentalMemoryApi public data class ModelGeometry( val layers: Int, val heads: Int, @@ -72,7 +69,6 @@ public data class ModelGeometry( ) /** How the KV cache is stored. */ -@ExperimentalMemoryApi public enum class KvCacheMode(public val label: String) { /** * 4 bytes per element — what `DefaultKvCacheStore` actually stores today (dense FloatArray @@ -100,11 +96,9 @@ public enum class KvCacheMode(public val label: String) { * guessing a [KvCacheMode] (#1077). A dense FP32 ring reports 4 bytes per element, a bf16 ring 2, a * TurboQuant ring its packed width. */ -@ExperimentalMemoryApi public fun kvBytesFor(format: Format, elements: Long): Long = format.physicalBytes(elements) ?: (format.dtype.sizeInBytes.toLong() * elements) -@ExperimentalMemoryApi public data class PlanInput( val modelName: String, val architecture: String, @@ -128,7 +122,6 @@ public data class PlanInput( * Memory budget the plan is checked against (decision #11): an explicit number of bytes, or * `available − reserve` for a platform. */ -@ExperimentalMemoryApi public data class Budget(val bytes: Long, val description: String) { public companion object { /** Reserve the OS/app needs on Android and desktop JVMs (decision #11). */ @@ -147,7 +140,6 @@ public data class Budget(val bytes: Long, val description: String) { * A [mapped] line is file-backed page cache — resident in RSS but evictable, and **not** charged * against the heap [Budget] (#1189: a mapped 1 GB model runs under a 256 MB ART cap). */ -@ExperimentalMemoryApi public data class PlanLine( val section: String, val detail: String, @@ -157,7 +149,6 @@ public data class PlanLine( ) /** A concrete way to make a plan fit, with the bytes it saves. */ -@ExperimentalMemoryApi public data class Suggestion(val text: String, val savesBytes: Long) /** @@ -166,7 +157,6 @@ public data class Suggestion(val text: String, val savesBytes: Long) * allocated (PRD M0-F1..F3). The estimates are deliberately simple and documented in * [MemoryPlans]; milestone M1's plan-vs-actual check calibrates them against real allocations. */ -@ExperimentalMemoryApi public data class MemoryPlan( val input: PlanInput, val weightsBytes: Long, @@ -305,7 +295,6 @@ public data class MemoryPlan( } /** The arithmetic behind [MemoryPlan]. */ -@ExperimentalMemoryApi public object MemoryPlans { /** Fixed heap headroom the JVM/ART runtime needs besides tensors (decision #11 profile). */ diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlanVsActual.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlanVsActual.kt index 0718778f1..c02e81394 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlanVsActual.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlanVsActual.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.memory.trace.RecordingTraceSink import sk.ainet.lang.memory.trace.TraceEvent @@ -11,7 +10,6 @@ import sk.ainet.lang.memory.trace.TraceEvent * predicted. The point is to keep the planner honest as kernels change — a plan that drifts from * reality is worse than no plan, so CI compares them and fails past a threshold. */ -@ExperimentalMemoryApi public data class ActualMemory( /** Peak live bytes per scope over the run. */ val peakByScope: Map, @@ -60,7 +58,6 @@ public data class ActualMemory( } /** One line of the comparison: what the plan said, what the run did, and by how much they differ. */ -@ExperimentalMemoryApi public data class PlanVsActualLine(val section: String, val plannedBytes: Long, val actualBytes: Long) { /** Signed relative difference (`actual/planned - 1`); `null` when nothing was planned. */ val relativeDrift: Double? get() = if (plannedBytes == 0L) null else (actualBytes - plannedBytes).toDouble() / plannedBytes @@ -77,7 +74,6 @@ public data class PlanVsActualLine(val section: String, val plannedBytes: Long, * `check()` is what a CI acceptance run calls — a drift beyond the tolerance fails, which keeps the * planner honest as kernels change. */ -@ExperimentalMemoryApi public data class PlanVsActual( val plan: MemoryPlan, val actual: ActualMemory, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlannerProfile.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlannerProfile.kt index 19fe997da..f6f85b74a 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlannerProfile.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/PlannerProfile.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.storage.MemoryDomain /** @@ -23,7 +22,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * @property strict turn those warnings into failures * @property weightsMapped weights are expected to load through `WeightResidency.MAPPED` */ -@ExperimentalMemoryApi public data class PlannerProfile( val name: String, val reserveBytes: Long, @@ -169,11 +167,9 @@ private fun percent(fraction: Double): String { } /** How bad a dequantization share is under a profile. */ -@ExperimentalMemoryApi public enum class DequantSeverity { OK, WARN, ERROR } /** The verdict of [PlannerProfile.checkDequant]. */ -@ExperimentalMemoryApi public data class DequantVerdict( val profile: PlannerProfile, val share: Double, @@ -187,7 +183,6 @@ public data class DequantVerdict( } /** A [MemoryPlan] made under a [PlannerProfile], with what the profile decided along the way. */ -@ExperimentalMemoryApi public data class ProfiledPlan( val profile: PlannerProfile, val plan: MemoryPlan, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightForm.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightForm.kt index a2cc5d056..c81453dae 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightForm.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightForm.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.DType @@ -39,7 +38,6 @@ import sk.ainet.lang.types.DType * @property shape which way round the dimensions are labelled * @property residency whether the bytes live on the heap or in file-backed pages */ -@ExperimentalMemoryApi public data class WeightForm( val encoding: EncodingRequest = EncodingRequest.KeepAsStored, val order: WeightByteOrder = WeightByteOrder.AS_STORED, @@ -60,7 +58,6 @@ public data class WeightForm( } /** What the loaded bytes should encode. */ -@ExperimentalMemoryApi public sealed interface EncodingRequest { /** Whatever the file holds, untouched. The default, and the only one that costs nothing. */ @@ -94,7 +91,6 @@ public sealed interface EncodingRequest { * kernel feed order hold the same blocks in different physical positions, and they coincide only at * one block per row (#973, #968). */ -@ExperimentalMemoryApi public enum class WeightByteOrder { /** The file's own order — canonical row-major blocks, as every GGUF-shaped producer writes. */ @@ -118,7 +114,6 @@ public enum class WeightByteOrder { * changing its block order moves every block and leaves the shape alone. A weight can need either, * both, or neither. */ -@ExperimentalMemoryApi public enum class WeightShapeOrientation { /** The file's own order, unreversed — GGUF `ne`, so `[in, out]` for a 2-D weight. */ @@ -132,7 +127,6 @@ public enum class WeightShapeOrientation { } /** Where a weight's bytes live. The loader-side spelling of `StagingPolicy` (#1037). */ -@ExperimentalMemoryApi public enum class WeightResidency { /** Read onto the managed heap. The historical behaviour, and the only option in a browser. */ diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightFormResolver.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightFormResolver.kt index 1c5442650..07618d49a 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightFormResolver.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/plan/WeightFormResolver.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.blockSpec import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.FP32 @@ -14,7 +13,6 @@ import sk.ainet.lang.types.FP32 * weights should be held is a function of three things the author does not know and the loader * does. */ -@ExperimentalMemoryApi public object WeightFormResolver { /** @@ -103,7 +101,6 @@ public object WeightFormResolver { * discovered when the load runs out of memory. Weights whose format has no encoding — dense ones — * resolve to a pass-through form and change nothing. */ -@ExperimentalMemoryApi public fun PlanInput.resolveWeightForms( profile: PlannerProfile, capabilities: KernelCapabilities, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationMetrics.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationMetrics.kt index b7c9228bd..dd0a41d1b 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationMetrics.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationMetrics.kt @@ -1,9 +1,7 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi /** Time spent inside one module span, and how often it ran (the per-layer breakdown). */ -@ExperimentalMemoryApi public data class ModuleCost(val path: String, val nanos: Long, val calls: Int) { public val averageNanos: Long get() = if (calls == 0) 0L else nanos / calls } @@ -22,7 +20,6 @@ public data class ModuleCost(val path: String, val nanos: Long, val calls: Int) * @property peakBytesPerSecond the device's peak memory bandwidth, if known; only then is * [bandwidthUtilization] computable. */ -@ExperimentalMemoryApi public data class GenerationMetrics( val prefillTokens: Int = 0, val prefillNanos: Long = 0L, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationPhases.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationPhases.kt index e11613eec..d3ba4ad4e 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationPhases.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/GenerationPhases.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.TensorId /** @@ -8,7 +7,6 @@ import sk.ainet.lang.tensor.TensorId * helpers below; [GenerationMetrics] reads them back. Both sides use these constants, so a typo * cannot silently produce a metric of zero. */ -@ExperimentalMemoryApi public object Phases { /** Weights being read off disk / mapped. */ public const val LOAD: String = "load" @@ -29,7 +27,6 @@ public object Phases { } /** Counter names the metrics reader understands (`TraceEvent.Counter`). */ -@ExperimentalMemoryApi public object Counters { /** Resident set size, bytes. */ public const val RSS: String = "rss" @@ -48,17 +45,14 @@ public object Counters { } /** The prompt pass over [tokens] tokens. */ -@ExperimentalMemoryApi public inline fun TraceSink.prefill(tokens: Int, block: () -> T): T = phase(Phases.PREFILL, attributes = mapOf(Phases.ATTR_TOKENS to tokens.toString()), block = block) /** One decode step; [step] is the token index (1-based). */ -@ExperimentalMemoryApi public inline fun TraceSink.decodeStep(step: Int, block: () -> T): T = phase(Phases.DECODE, step, block = block) /** The sampling that turns this step's logits into a token. */ -@ExperimentalMemoryApi public inline fun TraceSink.sample(step: Int? = null, block: () -> T): T = phase(Phases.SAMPLE, step, block = block) @@ -66,17 +60,14 @@ public inline fun TraceSink.sample(step: Int? = null, block: () -> T): T = * A module span nested inside the current phase — `model.layers[3].attn`, `model.lm_head`. These * are what [GenerationMetrics.modules] aggregates into the per-layer breakdown. */ -@ExperimentalMemoryApi public inline fun TraceSink.module(path: String, step: Int? = null, block: () -> T): T = phase(path, step, mapOf(Phases.ATTR_KIND to Phases.KIND_MODULE), block) /** A module span named after [id]'s module path. */ -@ExperimentalMemoryApi public inline fun TraceSink.module(id: TensorId, step: Int? = null, block: () -> T): T = module(id.modulePath.joinToString("."), step, block) /** Record a counter sample (RSS, page faults, a derived metric). */ -@ExperimentalMemoryApi public fun TraceSink.counter(name: String, value: Long, unit: String = "bytes") { if (isEnabled) emit(TraceEvent.Counter(name, value, unit)) } diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporter.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporter.kt index 2e8eedd64..02c1a2585 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporter.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporter.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ScopeKind /** @@ -18,7 +17,6 @@ import sk.ainet.lang.memory.ScopeKind * * Timestamps are microseconds (Perfetto's unit) derived from the events' nanosecond clock. */ -@ExperimentalMemoryApi public object PerfettoTraceExporter { private const val PID: Int = 1 diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PlanTrace.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PlanTrace.kt index 78544c1a0..661a092fc 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PlanTrace.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/PlanTrace.kt @@ -1,10 +1,8 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.plan.MemoryPlan /** Emit this plan as a [TraceEvent.Plan] so the plan-vs-actual check (#1030) can find it in the stream. */ -@ExperimentalMemoryApi public fun MemoryPlan.emit(sink: TraceSink) { if (!sink.isEnabled) return sink.emit( diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceEvent.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceEvent.kt index 3a6f5c79b..45b078ea0 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceEvent.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceEvent.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.tensor.TensorId @@ -14,7 +13,6 @@ import sk.ainet.lang.tensor.TensorId * Events are small value objects; [timeNanos] is a monotonic timestamp in nanoseconds * ([TraceClock.nowNanos]), comparable only within one process. */ -@ExperimentalMemoryApi public sealed interface TraceEvent { public val timeNanos: Long @@ -116,7 +114,6 @@ public sealed interface TraceEvent { } /** Monotonic clock for trace timestamps (`kotlin.time.TimeSource.Monotonic`). */ -@ExperimentalMemoryApi public object TraceClock { private val start = kotlin.time.TimeSource.Monotonic.markNow() public fun nowNanos(): Long = start.elapsedNow().inWholeNanoseconds diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceSink.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceSink.kt index 56736e1d5..ef9a2192d 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceSink.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/memory/trace/TraceSink.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi /** * Where [TraceEvent]s go. Disabled by default ([NoopTraceSink]) — emitting costs one `isEnabled` @@ -8,7 +7,6 @@ import sk.ainet.lang.memory.ExperimentalMemoryApi * (ring buffer, tests and the debugger), [CompositeTraceSink], and the exporters of M1 slice #1025 * (Perfetto JSON, JFR, `android.os.Trace`). */ -@ExperimentalMemoryApi public interface TraceSink { /** `false` for a sink that drops everything; producers check it before building an event. */ public val isEnabled: Boolean get() = true @@ -17,7 +15,6 @@ public interface TraceSink { } /** The default: nothing is recorded, nothing is allocated. */ -@ExperimentalMemoryApi public object NoopTraceSink : TraceSink { override val isEnabled: Boolean get() = false override fun emit(event: TraceEvent) {} @@ -27,7 +24,6 @@ public object NoopTraceSink : TraceSink { * Keeps the last [capacity] events in a ring buffer. The debugger, tests and the plan-vs-actual * check read [events]; [clear] starts over. Not thread-safe by design (one sink per context). */ -@ExperimentalMemoryApi public class RecordingTraceSink(public val capacity: Int = DEFAULT_CAPACITY) : TraceSink { init { require(capacity > 0) { "capacity must be > 0" } } @@ -55,7 +51,6 @@ public class RecordingTraceSink(public val capacity: Int = DEFAULT_CAPACITY) : T } /** Fan-out to several sinks; enabled if any of them is. */ -@ExperimentalMemoryApi public class CompositeTraceSink(private val sinks: List) : TraceSink { public constructor(vararg sinks: TraceSink) : this(sinks.toList()) override val isEnabled: Boolean get() = sinks.any { it.isEnabled } @@ -66,7 +61,6 @@ public class CompositeTraceSink(private val sinks: List) : TraceSink * Run [block] inside a phase span: emits [TraceEvent.PhaseBegin], then [TraceEvent.PhaseEnd] with * the measured duration (also on exception). No events and no allocation when the sink is disabled. */ -@ExperimentalMemoryApi public inline fun TraceSink.phase(name: String, step: Int? = null, attributes: Map = emptyMap(), block: () -> T): T { if (!isEnabled) return block() val t0 = TraceClock.nowNanos() @@ -80,7 +74,6 @@ public inline fun TraceSink.phase(name: String, step: Int? = null, attribute } /** Time [block] as a kernel run of [op] on [kernel]; the returned value is the kernel's result. */ -@ExperimentalMemoryApi public inline fun TraceSink.kernel( op: String, kernel: String, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorData.kt index 044f1c8ba..dfa99e8a7 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorData.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.data -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.tensor.Shape @@ -41,11 +40,9 @@ public class BitNetB158TensorData private constructor( * they are not on the fast kernel-dispatch path, so that snapshot is the exception, not the * steady state. */ - @ExperimentalMemoryApi public constructor(initialShape: Shape, storage: Storage) : this(initialShape, null, storage) /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) @@ -55,7 +52,6 @@ public class BitNetB158TensorData private constructor( override val blockCount: Int get() = 1 override val blockSize: Int get() = shape.volume - @ExperimentalMemoryApi override val packedStorage: Storage get() = backingStorage ?: Storage.Heap.wrap(heapData!!, mutable = false) @@ -133,7 +129,6 @@ public class BitNetB158TensorData private constructor( BitNetB158TensorData(shape, bytes) /** Wrap a `payload + scale` [storage] (validates the size) — see the [Storage] constructor. */ - @ExperimentalMemoryApi public fun fromStorage(shape: Shape, storage: Storage): BitNetB158TensorData = BitNetB158TensorData(shape, storage) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesTensorData.kt index 7fa1fdae1..18d424c9f 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesTensorData.kt @@ -22,7 +22,6 @@ public class BitNetPlanesTensorData( ) : TensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/NarrowFloatTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/NarrowFloatTensorData.kt index 160f1d3a7..8d441fa71 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/NarrowFloatTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/NarrowFloatTensorData.kt @@ -67,7 +67,6 @@ public open class NarrowFloatDenseTensorData( * The dtype is the codec's (FP16 or BF16) and the encoding `Dense(2)`; `view.get()` returns the * decoded float, exactly like [get]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = sk.ainet.lang.memory.TensorView( shape = shape, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_0TensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_0TensorData.kt index 9aaa4f720..2597199be 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_0TensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_0TensorData.kt @@ -73,7 +73,6 @@ public class Q4_0BlockTensorData( ) : Q4_0TensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_KTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_KTensorData.kt index cf3a24b9d..30539dace 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_KTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q4_KTensorData.kt @@ -100,7 +100,6 @@ public class Q4_KBlockTensorData( ) : Q4_KTensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_0TensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_0TensorData.kt index 8a1cc1ad1..184413d87 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_0TensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_0TensorData.kt @@ -46,7 +46,6 @@ public class Q5_0BlockTensorData( ) : Q5_0TensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_1TensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_1TensorData.kt index 25ec6b92e..41057cdce 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_1TensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_1TensorData.kt @@ -51,7 +51,6 @@ public class Q5_1BlockTensorData( ) : Q5_1TensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_KTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_KTensorData.kt index 51b25d3cc..d3302663d 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_KTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q5_KTensorData.kt @@ -106,7 +106,6 @@ public class Q5_KBlockTensorData( ) : Q5_KTensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q6_KTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q6_KTensorData.kt index c6712d22c..c941e5c37 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q6_KTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q6_KTensorData.kt @@ -91,7 +91,6 @@ public class Q6_KBlockTensorData( ) : Q6_KTensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q8_0TensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q8_0TensorData.kt index 666f5c27a..68fbb7842 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q8_0TensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/Q8_0TensorData.kt @@ -60,7 +60,6 @@ public class Q8_0BlockTensorData( ) : Q8_0TensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/ScopedTensorDataFactory.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/ScopedTensorDataFactory.kt index 75fd7c258..c90383582 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/ScopedTensorDataFactory.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/ScopedTensorDataFactory.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.data -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Scope import sk.ainet.lang.tensor.Shape import sk.ainet.lang.types.DType @@ -25,7 +24,6 @@ import kotlin.reflect.KClass * contract is zero-copy over a caller-owned array (loaders use them for weights), and neither * copying them into a slab nor letting them die at `reset()` would honour it. */ -@ExperimentalMemoryApi public class ScopedTensorDataFactory( private val base: TensorDataFactory, private val scope: () -> Scope, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/StorageFloatTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/StorageFloatTensorData.kt index 29a049def..ccabea2ed 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/StorageFloatTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/StorageFloatTensorData.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.data -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Storage import sk.ainet.lang.memory.TensorView import sk.ainet.lang.tensor.Shape @@ -22,7 +21,6 @@ import sk.ainet.lang.types.FP32 * [copyToFloatArray] are offset-correct; kernels that want zero-copy take [view], which carries the * offset properly. */ -@ExperimentalMemoryApi public class StorageFloatTensorData( initialShape: Shape, public val storage: Storage.Heap, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TensorData.kt index 7c6bc55bf..a33e6ae84 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TensorData.kt @@ -91,7 +91,6 @@ public interface TensorData : ItemsAccessor { * copied. Per-element access stays on this interface's own fast path — the Phase-2 spike * (#1016) showed a view is for unwrapping once per call, not for per-element reads. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val view: sk.ainet.lang.memory.TensorView? get() = null /** @@ -135,7 +134,6 @@ public interface FloatArrayTensorData : TensorData { override fun copyToFloatArray(): FloatArray = buffer.copyOf() /** A dense FP32 view borrowing [buffer] — zero-copy, the same bytes this data reads and writes. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = sk.ainet.lang.memory.TensorView.dense( sk.ainet.lang.memory.Storage.Heap.wrap(buffer), @@ -151,7 +149,6 @@ public interface IntArrayTensorData : TensorData { public val buffer: IntArray /** A dense Int32 view borrowing [buffer] — zero-copy, the same bytes this data reads and writes. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = sk.ainet.lang.memory.TensorView.dense( sk.ainet.lang.memory.Storage.Heap.wrap(buffer), diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TernaryTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TernaryTensorData.kt index 5102f997c..044de1903 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TernaryTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TernaryTensorData.kt @@ -50,7 +50,6 @@ public class Ternary2BitTensorData( ) : TernaryTensorData, PackedBlockStorage { /** The façade over the packed bytes (SKEEP-003 §4.1): see [PackedBlockStorage.packedView]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = packedView override val shape: Shape = Shape(initialShape.dimensions.copyOf()) @@ -140,7 +139,6 @@ public class Ternary2BitTensorData( // TQ2_0 interleaves: byte `j + m` holds four elements 32 apart, so the bytes cannot be // adopted verbatim — decode them through the reference codec (#1033) and re-pack into // this type's four-consecutive-elements-per-byte layout. - @OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) val codes = sk.ainet.lang.memory.TernaryCodec.codesTq2_0(blockData, minOf(shape.volume, 256)) return fromTernaryValues(shape, codes.copyOf(shape.volume), scale) } diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TransposedWeightTensorData.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TransposedWeightTensorData.kt index 6f527753f..197c9169b 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TransposedWeightTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/data/TransposedWeightTensorData.kt @@ -61,7 +61,6 @@ public class TransposedWeightTensorData( * layout by moving `blockAxis` with the axes (#1034) — the view knows where its blocks run, so * decoding through it addresses the right elements. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView? get() = weight.view?.transpose() override fun get(vararg indices: Int): V { diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/CompressedKvAttention.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/CompressedKvAttention.kt index 66cafc898..00017fa1f 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/CompressedKvAttention.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/CompressedKvAttention.kt @@ -93,7 +93,6 @@ public class CompressedKvAttention( * KV store needs no special case here; for the dense ring the halves are views over the ring * itself and nothing is copied at all. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public fun keyWindowForAttention( layer: Int, startPos: Int = 0, @@ -101,7 +100,6 @@ public class CompressedKvAttention( ): sk.ainet.lang.memory.WindowedKV = cache.keyWindow(layer, startPos, endPos) /** The value window; see [keyWindowForAttention]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public fun valueWindowForAttention( layer: Int, startPos: Int = 0, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/DefaultKvCacheStore.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/DefaultKvCacheStore.kt index 66e3ddebc..fe58e3429 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/DefaultKvCacheStore.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/DefaultKvCacheStore.kt @@ -24,7 +24,6 @@ import sk.ainet.lang.types.FP32 * the model closes, which is what lets the memory plan be checked against reality (#1074). The * default keeps today's behaviour exactly. */ -@OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) public class DefaultKvCacheStore @kotlin.jvm.JvmOverloads constructor( private val config: KvCacheConfig, private val scope: sk.ainet.lang.memory.ModelScope? = null, @@ -44,10 +43,8 @@ public class DefaultKvCacheStore @kotlin.jvm.JvmOverloads constructor( override val valueEncoding: TensorEncoding get() = config.valueEncoding /** The dense ring holds [KvCacheConfig.keyDType] elements (FP32 unless configured otherwise) — #1077. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val keyFormat: sk.ainet.lang.memory.Format get() = sk.ainet.lang.memory.Format(config.keyDType, config.keyEncoding) - @sk.ainet.lang.memory.ExperimentalMemoryApi override val valueFormat: sk.ainet.lang.memory.Format get() = sk.ainet.lang.memory.Format(config.valueDType, config.valueEncoding) override val placement: Placement get() = config.placement @@ -177,17 +174,13 @@ public class DefaultKvCacheStore @kotlin.jvm.JvmOverloads constructor( get() = if (slidingWindow) (_currentSeqLen - maxSeqLen).coerceAtLeast(0) else 0 /** Storage handles over the per-layer arrays, made once so a window costs no allocation. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi private val keyStorages by lazy { List(numLayers) { sk.ainet.lang.memory.Storage.Heap.wrap(keys[it]) } } - @sk.ainet.lang.memory.ExperimentalMemoryApi private val valueStorages by lazy { List(numLayers) { sk.ainet.lang.memory.Storage.Heap.wrap(values[it]) } } - @sk.ainet.lang.memory.ExperimentalMemoryApi override fun keyWindow(layer: Int, from: Int, to: Int): sk.ainet.lang.memory.WindowedKV = window(keyStorages[layer], layer, from, to, config.keyDType) - @sk.ainet.lang.memory.ExperimentalMemoryApi override fun valueWindow(layer: Int, from: Int, to: Int): sk.ainet.lang.memory.WindowedKV = window(valueStorages[layer], layer, from, to, config.valueDType) @@ -198,7 +191,6 @@ public class DefaultKvCacheStore @kotlin.jvm.JvmOverloads constructor( * stride left at `maxSeqLen * headDim`: contiguous per head, strided across heads. When the run * crosses the end of the ring it becomes two such views, oldest first. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi private fun window( storage: sk.ainet.lang.memory.Storage, layer: Int, @@ -221,7 +213,6 @@ public class DefaultKvCacheStore @kotlin.jvm.JvmOverloads constructor( } } - @sk.ainet.lang.memory.ExperimentalMemoryApi private fun view( storage: sk.ainet.lang.memory.Storage, startSlot: Int, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/KvCacheStore.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/KvCacheStore.kt index 52496f494..7bd6545ef 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/KvCacheStore.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/KvCacheStore.kt @@ -20,7 +20,6 @@ import sk.ainet.lang.tensor.ops.turboquant.TurboQuantPresets * - Asymmetric K/V policies (e.g., Q8_0 for keys, 4-bit for values) * - Backend-specific fused dequant+attention paths */ -@OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) private fun bytesPerElement(format: sk.ainet.lang.memory.Format): Double { val probe = 1024L val bytes = format.physicalBytes(probe) ?: return format.dtype.sizeInBytes.toDouble() @@ -28,7 +27,6 @@ private fun bytesPerElement(format: sk.ainet.lang.memory.Format): Double { } /** Average bytes per element of [format]; fractional for packed encodings. */ -@OptIn(sk.ainet.lang.memory.ExperimentalMemoryApi::class) internal fun kvBytesPerElement(format: sk.ainet.lang.memory.Format): Double { val probe = 1024L val bytes = format.physicalBytes(probe) ?: return format.dtype.sizeInBytes.toDouble() @@ -68,21 +66,17 @@ public interface KvCacheStore { * memory planner reads this instead of guessing a byte width, and guessing is what made a dense * FP32 ring be planned as bf16 and understated by 2× (#1074 caught it; this makes it impossible). */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val keyFormat: sk.ainet.lang.memory.Format get() = sk.ainet.lang.memory.Format(sk.ainet.lang.types.FP32, keyEncoding) /** What the values are and how they are stored; see [keyFormat]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val valueFormat: sk.ainet.lang.memory.Format get() = sk.ainet.lang.memory.Format(sk.ainet.lang.types.FP32, valueEncoding) /** Bytes one key element occupies under [keyFormat] (fractional for sub-byte encodings). */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val keyBytesPerElement: Double get() = kvBytesPerElement(keyFormat) /** Bytes one value element occupies under [valueFormat]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val valueBytesPerElement: Double get() = kvBytesPerElement(valueFormat) /** @@ -93,17 +87,14 @@ public interface KvCacheStore { * The default implementation copies the range once through [readKeys], which is correct for * every store; [DefaultKvCacheStore] overrides it with zero-copy views over the ring itself. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public fun keyWindow(layer: Int, from: Int = 0, to: Int = currentSeqLen): sk.ainet.lang.memory.WindowedKV = copiedWindow(readKeys(layer, from, to), to - from, keyFormat.dtype) /** The attention window of this layer's values; see [keyWindow]. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public fun valueWindow(layer: Int, from: Int = 0, to: Int = currentSeqLen): sk.ainet.lang.memory.WindowedKV = copiedWindow(readValues(layer, from, to), to - from, valueFormat.dtype) /** A single-run window over an already-materialized `[heads, positions, headDim]` array. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi private fun copiedWindow( values: FloatArray, positions: Int, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/PackedBlockStorage.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/PackedBlockStorage.kt index 69d305b73..97811780b 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/PackedBlockStorage.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/PackedBlockStorage.kt @@ -40,7 +40,6 @@ public interface PackedBlockStorage { * bytes actually live off-heap or mapped (e.g. a large ternary weight, to stay off the ART * heap cap) overrides this to expose its real backing storage instead. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val packedStorage: sk.ainet.lang.memory.Storage get() = sk.ainet.lang.memory.Storage.Heap.wrap(packedData, mutable = false) @@ -93,7 +92,6 @@ public interface PackedBlockStorage { * `view.get(...)` decodes through [dequantizeBlock] (rule 4) — it never returns a raw byte, * unlike this data's own `get`, which stays as it is for source compatibility. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi public val packedView: sk.ainet.lang.memory.TensorView get() = sk.ainet.lang.memory.TensorView.packed( storage = packedStorage, diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/TurboQuantKvCacheStore.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/TurboQuantKvCacheStore.kt index ba3ed136b..ac993bf8d 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/TurboQuantKvCacheStore.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/storage/TurboQuantKvCacheStore.kt @@ -33,10 +33,8 @@ public class TurboQuantKvCacheStore( override val valueEncoding: TensorEncoding get() = config.valueEncoding /** Logically FP32 values held as TurboQuant codes — the encoding the config carries (#1077). */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val keyFormat: sk.ainet.lang.memory.Format get() = sk.ainet.lang.memory.Format(sk.ainet.lang.types.FP32, keyEncoding) - @sk.ainet.lang.memory.ExperimentalMemoryApi override val valueFormat: sk.ainet.lang.memory.Format get() = sk.ainet.lang.memory.Format(sk.ainet.lang.types.FP32, valueEncoding) override val placement: Placement get() = config.placement diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/ExecutionContextScopeTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/ExecutionContextScopeTest.kt index 27d2f97ae..18d4fccaa 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/ExecutionContextScopeTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/ExecutionContextScopeTest.kt @@ -1,6 +1,5 @@ package sk.ainet.context -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.StorageClosedException import sk.ainet.lang.tensor.Shape @@ -17,7 +16,6 @@ import kotlin.test.assertTrue * path; a ForwardScope makes creation draw from the slab, `reset()` recycles it, and a * use-after-reset is a loud [StorageClosedException] rather than silent garbage. */ -@OptIn(ExperimentalMemoryApi::class) class ExecutionContextScopeTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/schedule/ScheduledExecutionContextTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/schedule/ScheduledExecutionContextTest.kt index 26cbca893..d8ac6d871 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/schedule/ScheduledExecutionContextTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/context/schedule/ScheduledExecutionContextTest.kt @@ -5,7 +5,6 @@ import sk.ainet.context.ExecutionContext import sk.ainet.context.ScheduledExecutionContext import sk.ainet.context.forwardScope import sk.ainet.context.withSchedule -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.trace.RecordingTraceSink import sk.ainet.lang.memory.trace.TraceEvent import sk.ainet.lang.memory.trace.TraceSink @@ -19,7 +18,6 @@ import kotlin.test.assertTrue * context that cannot rebuild its ops reports an unhonoured request as a trace event (never a * silent downgrade), and the decorator survives the other decorators it composes with. */ -@OptIn(ExperimentalMemoryApi::class) class ScheduledExecutionContextTest { /** A schedule that only counts; enough to prove which one a context carries. */ diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/AllocationSpecTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/AllocationSpecTest.kt index 9ea853a42..374f911b5 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/AllocationSpecTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/AllocationSpecTest.kt @@ -14,7 +14,6 @@ import kotlin.test.assertNull import kotlin.test.assertTrue /** SKEEP-003 Phase 0: `AllocationSpec` replaced the never-consumed `StorageSpec` (deleted in #1142). */ -@OptIn(ExperimentalMemoryApi::class) class AllocationSpecTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/BlockOrderTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/BlockOrderTest.kt index 371f502f5..e7c810270 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/BlockOrderTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/BlockOrderTest.kt @@ -20,7 +20,6 @@ import kotlin.test.assertTrue * plausible, finite, wrong numbers. That is the failure #968/#971 shipped, and the reason the order * is now carried rather than guessed. */ -@OptIn(ExperimentalMemoryApi::class) class BlockOrderTest { private val rows = 4 diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/DescribeTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/DescribeTest.kt index 61e612432..99cc23adf 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/DescribeTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/DescribeTest.kt @@ -15,7 +15,6 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue -@OptIn(ExperimentalMemoryApi::class) class DescribeTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/FormatTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/FormatTest.kt index 36ef9b7cd..c07a005cb 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/FormatTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/FormatTest.kt @@ -34,7 +34,6 @@ import kotlin.test.assertTrue * SKEEP-003 M0-A3: every tensor reports a coherent `Format(dtype, encoding)`; a packed weight is * logically FP32 with its block encoding — never a `Byte`-typed tensor. */ -@OptIn(ExperimentalMemoryApi::class) class FormatTest { @Suppress("UNCHECKED_CAST") diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/LayoutTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/LayoutTest.kt index e2e8494f0..422a3d4a3 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/LayoutTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/LayoutTest.kt @@ -10,7 +10,6 @@ import kotlin.test.assertFalse import kotlin.test.assertTrue /** SKEEP-003 §0 *Layout*: strides, offset and contiguity of a view — metadata only. */ -@OptIn(ExperimentalMemoryApi::class) class LayoutTest { private val f32 = Format.dense(FP32) diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryDebugTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryDebugTest.kt index c66e8f624..4b7a9e51d 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryDebugTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryDebugTest.kt @@ -12,7 +12,6 @@ import kotlin.test.assertNull import kotlin.test.assertTrue /** SKEEP-003 §4.7 / §8 item 4, PRD M1-F9: the debug mode that would have found #782 in one run. */ -@OptIn(ExperimentalMemoryApi::class) class MemoryDebugTest { @BeforeTest fun on() { MemoryDebug.overrideEnabled = true; MemoryDebug.reset() } diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryProbeTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryProbeTest.kt index 462cb278b..8751cc726 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryProbeTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/MemoryProbeTest.kt @@ -15,7 +15,6 @@ import kotlin.test.assertTrue * platform either answers with something plausible or says `null`, and whatever it answers reaches * the trace as a counter. The numbers themselves are read on the reference device. */ -@OptIn(ExperimentalMemoryApi::class) class MemoryProbeTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/OneViewMechanismTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/OneViewMechanismTest.kt index 84ea72873..420205a58 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/OneViewMechanismTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/OneViewMechanismTest.kt @@ -25,7 +25,6 @@ import kotlin.test.assertTrue * answers as each of them, over the same `Storage`, and that every view operation returns the same * type so they compose. */ -@OptIn(ExperimentalMemoryApi::class) class OneViewMechanismTest { private fun rampTensor(vararg dims: Int): Tensor { diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PackedTensorDataViewTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PackedTensorDataViewTest.kt index 5b08bef3f..d56b488f1 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PackedTensorDataViewTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PackedTensorDataViewTest.kt @@ -25,7 +25,6 @@ import kotlin.test.assertTrue * decodes **bit-identically** to the existing block decoders and borrows the very bytes the loader * produced (rule 5 — nothing is copied, nothing is re-ordered). */ -@OptIn(ExperimentalMemoryApi::class) class PackedTensorDataViewTest { /** Deterministic bytes with sane FP16 scales, as in the golden parity fixtures. */ diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PlatformStorageTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PlatformStorageTest.kt index 319df0fdf..a17668eb0 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PlatformStorageTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/PlatformStorageTest.kt @@ -11,7 +11,6 @@ import kotlin.test.assertIs import kotlin.test.assertTrue /** SKEEP-003 §4.8: one common door to the platform's storage kinds; heap everywhere, off-heap where the target has it. */ -@OptIn(ExperimentalMemoryApi::class) class PlatformStorageTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/ScopeTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/ScopeTest.kt index 5072c8bde..8380b95fe 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/ScopeTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/ScopeTest.kt @@ -13,7 +13,6 @@ import kotlin.test.assertSame import kotlin.test.assertTrue /** SKEEP-003 §4.5: Forward (recycled per step), Model (closed with the model), Ambient (GC) — M1-F3 / M1-F4. */ -@OptIn(ExperimentalMemoryApi::class) class ScopeTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/StorageTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/StorageTest.kt index 3dfbac21e..4daefce38 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/StorageTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/StorageTest.kt @@ -15,7 +15,6 @@ import kotlin.test.assertSame import kotlin.test.assertTrue /** SKEEP-003 rules 1–2 (one byte owner, ownership enforced) for the common Heap storage. */ -@OptIn(ExperimentalMemoryApi::class) class StorageTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorDataViewTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorDataViewTest.kt index 8ea8dd249..6cba3b525 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorDataViewTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorDataViewTest.kt @@ -23,7 +23,6 @@ import kotlin.test.assertTrue * SKEEP-003 §4.1: `TensorData` becomes a façade over `TensorView` — the view is over the *same* * bytes (borrowed, zero-copy), reads agree with the data's own accessors, and nothing is copied. */ -@OptIn(ExperimentalMemoryApi::class) class TensorDataViewTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorViewTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorViewTest.kt index 13e5ff8ba..963832aeb 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorViewTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TensorViewTest.kt @@ -19,7 +19,6 @@ import kotlin.test.assertTrue * SKEEP-003 rules 4–6: `get()` decodes (never a raw byte), views are zero-copy over the same * storage, `materialize()` is the only copy point. */ -@OptIn(ExperimentalMemoryApi::class) class TensorViewTest { private fun denseView(vararg dims: Int): TensorView { diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TernaryEncodingTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TernaryEncodingTest.kt index c47d6fd18..43d8fa375 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TernaryEncodingTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/TernaryEncodingTest.kt @@ -20,7 +20,6 @@ import kotlin.test.assertTrue * the wrong element order still produces plausible-looking numbers, so the interleave is pinned * explicitly rather than only round-tripped. */ -@OptIn(ExperimentalMemoryApi::class) class TernaryEncodingTest { private fun ternary(n: Int, seed: Int = 1): FloatArray { diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/WindowedKvTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/WindowedKvTest.kt index d16be81e7..a7ea3de94 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/WindowedKvTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/WindowedKvTest.kt @@ -16,7 +16,6 @@ import kotlin.test.assertTrue * #1036 (M2-F5, M2-A4): a sliding-window KV cache hands attention the one or two runs the ring * physically holds, and the answer is the same as if the window had never wrapped. */ -@OptIn(ExperimentalMemoryApi::class) class WindowedKvTest { private val heads = 2 diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/AllocationResolverTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/AllocationResolverTest.kt index 9ca54e70a..0bcdc9ee5 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/AllocationResolverTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/AllocationResolverTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.tensor.storage.MemoryDomain @@ -17,7 +16,6 @@ import kotlin.test.assertTrue * an [sk.ainet.lang.memory.AllocationSpec] out. These tests pin the rules the old * `PlanTensor.allocation` hardcode ignored. */ -@OptIn(ExperimentalMemoryApi::class) class AllocationResolverTest { private val q4k = Format(FP32, TensorEncoding.Q4_K) diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/BitNet2BPlanTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/BitNet2BPlanTest.kt index 982d29050..48228b9f0 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/BitNet2BPlanTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/BitNet2BPlanTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.BF16 @@ -23,7 +22,6 @@ import kotlin.test.assertTrue * disk); the embedding table and the output head stay bf16, which is what a b1.58 checkpoint ships * and, as the numbers below show, is where most of the resident memory actually goes. */ -@OptIn(ExperimentalMemoryApi::class) class BitNet2BPlanTest { private val mb = 1024L * 1024L diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/DeviceFitTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/DeviceFitTest.kt index 027cc2c72..e8c235ca1 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/DeviceFitTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/DeviceFitTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.FP32 @@ -19,7 +18,6 @@ import kotlin.test.assertTrue * unremarkable when its weights are mapped — one total cannot express that, so this asserts the * two-pool arithmetic and the advice it produces. */ -@OptIn(ExperimentalMemoryApi::class) class DeviceFitTest { private val mb = 1024L * 1024L diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MappedBudgetPlanTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MappedBudgetPlanTest.kt index d66a102b0..b7d7e281f 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MappedBudgetPlanTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MappedBudgetPlanTest.kt @@ -5,7 +5,6 @@ import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertNotEquals import kotlin.test.assertTrue -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.tensor.storage.MemoryDomain import sk.ainet.lang.tensor.storage.TensorEncoding @@ -17,7 +16,6 @@ import sk.ainet.lang.types.FP32 * under a 256 MB ART cap with 566 KB of weight heap; a plan that says "does not fit" about that * run is wrong, and this test is what keeps it from saying so again. */ -@OptIn(ExperimentalMemoryApi::class) class MappedBudgetPlanTest { private val platform = StorageCapabilities.FULL diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MemoryPlanTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MemoryPlanTest.kt index a0a163857..1068ee43f 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MemoryPlanTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/MemoryPlanTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.tensor.TensorId @@ -14,7 +13,6 @@ import kotlin.test.assertNull import kotlin.test.assertTrue /** SKEEP-003 M0-A4: plan arithmetic, fit check and suggestions — from shapes and encodings only. */ -@OptIn(ExperimentalMemoryApi::class) class MemoryPlanTest { /** Llama-3.2-1B-like geometry. */ diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlanVsActualTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlanVsActualTest.kt index ddf9621e0..f868a3fd7 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlanVsActualTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlanVsActualTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ForwardScope import sk.ainet.lang.memory.ModelScope @@ -19,7 +18,6 @@ import kotlin.test.assertTrue * SKEEP-003 §4.9 / PRD M1-F8: the plan is compared with what a run actually allocated, and a drift * beyond the tolerance fails — which is what keeps the planner honest as kernels change. */ -@OptIn(ExperimentalMemoryApi::class) class PlanVsActualTest { private val geometry = ModelGeometry(layers = 2, heads = 4, kvHeads = 2, headDim = 16, valueDim = 16, embeddingLength = 64, feedForwardLength = 128, vocabSize = 256) diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlannerProfileTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlannerProfileTest.kt index ba9b44cae..219636e2e 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlannerProfileTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/PlannerProfileTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.tensor.storage.MemoryDomain import sk.ainet.lang.tensor.storage.TensorEncoding @@ -15,7 +14,6 @@ import kotlin.test.assertTrue * #1039 (M2-F6, decision #11): the planner's device profiles — one test per rule, because each of * them is a number someone will otherwise "improve" by feel. */ -@OptIn(ExperimentalMemoryApi::class) class PlannerProfileTest { private val mb = 1024L * 1024L diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormPlanPricingTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormPlanPricingTest.kt index b825c789d..23ebb04a1 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormPlanPricingTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormPlanPricingTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.FP32 @@ -12,7 +11,6 @@ import kotlin.test.assertTrue * #1116: a declared form changes the plan, so a dequantization is a line in a table rather than an * OOM at load. */ -@OptIn(ExperimentalMemoryApi::class) class WeightFormPlanPricingTest { private val elements = 1L shl 20 // 1 Mi weights, so the numbers are legible diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormResolverTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormResolverTest.kt index fbf6ee1b0..662211219 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormResolverTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/plan/WeightFormResolverTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.plan -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.tensor.storage.TensorEncoding import sk.ainet.lang.types.FP32 import kotlin.test.Test @@ -15,7 +14,6 @@ import kotlin.test.assertTrue * one absent, under both a desktop and a 2 GB profile, and each cell states what should come out * and why. If a rule changes, this table is where it changes. */ -@OptIn(ExperimentalMemoryApi::class) class WeightFormResolverTest { private val packed: List = listOf( diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/GenerationMetricsTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/GenerationMetricsTest.kt index 4be33c1c8..19b8e3d28 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/GenerationMetricsTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/GenerationMetricsTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.tensor.TensorId @@ -18,7 +17,6 @@ import kotlin.test.assertTrue * effective bandwidth, the per-module breakdown — is asserted exactly and identically on every * target, instead of depending on how coarse the platform clock happens to be. */ -@OptIn(ExperimentalMemoryApi::class) class GenerationMetricsTest { private val ms = 1_000_000L diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporterTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporterTest.kt index 97b106d5a..dc4e8edf5 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporterTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/PerfettoTraceExporterTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.tensor.TensorId @@ -11,7 +10,6 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue /** SKEEP-003 §4.9 / PRD M1-A7: one track per scope, kernel spans labelled by TensorId, a live-bytes counter. */ -@OptIn(ExperimentalMemoryApi::class) class PerfettoTraceExporterTest { private fun decodeStepEvents(): List { diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/TraceSinkTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/TraceSinkTest.kt index 2695e8b35..1f757e50b 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/TraceSinkTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/memory/trace/TraceSinkTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.memory.plan.Budget @@ -19,7 +18,6 @@ import kotlin.test.assertIs import kotlin.test.assertTrue /** SKEEP-003 §4.9 / M1-F7 (API half): one event stream, disabled by default, recorded into a ring buffer. */ -@OptIn(ExperimentalMemoryApi::class) class TraceSinkTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataTest.kt index 6f590669c..fe85d6aba 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.data -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.storage.TensorEncoding @@ -14,7 +13,6 @@ import kotlin.test.assertFailsWith * the same reference the kernels and the GGUF loader are defined against — so all three readers * agree about the same bytes. */ -@OptIn(ExperimentalMemoryApi::class) class BitNetB158TensorDataTest { private fun ternaryValues(count: Int, seed: Int): FloatArray { diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesCodecTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesCodecTest.kt index 373c7014a..a27c896cd 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesCodecTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/data/BitNetPlanesCodecTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.data -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.storage.TensorEncoding @@ -15,7 +14,6 @@ import kotlin.test.assertTrue * Eight planes of ±0.5-threshold round-to-trit with ×3 residual scaling reconstruct the row * within `rowScale / (2·3⁷)` — the format's defined truncation bound. */ -@OptIn(ExperimentalMemoryApi::class) class BitNetPlanesCodecTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheFormatTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheFormatTest.kt index 5839ac5a3..851b8e807 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheFormatTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheFormatTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.storage -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.Format import sk.ainet.lang.memory.plan.kvBytesFor import sk.ainet.lang.types.BF16 @@ -13,7 +12,6 @@ import kotlin.test.assertTrue * #1077: a KV store declares its `Format` (dtype **and** encoding), so the planner reads the byte * width instead of guessing it — the drift that made a dense FP32 ring be planned as bf16. */ -@OptIn(ExperimentalMemoryApi::class) class KvCacheFormatTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheModelScopeTest.kt b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheModelScopeTest.kt index a6f011997..5a0e3b739 100644 --- a/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheModelScopeTest.kt +++ b/skainet-lang/skainet-lang-core/src/commonTest/kotlin/sk/ainet/lang/tensor/storage/KvCacheModelScopeTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.storage -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.ModelScope import sk.ainet.lang.memory.ScopeKind import sk.ainet.lang.memory.plan.ActualMemory @@ -16,7 +15,6 @@ import kotlin.test.assertTrue * bytes are tracked, traced and released with the model — and the memory plan's KV line can be * checked against what the store actually took (#1074). */ -@OptIn(ExperimentalMemoryApi::class) class KvCacheModelScopeTest { private val config = KvCacheConfig(numLayers = 4, numHeads = 2, headDim = 8, maxSeqLen = 16) diff --git a/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt b/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt index 4325b0d66..b339f6e0a 100644 --- a/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt +++ b/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt @@ -1,9 +1,7 @@ package sk.ainet.lang.memory /** No property store here: debug mode is opt-in through [MemoryDebug.overrideEnabled]. */ -@ExperimentalMemoryApi internal actual fun platformMemoryDebugEnabled(): Boolean = false /** No cheap stack walk on this target. */ -@ExperimentalMemoryApi internal actual fun platformCallSite(): String? = null diff --git a/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.js.kt b/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.js.kt index 4383c2eb6..33bf85920 100644 --- a/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.js.kt +++ b/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.js.kt @@ -1,7 +1,6 @@ package sk.ainet.lang.memory /** No process-level view here: a browser or Wasm host does not expose one. */ -@ExperimentalMemoryApi public actual object MemoryProbe { public actual fun rssBytes(): Long? = null public actual fun majorFaults(): Long? = null diff --git a/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt b/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt index c04a44ff7..59d28c3d2 100644 --- a/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt +++ b/skainet-lang/skainet-lang-core/src/jsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt @@ -9,7 +9,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * to the heap (the planner records the fallback); files arrive through fetch/range requests into * heap slabs, so [mapFile] is unsupported here. */ -@ExperimentalMemoryApi public actual object PlatformStorage { public actual fun supports(domain: MemoryDomain): Boolean = domain == MemoryDomain.HOST_HEAP public actual val supportsMappedFiles: Boolean get() = false diff --git a/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/DirectBufferStorage.kt b/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/DirectBufferStorage.kt index fb3b8519b..9437dad76 100644 --- a/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/DirectBufferStorage.kt +++ b/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/DirectBufferStorage.kt @@ -17,7 +17,6 @@ import java.nio.file.StandardOpenOption * the buffer becomes unreachable (direct buffers have no explicit free on Android); [close] marks * the storage dead so no late access can see it. Use [SegmentStorage] where FFM is available. */ -@ExperimentalMemoryApi public class DirectBufferStorage private constructor( override val id: StorageId, private val buf: ByteBuffer, @@ -76,7 +75,6 @@ public class DirectBufferStorage private constructor( * — weights outside ART entirely (SKEEP-002 / #921). Unmapped when the buffer becomes unreachable; * [close] marks the storage dead. */ -@ExperimentalMemoryApi public class MappedBufferStorage private constructor( override val id: StorageId, public val path: Path, diff --git a/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/MemoryProbe.jvmAndroid.kt b/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/MemoryProbe.jvmAndroid.kt index 777d5aa4f..900b546e6 100644 --- a/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/MemoryProbe.jvmAndroid.kt +++ b/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/memory/MemoryProbe.jvmAndroid.kt @@ -11,7 +11,6 @@ import java.io.File * * Returns `null` off Linux (macOS, Windows), where these files do not exist. */ -@ExperimentalMemoryApi public actual object MemoryProbe { private val pageSize: Long = 4096L diff --git a/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorData.kt b/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorData.kt index a0248e53a..34fedcfdf 100644 --- a/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/jvmAndroidMain/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorData.kt @@ -3,7 +3,6 @@ package sk.ainet.lang.tensor.data import java.nio.ByteBuffer import sk.ainet.lang.memory.BlockOrder import sk.ainet.lang.memory.DirectBufferStorage -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.MappedBufferStorage import sk.ainet.lang.memory.PackedBlockDecoder import sk.ainet.lang.memory.Storage @@ -38,7 +37,6 @@ import sk.ainet.lang.types.FP32 * exists to avoid. Readers that need bytes go through [packedView]'s storage; readers that need * values go through [dequantizeBlock]. */ -@ExperimentalMemoryApi public class BufferPackedTensorData( initialShape: Shape, /** Off-heap storage holding exactly this tensor's packed blocks (payload only, offset 0). */ diff --git a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/JvmStorage.kt b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/JvmStorage.kt index dbc7d43ea..db3264d5e 100644 --- a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/JvmStorage.kt +++ b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/JvmStorage.kt @@ -18,7 +18,6 @@ import java.nio.file.StandardOpenOption * own `Arena.ofShared()` and closes it on [close]; milestone slice #1021 (`Scope`) passes the * scope's arena instead, so `Forward` becomes a recycled bump slab. */ -@ExperimentalMemoryApi public class SegmentStorage private constructor( override val id: StorageId, private val seg: MemorySegment, @@ -87,7 +86,6 @@ public class SegmentStorage private constructor( * shared across processes; closing the storage unmaps (SKEEP-003 §4.8.1). Packed GGUF weights and * embedding tables live here. */ -@ExperimentalMemoryApi public class MappedFileStorage private constructor( override val id: StorageId, public val path: Path, diff --git a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/MemoryDebug.jvm.kt b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/MemoryDebug.jvm.kt index 033d6f69c..b1e1b5b67 100644 --- a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/MemoryDebug.jvm.kt +++ b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/MemoryDebug.jvm.kt @@ -1,11 +1,9 @@ package sk.ainet.lang.memory -@ExperimentalMemoryApi internal actual fun platformMemoryDebugEnabled(): Boolean = System.getProperty(MemoryDebug.PROPERTY) == "true" || System.getenv(MemoryDebug.ENV).let { it == "1" || it == "true" } /** The first frame outside `sk.ainet.lang.memory` — where the allocation was actually asked for. */ -@ExperimentalMemoryApi internal actual fun platformCallSite(): String? = StackWalker.getInstance().walk { frames -> frames.filter { !it.className.startsWith("sk.ainet.lang.memory") } .findFirst() diff --git a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/PlatformStorage.jvm.kt b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/PlatformStorage.jvm.kt index 1f2607e3d..0a7de268d 100644 --- a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/PlatformStorage.jvm.kt +++ b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/PlatformStorage.jvm.kt @@ -6,7 +6,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain import java.nio.file.Path /** JVM: off-heap = FFM `MemorySegment` ([SegmentStorage]), mapped = `FileChannel.map` ([MappedFileStorage]). */ -@ExperimentalMemoryApi public actual object PlatformStorage { public actual fun supports(domain: MemoryDomain): Boolean = domain == MemoryDomain.HOST_HEAP || domain == MemoryDomain.HOST_OFFHEAP || domain == MemoryDomain.MMAP_FILE public actual val supportsMappedFiles: Boolean get() = true diff --git a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/trace/JfrTraceSink.kt b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/trace/JfrTraceSink.kt index 226ba094d..ddb9eddc2 100644 --- a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/trace/JfrTraceSink.kt +++ b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/memory/trace/JfrTraceSink.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.memory.trace -import sk.ainet.lang.memory.ExperimentalMemoryApi import jdk.jfr.Category import jdk.jfr.Event import jdk.jfr.EventFactory @@ -16,7 +15,6 @@ import jdk.jfr.Name * `jcmd JFR.start`) and the events appear under the **SKaiNET** category. Emission is cheap and * self-disabling — JFR drops an event whose type is not enabled, and [isEnabled] mirrors that. */ -@ExperimentalMemoryApi public class JfrTraceSink : TraceSink { @Name("sk.ainet.KernelRun") @Label("SKaiNET kernel run") @Category("SKaiNET") diff --git a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/tensor/data/MemorySegmentTensorData.kt b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/tensor/data/MemorySegmentTensorData.kt index d8b421d6c..4da56b188 100644 --- a/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/tensor/data/MemorySegmentTensorData.kt +++ b/skainet-lang/skainet-lang-core/src/jvmMain/kotlin/sk/ainet/lang/tensor/data/MemorySegmentTensorData.kt @@ -54,7 +54,6 @@ public class MemorySegmentTensorData private constructor( * data's [segment] — nothing is copied and a migrated kernel unwraps it once with * `SegmentStorage.segment()`. */ - @sk.ainet.lang.memory.ExperimentalMemoryApi override val view: sk.ainet.lang.memory.TensorView get() = sk.ainet.lang.memory.TensorView.dense( sk.ainet.lang.memory.SegmentStorage.borrow( diff --git a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/JvmStorageTest.kt b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/JvmStorageTest.kt index f0bc79531..c4de8367b 100644 --- a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/JvmStorageTest.kt +++ b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/JvmStorageTest.kt @@ -22,7 +22,6 @@ import kotlin.test.assertSame import kotlin.test.assertTrue /** SKEEP-003 §4.8.1/§4.8.2: OffHeap (MemorySegment / direct ByteBuffer) and Mapped (FileChannel.map) storage kinds. */ -@OptIn(ExperimentalMemoryApi::class) class JvmStorageTest { @Test diff --git a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/PlatformStorageJvmTest.kt b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/PlatformStorageJvmTest.kt index 0613cf994..aa843c755 100644 --- a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/PlatformStorageJvmTest.kt +++ b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/memory/PlatformStorageJvmTest.kt @@ -7,7 +7,6 @@ import kotlin.test.assertContentEquals import kotlin.test.assertEquals import kotlin.test.assertIs -@OptIn(ExperimentalMemoryApi::class) class PlatformStorageJvmTest { @Test fun jvmBindsSegmentsAndMappedFiles() { diff --git a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataJvmTest.kt b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataJvmTest.kt index 0797c6b97..9475ef039 100644 --- a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataJvmTest.kt +++ b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BitNetB158TensorDataJvmTest.kt @@ -1,6 +1,5 @@ package sk.ainet.lang.tensor.data -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.PlatformStorage import sk.ainet.lang.memory.TernaryCodec import sk.ainet.lang.tensor.Shape @@ -15,7 +14,6 @@ import kotlin.test.assertIs * historical heap-backed one, and [BitNetB158TensorData.set] must write through to the backing * storage rather than only updating the lazily materialized snapshot. */ -@OptIn(ExperimentalMemoryApi::class) class BitNetB158TensorDataJvmTest { private fun ternaryValues(count: Int, seed: Int): FloatArray { diff --git a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorDataTest.kt b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorDataTest.kt index 4e37c2cea..f534bf711 100644 --- a/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorDataTest.kt +++ b/skainet-lang/skainet-lang-core/src/jvmTest/kotlin/sk/ainet/lang/tensor/data/BufferPackedTensorDataTest.kt @@ -9,7 +9,6 @@ import kotlin.test.assertFailsWith import kotlin.test.assertTrue import sk.ainet.lang.memory.BlockOrder import sk.ainet.lang.memory.DirectBufferStorage -import sk.ainet.lang.memory.ExperimentalMemoryApi import sk.ainet.lang.memory.MappedBufferStorage import sk.ainet.lang.tensor.Shape import sk.ainet.lang.tensor.storage.TensorEncoding @@ -18,7 +17,6 @@ import sk.ainet.lang.tensor.storage.TensorEncoding * #1189: a [BufferPackedTensorData] over off-heap bytes must decode exactly like the heap * `TensorData` for the same bytes — mapped file or direct buffer, Q4_K and Q6_K. */ -@OptIn(ExperimentalMemoryApi::class) class BufferPackedTensorDataTest { private fun randomPayload(numBlocks: Int, bytesPerBlock: Int, fp16At: IntArray, seed: Int): ByteArray { diff --git a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt index 4325b0d66..b339f6e0a 100644 --- a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt +++ b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt @@ -1,9 +1,7 @@ package sk.ainet.lang.memory /** No property store here: debug mode is opt-in through [MemoryDebug.overrideEnabled]. */ -@ExperimentalMemoryApi internal actual fun platformMemoryDebugEnabled(): Boolean = false /** No cheap stack walk on this target. */ -@ExperimentalMemoryApi internal actual fun platformCallSite(): String? = null diff --git a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryProbe.native.kt b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryProbe.native.kt index f9ed339c5..3c33811e2 100644 --- a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryProbe.native.kt +++ b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/MemoryProbe.native.kt @@ -12,7 +12,6 @@ import platform.posix.fopen * them (macOS, iOS) `fopen` fails and every value is `null`, which is the honest answer. */ @OptIn(ExperimentalForeignApi::class) -@ExperimentalMemoryApi public actual object MemoryProbe { private const val PAGE_SIZE: Long = 4096L diff --git a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/NativeStorage.kt b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/NativeStorage.kt index f7cde36a7..533c30aae 100644 --- a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/NativeStorage.kt +++ b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/NativeStorage.kt @@ -32,7 +32,6 @@ import platform.posix.open * (SKEEP-003 §4.8.3). Alignment: `malloc` gives 16 bytes on every supported platform, which is what * NEON wants; 64-byte alignment for AMX-class paths is a follow-up with `posix_memalign`. */ -@ExperimentalMemoryApi public class NativeMallocStorage private constructor( override val id: StorageId, private val ptr: CPointer, @@ -85,7 +84,6 @@ public class NativeMallocStorage private constructor( } /** Kotlin/Native binding of [Storage.Mapped]: `mmap(2)` of a file region, read-only, `munmap` on close. */ -@ExperimentalMemoryApi public class NativeMappedStorage private constructor( override val id: StorageId, public val path: String, diff --git a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/PlatformStorage.native.kt b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/PlatformStorage.native.kt index ee06813bc..66c9c348f 100644 --- a/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/PlatformStorage.native.kt +++ b/skainet-lang/skainet-lang-core/src/nativeMain/kotlin/sk/ainet/lang/memory/PlatformStorage.native.kt @@ -5,7 +5,6 @@ import sk.ainet.lang.tensor.TensorId import sk.ainet.lang.tensor.storage.MemoryDomain /** Kotlin/Native: off-heap = `malloc` ([NativeMallocStorage]), mapped = `mmap` ([NativeMappedStorage]). */ -@ExperimentalMemoryApi public actual object PlatformStorage { public actual fun supports(domain: MemoryDomain): Boolean = domain == MemoryDomain.HOST_HEAP || domain == MemoryDomain.HOST_OFFHEAP || domain == MemoryDomain.MMAP_FILE public actual val supportsMappedFiles: Boolean get() = true diff --git a/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt b/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt index 4325b0d66..b339f6e0a 100644 --- a/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt +++ b/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt @@ -1,9 +1,7 @@ package sk.ainet.lang.memory /** No property store here: debug mode is opt-in through [MemoryDebug.overrideEnabled]. */ -@ExperimentalMemoryApi internal actual fun platformMemoryDebugEnabled(): Boolean = false /** No cheap stack walk on this target. */ -@ExperimentalMemoryApi internal actual fun platformCallSite(): String? = null diff --git a/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmJs.kt b/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmJs.kt index 4383c2eb6..33bf85920 100644 --- a/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmJs.kt +++ b/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmJs.kt @@ -1,7 +1,6 @@ package sk.ainet.lang.memory /** No process-level view here: a browser or Wasm host does not expose one. */ -@ExperimentalMemoryApi public actual object MemoryProbe { public actual fun rssBytes(): Long? = null public actual fun majorFaults(): Long? = null diff --git a/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt b/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt index c04a44ff7..59d28c3d2 100644 --- a/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt +++ b/skainet-lang/skainet-lang-core/src/wasmJsMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt @@ -9,7 +9,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * to the heap (the planner records the fallback); files arrive through fetch/range requests into * heap slabs, so [mapFile] is unsupported here. */ -@ExperimentalMemoryApi public actual object PlatformStorage { public actual fun supports(domain: MemoryDomain): Boolean = domain == MemoryDomain.HOST_HEAP public actual val supportsMappedFiles: Boolean get() = false diff --git a/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt b/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt index 4325b0d66..b339f6e0a 100644 --- a/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt +++ b/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryDebug.other.kt @@ -1,9 +1,7 @@ package sk.ainet.lang.memory /** No property store here: debug mode is opt-in through [MemoryDebug.overrideEnabled]. */ -@ExperimentalMemoryApi internal actual fun platformMemoryDebugEnabled(): Boolean = false /** No cheap stack walk on this target. */ -@ExperimentalMemoryApi internal actual fun platformCallSite(): String? = null diff --git a/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmWasi.kt b/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmWasi.kt index 4383c2eb6..33bf85920 100644 --- a/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmWasi.kt +++ b/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/MemoryProbe.wasmWasi.kt @@ -1,7 +1,6 @@ package sk.ainet.lang.memory /** No process-level view here: a browser or Wasm host does not expose one. */ -@ExperimentalMemoryApi public actual object MemoryProbe { public actual fun rssBytes(): Long? = null public actual fun majorFaults(): Long? = null diff --git a/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt b/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt index c04a44ff7..59d28c3d2 100644 --- a/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt +++ b/skainet-lang/skainet-lang-core/src/wasmWasiMain/kotlin/sk/ainet/lang/memory/PlatformStorage.web.kt @@ -9,7 +9,6 @@ import sk.ainet.lang.tensor.storage.MemoryDomain * to the heap (the planner records the fallback); files arrive through fetch/range requests into * heap slabs, so [mapFile] is unsupported here. */ -@ExperimentalMemoryApi public actual object PlatformStorage { public actual fun supports(domain: MemoryDomain): Boolean = domain == MemoryDomain.HOST_HEAP public actual val supportsMappedFiles: Boolean get() = false From 86b773df769625e005be3203599138658dd60e88 Mon Sep 17 00:00:00 2001 From: Michal Harakal Date: Sun, 6 Sep 2026 10:07:44 +0200 Subject: [PATCH 2/2] Update api dump for ExperimentalMemoryApi removal apiCheck failed on develop's CI: the checked-in skainet-lang-core.api snapshot still declared the deleted ExperimentalMemoryApi annotation class. Regenerated via ./gradlew apiDump. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01PLfVvtURRYZETceamLi8kP --- skainet-lang/skainet-lang-core/api/jvm/skainet-lang-core.api | 3 --- 1 file changed, 3 deletions(-) diff --git a/skainet-lang/skainet-lang-core/api/jvm/skainet-lang-core.api b/skainet-lang/skainet-lang-core/api/jvm/skainet-lang-core.api index 925a8bce4..b79db22ad 100644 --- a/skainet-lang/skainet-lang-core/api/jvm/skainet-lang-core.api +++ b/skainet-lang/skainet-lang-core/api/jvm/skainet-lang-core.api @@ -897,9 +897,6 @@ public final class sk/ainet/lang/memory/DirectBufferStorage$Companion { public static synthetic fun borrow$default (Lsk/ainet/lang/memory/DirectBufferStorage$Companion;Ljava/nio/ByteBuffer;Lsk/ainet/lang/tensor/TensorId;Lsk/ainet/lang/memory/trace/TraceSink;ILjava/lang/Object;)Lsk/ainet/lang/memory/DirectBufferStorage; } -public abstract interface annotation class sk/ainet/lang/memory/ExperimentalMemoryApi : java/lang/annotation/Annotation { -} - public final class sk/ainet/lang/memory/Format { public static final field Companion Lsk/ainet/lang/memory/Format$Companion; public fun (Lsk/ainet/lang/types/DType;Lsk/ainet/lang/tensor/storage/TensorEncoding;)V