Torchscript
This commit is contained in:
parent
3d8390a130
commit
7ee7daa1ab
0
kmath-torchscript/example/build.gradle.kts
Normal file
0
kmath-torchscript/example/build.gradle.kts
Normal file
12
kmath-torchscript/plugin/build.gradle.kts
Normal file
12
kmath-torchscript/plugin/build.gradle.kts
Normal file
@ -0,0 +1,12 @@
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.project")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
maven("https://maven.google.com")
|
||||
maven("https://plugins.gradle.org/m2/")
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("ru.mipt.npm.gradle.common")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(kotlin("compiler-embeddable"))
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2018-2021 KMath contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package space.kscience.kmath.torchscript.compiler
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.com.intellij.mock.MockProject
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
|
||||
public class TorchscriptPluginComponentRegistrar : ComponentRegistrar {
|
||||
public override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration): Unit =
|
||||
registerExtensions(project)
|
||||
|
||||
private companion object {
|
||||
private fun registerExtensions(project: MockProject) {
|
||||
IrGenerationExtension.registerExtension(project, TorchscriptExtension)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object TorchscriptExtension : IrGenerationExtension {
|
||||
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
|
||||
TODO()
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2018-2021 KMath contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package space.kscience.kmath.torchscript.compiler.resolve
|
||||
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
public object TorchscriptAnnotations {
|
||||
public val moduleAnnotationFqName: FqName = FqName("space.kscience.kmath.torchscript.Module")
|
||||
public val intrinsicAnnotationFqName: FqName = FqName("space.kscience.kmath.torchscript.Intrinsic")
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
#
|
||||
# Copyright 2018-2021 KMath contributors.
|
||||
# Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
#
|
||||
|
||||
space.kscience.kmath.torchscript.compiler.TorchscriptPluginComponentRegistrar
|
19
kmath-torchscript/plugin/gradle-plugin/build.gradle.kts
Normal file
19
kmath-torchscript/plugin/gradle-plugin/build.gradle.kts
Normal file
@ -0,0 +1,19 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.google.auto.service:auto-service-annotations:1.0")
|
||||
compileOnly(kotlin("gradle-plugin"))
|
||||
kapt("com.google.auto.service:auto-service:1.0")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
val kmathTorchScriptPlugin by plugins.registering {
|
||||
id = "space.kscience.kmath.torchscript.torchscript-compiler-plugin"
|
||||
implementationClass = "space.kscience.kmath.torchscript.gradle.TorchScriptKotlinGradleSubplugin"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2018-2021 KMath contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package space.kscience.kmath.torchscript.gradle
|
||||
|
||||
class TorchScriptKotlinGradleSubplugin {
|
||||
}
|
19
kmath-torchscript/plugin/settings.gradle.kts
Normal file
19
kmath-torchscript/plugin/settings.gradle.kts
Normal file
@ -0,0 +1,19 @@
|
||||
rootProject.name = "plugin"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven("https://repo.kotlin.link")
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
val toolsVersion = "0.10.0"
|
||||
|
||||
plugins {
|
||||
id("ru.mipt.npm.gradle.project") version toolsVersion
|
||||
id("ru.mipt.npm.gradle.mpp") version toolsVersion
|
||||
id("ru.mipt.npm.gradle.jvm") version toolsVersion
|
||||
}
|
||||
}
|
||||
|
||||
include(":compiler-plugin", ":gradle-plugin")
|
5
kmath-torchscript/runtime/build.gradle.kts
Normal file
5
kmath-torchscript/runtime/build.gradle.kts
Normal file
@ -0,0 +1,5 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("ru.mipt.npm.gradle.common")
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2018-2021 KMath contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package space.kscience.kmath.torchscript
|
||||
|
||||
public annotation class Module
|
||||
|
||||
public annotation class Intrinsic
|
@ -47,6 +47,10 @@ include(
|
||||
":benchmarks",
|
||||
)
|
||||
|
||||
if(System.getProperty("os.name") == "Linux"){
|
||||
if (System.getProperty("os.name") == "Linux") {
|
||||
include(":kmath-torch")
|
||||
}
|
||||
include(":kmath-torchscript-library")
|
||||
include(":kmath-torchscript:example")
|
||||
include(":kmath-torchscript:runtime")
|
||||
includeBuild("kmath-torchscript/plugin")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user