Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.io.gguf

import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.io.safetensors

import sk.ainet.io.RandomAccessSource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // this file *is* the deprecated type

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.types.BF16
Expand All @@ -23,6 +25,10 @@ import sk.ainet.lang.types.Ternary
* values are physically stored. A tensor with logical type [FLOAT32] might
* be encoded as [TensorEncoding.Dense], [TensorEncoding.Q4_K], etc.
*/
@Deprecated(
message = "LogicalDType merges into DType (SKEEP-003 decision #13): use the DType objects (FP32, Int8, …) and the dtype-first constructors/overloads.",
replaceWith = ReplaceWith("DType", "sk.ainet.lang.types.DType"),
)
public enum class LogicalDType(
public val sizeInBits: Int,
public val isFloatingPoint: Boolean,
Expand Down Expand Up @@ -78,6 +84,10 @@ public enum class LogicalDType(
* The [LogicalDType] for a [DType]. Inverse of [toDType]; prefer the extension
* [sk.ainet.lang.tensor.storage.toLogicalDType] at call sites.
*/
@Deprecated(
message = "LogicalDType merges into DType (SKEEP-003 decision #13); the DType object itself is the logical type.",
replaceWith = ReplaceWith("dtype"),
)
public fun fromDType(dtype: DType): LogicalDType = when (dtype) {
is Ternary -> TERNARY
is Int4 -> INT4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@file:JvmName("DTypeBridge")
@file:Suppress("DEPRECATION") // the bridge exists to keep the deprecated type usable until removal

package sk.ainet.lang.tensor.storage

Expand All @@ -19,4 +20,8 @@ import kotlin.jvm.JvmName
* When `LogicalDType` is deprecated (decision #13, separate slice) its `ReplaceWith` targets
* point at `DType` directly and this extension becomes a no-op shim.
*/
@Deprecated(
message = "LogicalDType merges into DType (SKEEP-003 decision #13); keep the DType itself.",
replaceWith = ReplaceWith("this"),
)
public fun DType.toLogicalDType(): LogicalDType = LogicalDType.fromDType(this)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down Expand Up @@ -63,6 +65,7 @@ public interface PackedBlockStorage {
/**
* Convert this packed storage to a [TensorStorage] descriptor.
*/
@Deprecated(message = "Use toTensorStorage(dtype, placement) (SKEEP-003 decision #13).", replaceWith = ReplaceWith("toTensorStorage(dtype, placement)"))
public fun toTensorStorage(
logicalType: LogicalDType = LogicalDType.FLOAT32,
placement: Placement = Placement.CPU_HEAP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand All @@ -10,6 +12,7 @@ import sk.ainet.lang.tensor.Shape
*/
public data class StorageMemoryReport(
val shape: Shape,
@Deprecated(message = "Use dtype (SKEEP-003 decision #13).", replaceWith = ReplaceWith("dtype"))
val logicalType: LogicalDType,
val encoding: TensorEncoding,
val ownership: Ownership,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // StorageSpec is itself deprecated and built on LogicalDType; both go at the next major

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.memory.AllocationSpec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // keeps the LogicalDType primary constructor working until the next major

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand All @@ -22,6 +24,10 @@ import sk.ainet.lang.types.DType
*/
public data class TensorStorage(
val shape: Shape,
@Deprecated(
message = "Use dtype (SKEEP-003 decision #13); the LogicalDType view stays until the next major.",
replaceWith = ReplaceWith("dtype"),
)
val logicalType: LogicalDType,
val encoding: TensorEncoding,
val buffer: BufferHandle,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // the LogicalDType overloads stay as delegating shims until the next major

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down Expand Up @@ -72,6 +74,7 @@ public object TensorStorageFactory {
* Create storage from raw bytes with explicit encoding.
* The byte array is borrowed (not copied).
*/
@Deprecated(message = "Use the DType overload (SKEEP-003 decision #13).", replaceWith = ReplaceWith("fromRawBytes(shape, dtype, encoding, …)"))
public fun fromRawBytes(
shape: Shape,
logicalType: LogicalDType,
Expand All @@ -98,6 +101,7 @@ public object TensorStorageFactory {
/**
* Create storage from raw bytes with explicit encoding (owned copy).
*/
@Deprecated(message = "Use the DType overload (SKEEP-003 decision #13).", replaceWith = ReplaceWith("fromRawBytesOwned(shape, dtype, encoding, …)"))
public fun fromRawBytesOwned(
shape: Shape,
logicalType: LogicalDType,
Expand All @@ -124,6 +128,7 @@ public object TensorStorageFactory {
/**
* Create file-backed storage (for memory-mapped model weights).
*/
@Deprecated(message = "Use the DType overload (SKEEP-003 decision #13).", replaceWith = ReplaceWith("fileBacked(shape, dtype, encoding, …)"))
public fun fileBacked(
shape: Shape,
logicalType: LogicalDType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import kotlin.test.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import kotlin.test.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down Expand Up @@ -25,7 +27,6 @@ import kotlin.test.assertSame
* SKEEP-003 Phase 0, decision #13: the two-way `LogicalDType` <-> `DType` bridge must be total
* and bijective so that `LogicalDType` can later be merged into `DType` without a semantic gap.
*/
@Suppress("DEPRECATION") // StorageSpec is exercised on purpose: the bridge must keep the legacy descriptor working
class LogicalDTypeBridgeTest {

private val expectedPairs: List<Pair<LogicalDType, DType>> = listOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.tensor.storage

import sk.ainet.lang.tensor.Shape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // LogicalDType legacy path kept under test until removal (SKEEP-003 #1014)

package sk.ainet.lang.types

import sk.ainet.lang.tensor.storage.LogicalDType
Expand Down
Loading