Skip to content

Commit acbf6a9

Browse files
committed
Update TypeTree tests to verify metadata attachment
- Fix nott-flag test to emit LLVM IR and check enzyme_type attributes - Replace TODO comments with actual TypeTree metadata verification - Test that NoTT flag properly disables TypeTree generation - Test that TypeTree enabled generates proper enzyme_type attributes Signed-off-by: Karan Janthe <[email protected]>
1 parent 2a5d52a commit acbf6a9

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
// TODO(KMJ-007): Update this test when TypeTree integration is complete
2-
// CHECK: square - {[-1]:Float@double} |{[-1]:Pointer}:{}
3-
// CHECK: ptr %{{[0-9]+}}: {[-1]:Pointer, [-1,0]:Float@double}
1+
// Check that enzyme_type attributes are NOT present when NoTT flag is used
2+
// This verifies the NoTT flag correctly disables TypeTree metadata
3+
4+
CHECK: define{{.*}}@square
5+
CHECK-NOT: "enzyme_type"

tests/run-make/autodiff/type-trees/nott-flag/rmake.rs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,32 @@ use run_make_support::{llvm_filecheck, rfs, rustc};
55

66
fn main() {
77
// Test with NoTT flag - should not generate TypeTree metadata
8-
let output_nott = rustc()
8+
rustc()
99
.input("test.rs")
10-
.arg("-Zautodiff=Enable,NoTT,PrintTAFn=square")
11-
.arg("-Zautodiff=NoPostopt")
12-
.opt_level("3")
13-
.arg("-Clto=fat")
14-
.arg("-g")
10+
.arg("-Zautodiff=Enable,NoTT")
11+
.emit("llvm-ir")
12+
.arg("-o")
13+
.arg("nott.ll")
1514
.run();
1615

17-
// Write output for NoTT case
18-
rfs::write("nott.stdout", output_nott.stdout_utf8());
19-
2016
// Test without NoTT flag - should generate TypeTree metadata
21-
let output_with_tt = rustc()
17+
rustc()
2218
.input("test.rs")
23-
.arg("-Zautodiff=Enable,PrintTAFn=square")
24-
.arg("-Zautodiff=NoPostopt")
25-
.opt_level("3")
26-
.arg("-Clto=fat")
27-
.arg("-g")
19+
.arg("-Zautodiff=Enable")
20+
.emit("llvm-ir")
21+
.arg("-o")
22+
.arg("with_tt.ll")
2823
.run();
2924

30-
// Write output for TypeTree case
31-
rfs::write("with_tt.stdout", output_with_tt.stdout_utf8());
32-
33-
// Verify NoTT output has minimal TypeTree info
34-
llvm_filecheck().patterns("nott.check").stdin_buf(rfs::read("nott.stdout")).run();
25+
// Verify NoTT version does NOT have enzyme_type attributes
26+
llvm_filecheck()
27+
.patterns("nott.check")
28+
.stdin_buf(rfs::read("nott.ll"))
29+
.run();
3530

36-
// Verify normal output will have TypeTree info (once implemented)
37-
llvm_filecheck().patterns("with_tt.check").stdin_buf(rfs::read("with_tt.stdout")).run();
31+
// Verify TypeTree version DOES have enzyme_type attributes
32+
llvm_filecheck()
33+
.patterns("with_tt.check")
34+
.stdin_buf(rfs::read("with_tt.ll"))
35+
.run();
3836
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
// TODO(KMJ-007): Update this test when TypeTree integration is complete
2-
// CHECK: square - {[-1]:Float@double} |{[-1]:Pointer}:{}
3-
// CHECK: ptr %{{[0-9]+}}: {[-1]:Pointer, [-1,0]:Float@double}
1+
// Check that enzyme_type attributes are present when TypeTree is enabled
2+
// This verifies our TypeTree metadata attachment is working
3+
4+
CHECK: define{{.*}}"enzyme_type"="{[]:Float@double}"{{.*}}@square{{.*}}"enzyme_type"="{[]:Pointer}"

0 commit comments

Comments
 (0)