Skip to content

Commit 9781350

Browse files
committed
Begin extracting java metakernel machinery.
1 parent 98cb1e6 commit 9781350

File tree

19 files changed

+234
-214
lines changed

19 files changed

+234
-214
lines changed

pom.xml

+55
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,61 @@
541541
<groupId>com.diffplug.spotless</groupId>
542542
<artifactId>spotless-maven-plugin</artifactId>
543543
</plugin>
544+
545+
<plugin>
546+
<groupId>org.apache.maven.plugins</groupId>
547+
<artifactId>maven-compiler-plugin</artifactId>
548+
<version>${maven.compiler.plugin.version}</version>
549+
<configuration>
550+
<source>${maven.compiler.source}</source>
551+
<target>${maven.compiler.target}</target>
552+
<compilerArgs>
553+
<arg>-XDcompilePolicy=simple</arg>
554+
555+
<!-- For ErrorProne -->
556+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
557+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
558+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
559+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
560+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
561+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
562+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
563+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
564+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
565+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
566+
567+
<arg>-Xplugin:ErrorProne
568+
-XepDisableWarningsInGeneratedCode
569+
-XepExcludedPaths:.*/generated-sources/.*
570+
-Xep:AssertFalse:ERROR
571+
-Xep:CanIgnoreReturnValueSuggester:ERROR
572+
-Xep:ClassName:ERROR
573+
-Xep:DifferentNameButSame:ERROR
574+
-Xep:EmptyIf:ERROR
575+
-Xep:InconsistentOverloads:ERROR
576+
-Xep:LongLiteralLowerCaseSuffix:ERROR
577+
-Xep:MemberName:ERROR
578+
-Xep:MissingDefault:ERROR
579+
-Xep:RedundantOverride:ERROR
580+
-Xep:UnescapedEntity:ERROR
581+
-Xep:Varifier:ERROR
582+
-Xep:YodaCondition:ERROR
583+
</arg>
584+
</compilerArgs>
585+
<annotationProcessorPaths>
586+
<path>
587+
<groupId>org.projectlombok</groupId>
588+
<artifactId>lombok</artifactId>
589+
<version>${lombok.version}</version>
590+
</path>
591+
<path>
592+
<groupId>com.google.errorprone</groupId>
593+
<artifactId>error_prone_core</artifactId>
594+
<version>${error-prone.version}</version>
595+
</path>
596+
</annotationProcessorPaths>
597+
</configuration>
598+
</plugin>
544599
</plugins>
545600
</build>
546601

tensortapestry-common-testlib/pom.xml

-9
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,6 @@
5555
</dependency>
5656
</dependencies>
5757

58-
<build>
59-
<plugins>
60-
<plugin>
61-
<groupId>org.apache.maven.plugins</groupId>
62-
<artifactId>maven-compiler-plugin</artifactId>
63-
</plugin>
64-
</plugins>
65-
</build>
66-
6758
<reporting>
6859
<plugins>
6960
<plugin>

tensortapestry-common/pom.xml

-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@
1818
</dependency>
1919
</dependencies>
2020

21-
<build>
22-
<plugins>
23-
<plugin>
24-
<groupId>org.apache.maven.plugins</groupId>
25-
<artifactId>maven-compiler-plugin</artifactId>
26-
</plugin>
27-
</plugins>
28-
</build>
29-
3021
<reporting>
3122
<plugins>
3223
<plugin>

tensortapestry-loom/pom.xml

-9
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,6 @@
113113

114114
</dependencies>
115115

116-
<build>
117-
<plugins>
118-
<plugin>
119-
<groupId>org.apache.maven.plugins</groupId>
120-
<artifactId>maven-compiler-plugin</artifactId>
121-
</plugin>
122-
</plugins>
123-
</build>
124-
125116
<reporting>
126117
<plugins>
127118
<plugin>

tensortapestry-loom/src/main/java/org/tensortapestry/loom/graph/dialects/tensorops/ApplicationNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static Builder builder() {
8585
* @return a new Builder.
8686
*/
8787
@Nonnull
88-
public static Builder builder(LoomGraph graph) {
88+
public static Builder on(LoomGraph graph) {
8989
return new Builder().graph(graph);
9090
}
9191

tensortapestry-loom/src/main/java/org/tensortapestry/loom/graph/dialects/tensorops/OperationNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static Builder builder() {
6060
}
6161

6262
@Nonnull
63-
public static Builder builder(LoomGraph graph) {
63+
public static Builder on(LoomGraph graph) {
6464
return new Builder().graph(graph);
6565
}
6666

tensortapestry-loom/src/main/java/org/tensortapestry/loom/graph/dialects/tensorops/OperationUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public OperationNode applyFixedSignature(
8080
var ipfIndex = indexBuilder.apply(inputs);
8181

8282
var operation = OperationNode
83-
.builder(graph)
83+
.on(graph)
8484
.annotation(TensorOpNodes.IPF_SIGNATURE_ANNOTATION_TYPE, ipfSignature)
8585
.annotation(TensorOpNodes.IPF_INDEX_ANNOTATION_TYPE, ipfIndex)
8686
.body(b -> {
@@ -157,7 +157,7 @@ public ApplicationNode createIpfShard(OperationNode operation, ZRange shardIndex
157157
assert ipfIndex.contains(shardIndex);
158158

159159
return ApplicationNode
160-
.builder(operation.assertGraph())
160+
.on(operation.assertGraph())
161161
.annotation(TensorOpNodes.IPF_INDEX_ANNOTATION_TYPE, shardIndex)
162162
.body(b -> {
163163
b.operationId(operation.getId());

tensortapestry-loom/src/main/java/org/tensortapestry/loom/graph/dialects/tensorops/TensorNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static Builder builder() {
104104
}
105105

106106
@Nonnull
107-
public static Builder builder(LoomGraph graph) {
107+
public static Builder on(LoomGraph graph) {
108108
return new Builder().graph(graph);
109109
}
110110

tensortapestry-loom/src/test/java/org/tensortapestry/loom/graph/LoomTypeSchemaTest.java

+21-21
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,34 @@ public void test_validate() {
6262
)
6363
.jsonSchema(
6464
"""
65-
{
66-
"type": "object",
67-
"properties": {
68-
"inputs": {
69-
"type": "object",
70-
"patternProperties": {
71-
"^[a-zA-Z_][a-zA-Z0-9_]*$": {
72-
"type": "array",
73-
"items": {
74-
"type": "string",
75-
"format": "uuid"
76-
}
77-
}
78-
},
79-
"additionalProperties": false
65+
{
66+
"type": "object",
67+
"properties": {
68+
"inputs": {
69+
"type": "object",
70+
"patternProperties": {
71+
"^[a-zA-Z_][a-zA-Z0-9_]*$": {
72+
"type": "array",
73+
"items": {
74+
"type": "string",
75+
"format": "uuid"
76+
}
8077
}
81-
},
82-
"required": ["inputs"],
83-
"additionalProperties": false
84-
}
85-
"""
78+
},
79+
"additionalProperties": false
80+
}
81+
},
82+
"required": ["inputs"],
83+
"additionalProperties": false
84+
}
85+
"""
8686
)
8787
.build();
8888

8989
var env = CommonEnvironments.expressionEnvironment();
9090
var graph = env.newGraph();
9191
var note = NoteNode.builder(graph).body(b -> b.message("hello")).build();
92-
var tensor = TensorNode.builder(graph).body(b -> b.dtype("int32").shape(2)).build();
92+
var tensor = TensorNode.on(graph).body(b -> b.dtype("int32").shape(2)).build();
9393

9494
UUID missingId = UUID.randomUUID();
9595
String garbage = "garbage";

tensortapestry-loom/src/test/java/org/tensortapestry/loom/graph/dialects/tensorops/ApplicationNodeTest.java

+26-26
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,29 @@ public void test_body() {
2929
assertJsonEquals(
3030
body,
3131
"""
32-
{
33-
"operationId": "%s",
34-
"inputs": {
35-
"source": [
36-
{
37-
"tensorId": "%s",
38-
"range": {
39-
"start": [0, 0],
40-
"end": [2, 3]
41-
}
42-
},
43-
{
44-
"tensorId": "%s",
45-
"range": {
46-
"start": [],
47-
"end": []
48-
}
49-
}
50-
]
32+
{
33+
"operationId": "%s",
34+
"inputs": {
35+
"source": [
36+
{
37+
"tensorId": "%s",
38+
"range": {
39+
"start": [0, 0],
40+
"end": [2, 3]
41+
}
5142
},
52-
"outputs": {}
53-
}
54-
""".formatted(
43+
{
44+
"tensorId": "%s",
45+
"range": {
46+
"start": [],
47+
"end": []
48+
}
49+
}
50+
]
51+
},
52+
"outputs": {}
53+
}
54+
""".formatted(
5555
operationId,
5656
tensorIdA,
5757
tensorIdB
@@ -64,11 +64,11 @@ public void test_valid() {
6464
var env = CommonEnvironments.expressionEnvironment();
6565
var graph = env.newGraph();
6666

67-
var inputTensor = TensorNode.builder(graph).body(b -> b.shape(2, 3).dtype("float32")).build();
68-
var outputTensor = TensorNode.builder(graph).body(b -> b.shape(10).dtype("int32")).build();
67+
var inputTensor = TensorNode.on(graph).body(b -> b.shape(2, 3).dtype("float32")).build();
68+
var outputTensor = TensorNode.on(graph).body(b -> b.shape(10).dtype("int32")).build();
6969

7070
var operation = OperationNode
71-
.builder(graph)
71+
.on(graph)
7272
.body(b ->
7373
b
7474
.kernel("increment")
@@ -94,7 +94,7 @@ public void test_valid() {
9494
.build();
9595

9696
var application = ApplicationNode
97-
.builder(graph)
97+
.on(graph)
9898
.body(b ->
9999
b
100100
.operationId(UUID.randomUUID())

tensortapestry-loom/src/test/java/org/tensortapestry/loom/graph/dialects/tensorops/IPFSignatureAgreementConstraintTest.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@ public void test_valid_short() {
2323
var graph = env.newGraph();
2424

2525
var tensorA = TensorNode
26-
.builder(graph)
26+
.on(graph)
2727
.label("A")
2828
.body(b -> b.dtype("int32").range(ZRange.builder().start(-10, 4).shape(3, 4).build()))
2929
.build();
3030

31-
var tensorB = TensorNode
32-
.builder(graph)
33-
.label("B")
34-
.body(b -> b.dtype("int32").shape(4, 5))
35-
.build();
31+
var tensorB = TensorNode.on(graph).label("B").body(b -> b.dtype("int32").shape(4, 5)).build();
3632

3733
var op = OperationUtils.applyRelativeSignature(
3834
graph,

0 commit comments

Comments
 (0)