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
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ include("skainet-compile:skainet-compile-hlo")
include("skainet-compile:skainet-compile-c")

// ====== BACKENDS
include("skainet-backends:skainet-backend-api")
include("skainet-backends:skainet-backend-cpu")

// ====== BENCHMARKS
Expand Down
99 changes: 99 additions & 0 deletions skainet-backends/skainet-backend-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidMultiplatformLibrary)
id("sk.ainet.dokka")
}

kotlin {
explicitApi()
android {
namespace = "sk.ainet.backend.api"
compileSdk = libs.versions.android.compileSdk.get().toInt()
minSdk = libs.versions.android.minSdk.get().toInt()
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

iosArm64()
iosSimulatorArm64()
macosArm64()
linuxX64()
linuxArm64()

jvm()

js {
browser()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}

@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
}

sourceSets {
commonMain.dependencies {
// Neutral backend API is an `api` re-export of the tensor op and
// storage interfaces already defined in skainet-lang-core. Any
// concrete backend (CPU, IREE, Metal, NPU, ...) should depend on
// this module instead of pulling in skainet-backend-cpu just to
// reach TensorOps / TensorDataFactory / TensorData.
api(project(":skainet-lang:skainet-lang-core"))
}

val jvmMain by getting
val androidMain by getting
val wasmJsMain by getting

val commonMain by getting

val nativeMain by creating {
dependsOn(commonMain)
}

val appleMain by creating {
dependsOn(nativeMain)
}

val linuxMain by creating {
dependsOn(nativeMain)
}

val iosMain by creating {
dependsOn(appleMain)
}

val macosMain by creating {
dependsOn(appleMain)
}

val iosArm64Main by getting {
dependsOn(iosMain)
}

val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}

val macosArm64Main by getting {
dependsOn(macosMain)
}

val linuxX64Main by getting {
dependsOn(linuxMain)
}

val linuxArm64Main by getting {
dependsOn(linuxMain)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package sk.ainet.backend.api

/**
* Marker for the backend-neutral API surface of SKaiNET.
*
* This module owns no implementation of its own. It `api`-re-exports the
* tensor op and storage interfaces that already live in `skainet-lang-core`
* (notably `TensorOps`, `TensorDataFactory`, `TensorData` and friends), so
* that concrete backends — `skainet-backend-cpu` today, and future IREE /
* Metal / NPU backends — can depend on a single neutral module instead of
* pulling in the CPU backend just to reach the interfaces they implement.
*
* Consumer migration from `skainet-backend-cpu` to this module is handled
* in follow-up PRs in the P0-2 track and is intentionally out of scope for
* the first change that introduces the module.
*/
public object BackendApi
3 changes: 3 additions & 0 deletions skainet-backends/skainet-backend-cpu/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ kotlin {

sourceSets {
commonMain.dependencies {
// Every concrete backend should go through the neutral api
// module; it transitively brings in skainet-lang-core.
implementation(project(":skainet-backends:skainet-backend-api"))
implementation(project(":skainet-lang:skainet-lang-core"))
implementation(project(":skainet-compile:skainet-compile-core"))
implementation(project(":skainet-lang:skainet-lang-ksp-annotations"))
Expand Down
Loading