Skip to content

Commit a86a8ef

Browse files
committed
Separate build modules for compiler and web
1 parent 2d13a23 commit a86a8ef

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ WORKDIR /work
66
COPY mill build.sc ./
77
ADD common ./common
88
ADD tools ./tools
9+
ADD compiler ./compiler
10+
ADD emulator ./emulator
911
ADD rtl ./rtl
1012

1113
RUN ls -la
12-
RUN ./mill '{rtl,tools,emulator}.assembly'
14+
RUN ./mill '{rtl,compiler,emulator}.assembly'
1315

1416
FROM azul/zulu-openjdk:11 as models
1517

@@ -31,7 +33,7 @@ COPY ./arch/* /demo/arch/
3133

3234
RUN mkdir -p /opt/tensil
3335
COPY --from=build /work/out/rtl/assembly.dest/out.jar /opt/tensil/rtl.jar
34-
COPY --from=build /work/out/tools/assembly.dest/out.jar /opt/tensil/compiler.jar
36+
COPY --from=build /work/out/compiler/assembly.dest/out.jar /opt/tensil/compiler.jar
3537
COPY --from=build /work/out/emulator/assembly.dest/out.jar /opt/tensil/emulator.jar
3638

3739
COPY ./docker/bin/* /usr/bin/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ rm main.tar.gz
105105
### Run compiler from source code
106106

107107
```
108-
./mill tools.run -a ./arch/pynqz1.tarch -m ./models/resnet20v2_cifar.onnx -o "Identity:0" -s true
108+
./mill compiler.run -a ./arch/pynqz1.tarch -m ./models/resnet20v2_cifar.onnx -o "Identity:0" -s true
109109
```
110110

111111
### Run emulator from source code

build.sc

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,44 @@ object tools extends ScalaPBModule { m =>
3131
def scalaVersion = common.scalaVersion
3232
def scalaPBVersion = "0.11.6"
3333

34-
def mainClass = Some("tensil.tools.Main")
35-
36-
override def ivyDeps =
37-
common.ivyDeps() ++ super.ivyDeps() ++ Agg(
38-
ivy"com.github.seratch::awscala-s3:0.8.5",
39-
ivy"com.github.seratch::awscala-sqs:0.8.5",
40-
ivy"com.github.seratch::awscala-dynamodb:0.8.5",
41-
)
42-
4334
object test extends Tests with TestModule.ScalaTest {
4435
def forkArgs = Seq("-Xmx12g", "-Xmx12g")
4536

4637
def ivyDeps = m.ivyDeps() ++ Agg(ivy"org.scalatest::scalatest:3.0.4")
4738
}
4839
}
4940

41+
object compiler extends ScalaModule { m =>
42+
def moduleDeps = Seq(tools)
43+
44+
def scalaVersion = tools.scalaVersion
45+
46+
def mainClass = Some("tensil.tools.compiler.Main")
47+
}
48+
5049
object emulator extends ScalaModule { m =>
5150
def moduleDeps = Seq(tools)
5251

53-
def scalaVersion = tools.scalaVersion
52+
def scalaVersion = tools.scalaVersion
5453

5554
def mainClass = Some("tensil.tools.emulator.Main")
5655
}
5756

57+
object web extends ScalaModule { m =>
58+
def moduleDeps = Seq(tools)
59+
60+
def scalaVersion = tools.scalaVersion
61+
62+
override def ivyDeps =
63+
tools.ivyDeps() ++ super.ivyDeps() ++ Agg(
64+
ivy"com.github.seratch::awscala-s3:0.8.5",
65+
ivy"com.github.seratch::awscala-sqs:0.8.5",
66+
ivy"com.github.seratch::awscala-dynamodb:0.8.5",
67+
)
68+
69+
def mainClass = Some("tensil.tools.web.Main")
70+
}
71+
5872
object rtl extends SbtModule { m =>
5973
def moduleDeps = Seq(common)
6074

tools/src/tensil/tools/Main.scala renamed to compiler/src/tensil/tools/compiler/Main.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* SPDX-License-Identifier: Apache-2.0 */
22
/* Copyright © 2019-2022 Tensil AI Company */
33

4-
package tensil.tools
4+
package tensil.tools.compiler
55

66
import java.io.{DataOutputStream, FileOutputStream}
77
import tensil.{Architecture, ArchitectureDataType, InstructionLayout}
8+
import tensil.tools.{Compiler, CompilerOptions, CompilerInputShapes}
89

910
import java.io.File
1011
import tensil.TablePrinter

tools/src/tensil/tools/web/CompilerTask.scala renamed to web/src/tensil/tools/web/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ object CompilerTask {
239239
}
240240
}
241241

242-
object CompilerApp extends App {
242+
object Main extends App {
243243
// Number of tasks to be configured from container environment
244244
CompilerTask.process(1)
245245
}

0 commit comments

Comments
 (0)