File tree Expand file tree Collapse file tree 15 files changed +154
-0
lines changed
tests/run-make/autodiff/type-trees/scalar-types Expand file tree Collapse file tree 15 files changed +154
-0
lines changed Original file line number Diff line number Diff line change 1+ ; Check that f128 TypeTree metadata is correctly generated
2+ ; f128 maps to Unknown in our current implementation since CConcreteType doesn't have DT_F128
3+
4+ CHECK: define{{.*}}"enzyme_type"={{.*}}@test_f128{{.*}}"enzyme_type"="{[]:Pointer}"
Original file line number Diff line number Diff line change 1+ //@ needs-enzyme
2+ //@ ignore-cross-compile
3+
4+ use run_make_support:: { llvm_filecheck, rfs, rustc} ;
5+
6+ fn main ( ) {
7+ // Compile with TypeTree enabled and emit LLVM IR
8+ rustc ( ) . input ( "test.rs" ) . arg ( "-Zautodiff=Enable" ) . emit ( "llvm-ir" ) . run ( ) ;
9+
10+ // Check that f128 TypeTree metadata is correctly generated
11+ llvm_filecheck ( ) . patterns ( "f128.check" ) . stdin_buf ( rfs:: read ( "test.ll" ) ) . run ( ) ;
12+ }
Original file line number Diff line number Diff line change 1+ #![ feature( autodiff, f128) ]
2+
3+ use std:: autodiff:: autodiff_reverse;
4+
5+ #[ autodiff_reverse( d_test, Duplicated , Active ) ]
6+ #[ no_mangle]
7+ fn test_f128 ( x : & f128 ) -> f128 {
8+ * x * * x
9+ }
10+
11+ fn main ( ) {
12+ let x = 2.0_f128 ;
13+ let mut dx = 0.0_f128 ;
14+ let _result = d_test ( & x, & mut dx, 1.0 ) ;
15+ }
Original file line number Diff line number Diff line change 1+ ; Check that f16 TypeTree metadata is correctly generated
2+ ; Should show Half for f16 values and Pointer for references
3+
4+ CHECK: define{{.*}}"enzyme_type"={{.*}}@test_f16{{.*}}"enzyme_type"="{[]:Pointer}"
Original file line number Diff line number Diff line change 1+ //@ needs-enzyme
2+ //@ ignore-cross-compile
3+
4+ use run_make_support:: { llvm_filecheck, rfs, rustc} ;
5+
6+ fn main ( ) {
7+ // Compile with TypeTree enabled and emit LLVM IR
8+ rustc ( ) . input ( "test.rs" ) . arg ( "-Zautodiff=Enable" ) . emit ( "llvm-ir" ) . run ( ) ;
9+
10+ // Check that f16 TypeTree metadata is correctly generated
11+ llvm_filecheck ( ) . patterns ( "f16.check" ) . stdin_buf ( rfs:: read ( "test.ll" ) ) . run ( ) ;
12+ }
Original file line number Diff line number Diff line change 1+ #![ feature( autodiff, f16) ]
2+
3+ use std:: autodiff:: autodiff_reverse;
4+
5+ #[ autodiff_reverse( d_test, Duplicated , Active ) ]
6+ #[ no_mangle]
7+ fn test_f16 ( x : & f16 ) -> f16 {
8+ * x * * x
9+ }
10+
11+ fn main ( ) {
12+ let x = 2.0_f16 ;
13+ let mut dx = 0.0_f16 ;
14+ let _result = d_test ( & x, & mut dx, 1.0 ) ;
15+ }
Original file line number Diff line number Diff line change 1+ ; Check that f32 TypeTree metadata is correctly generated
2+ ; Should show Float@float for f32 values and Pointer for references
3+
4+ CHECK: define{{.*}}"enzyme_type"="{[]:Float@float}"{{.*}}@test_f32{{.*}}"enzyme_type"="{[]:Pointer}"
Original file line number Diff line number Diff line change 1+ //@ needs-enzyme
2+ //@ ignore-cross-compile
3+
4+ use run_make_support:: { llvm_filecheck, rfs, rustc} ;
5+
6+ fn main ( ) {
7+ // Compile with TypeTree enabled and emit LLVM IR
8+ rustc ( ) . input ( "test.rs" ) . arg ( "-Zautodiff=Enable" ) . emit ( "llvm-ir" ) . run ( ) ;
9+
10+ // Check that f32 TypeTree metadata is correctly generated
11+ llvm_filecheck ( ) . patterns ( "f32.check" ) . stdin_buf ( rfs:: read ( "test.ll" ) ) . run ( ) ;
12+ }
Original file line number Diff line number Diff line change 1+ #![ feature( autodiff) ]
2+
3+ use std:: autodiff:: autodiff_reverse;
4+
5+ #[ autodiff_reverse( d_test, Duplicated , Active ) ]
6+ #[ no_mangle]
7+ fn test_f32 ( x : & f32 ) -> f32 {
8+ x * x
9+ }
10+
11+ fn main ( ) {
12+ let x = 2.0_f32 ;
13+ let mut dx = 0.0_f32 ;
14+ let _result = d_test ( & x, & mut dx, 1.0 ) ;
15+ }
Original file line number Diff line number Diff line change 1+ ; Check that f64 TypeTree metadata is correctly generated
2+ ; Should show Float@double for f64 values and Pointer for references
3+
4+ CHECK: define{{.*}}"enzyme_type"="{[]:Float@double}"{{.*}}@test_f64{{.*}}"enzyme_type"="{[]:Pointer}"
You can’t perform that action at this time.
0 commit comments