@@ -8,6 +8,7 @@ mod intrinsic;
8
8
mod json_parser;
9
9
mod types;
10
10
11
+ use crate :: arm:: compile:: compile_c_arm;
11
12
use crate :: common:: SupportedArchitectureTest ;
12
13
use crate :: common:: cli:: ProcessedCli ;
13
14
use crate :: common:: compare:: compare_outputs;
@@ -54,7 +55,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
54
55
}
55
56
56
57
fn build_c_file ( & self ) -> bool {
57
- let compiler = self . cli_options . cpp_compiler . as_deref ( ) ;
58
+ let compiler = self . cli_options . cpp_compiler . as_deref ( ) . unwrap ( ) ;
58
59
let target = & self . cli_options . target ;
59
60
let cxx_toolchain_dir = self . cli_options . cxx_toolchain_dir . as_deref ( ) ;
60
61
let c_target = "aarch64" ;
@@ -69,36 +70,24 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
69
70
. map ( |( i, chunk) | {
70
71
let c_filename = format ! ( "c_programs/mod_{i}.cpp" ) ;
71
72
let mut file = File :: create ( & c_filename) . unwrap ( ) ;
72
- write_mod_cpp ( & mut file, & notice, chunk) . unwrap ( ) ;
73
+ write_mod_cpp ( & mut file, notice, c_target , chunk) . unwrap ( ) ;
73
74
74
75
// compile this cpp file into a .o file
75
76
76
- // clang++ -march=armv8.6-a+crypto+crc+dotprod+fp16+faminmax+lut+sha3 -O2 -ffp-contract=off -Wno-narrowing --target=aarch64-unknown-linux-gnu c_file_0.c -c
77
- let mut cmd = std:: process:: Command :: new ( "clang++" ) ;
78
- cmd. current_dir ( "c_programs" ) ;
79
-
80
- cmd. arg ( "-march=armv8.6-a+crypto+crc+dotprod+fp16+faminmax+lut+sha3" ) ;
81
- cmd. arg ( "-O2" ) ;
82
- cmd. arg ( "-ffp-contract=off" ) ;
83
- cmd. arg ( "-Wno-narrowing" ) ;
84
- cmd. arg ( "--target=aarch64-unknown-linux-gnu" ) ;
85
- cmd. arg ( "-c" ) ;
86
- cmd. arg ( format ! ( "mod_{i}.cpp" ) ) ;
87
-
88
- let output = cmd. output ( ) ;
89
- eprintln ! (
90
- "{}" ,
91
- String :: from_utf8_lossy( & output. as_ref( ) . unwrap( ) . stderr)
77
+ compile_c_arm (
78
+ compiler,
79
+ target,
80
+ cxx_toolchain_dir,
81
+ & [ format ! ( "mod_{i}.cpp" ) ] ,
82
+ Some ( & format ! ( "mod_{i}.o" ) ) ,
92
83
) ;
93
- assert ! ( output. unwrap( ) . status. success( ) ) ;
94
84
95
85
Ok ( ( ) )
96
86
} )
97
87
. collect :: < Result < ( ) , std:: io:: Error > > ( )
98
88
. unwrap ( ) ;
99
89
100
- let c_filename = format ! ( "c_programs/main.cpp" ) ;
101
- let mut file = File :: create ( & c_filename) . unwrap ( ) ;
90
+ let mut file = File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
102
91
write_main_cpp (
103
92
& mut file,
104
93
c_target,
@@ -107,38 +96,18 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
107
96
)
108
97
. unwrap ( ) ;
109
98
110
- let mut cmd = std:: process:: Command :: new ( "clang++" ) ;
111
- cmd. current_dir ( "c_programs" ) ;
112
-
113
- cmd. arg ( "-march=armv8.6-a+crypto+crc+dotprod+fp16+faminmax+lut+sha3" ) ;
114
- cmd. arg ( "-O2" ) ;
115
- cmd. arg ( "-ffp-contract=off" ) ;
116
- cmd. arg ( "-Wno-narrowing" ) ;
117
- cmd. arg ( "--target=aarch64-unknown-linux-gnu" ) ;
118
- cmd. arg ( format ! ( "main.cpp" ) ) ;
99
+ let mut inputs = vec ! [ format!( "main.cpp" ) ] ;
119
100
for i in 0 ..Ord :: min ( available_parallelism, self . intrinsics . len ( ) ) {
120
- cmd . arg ( format ! ( "mod_{i}.o" ) ) ;
101
+ inputs . push ( format ! ( "mod_{i}.o" ) ) ;
121
102
}
122
- cmd. args ( & [ "-o" , "intrinsic-test-programs" ] ) ;
123
103
124
- let output = cmd. output ( ) ;
125
- eprintln ! (
126
- "{}" ,
127
- String :: from_utf8_lossy( & output. as_ref( ) . unwrap( ) . stderr)
128
- ) ;
129
- assert ! ( output. unwrap( ) . status. success( ) ) ;
130
-
131
- // match compiler {
132
- // None => true,
133
- // Some(compiler) => compile_c_arm(
134
- // intrinsics_name_list.unwrap().as_slice(),
135
- // compiler,
136
- // target,
137
- // cxx_toolchain_dir,
138
- // ),
139
- // }
140
-
141
- true
104
+ compile_c_arm (
105
+ compiler,
106
+ target,
107
+ cxx_toolchain_dir,
108
+ & inputs,
109
+ Some ( "intrinsic-test-programs" ) ,
110
+ )
142
111
}
143
112
144
113
fn build_rust_file ( & self ) -> bool {
@@ -171,14 +140,23 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
171
140
let toolchain = self . cli_options . toolchain . as_deref ( ) ;
172
141
let linker = self . cli_options . linker . as_deref ( ) ;
173
142
143
+ warn ! (
144
+ "available parallelism: {:?} {}" ,
145
+ std:: thread:: available_parallelism( ) ,
146
+ rayon:: current_num_threads( ) ,
147
+ ) ;
148
+
174
149
let notice = & build_notices ( "// " ) ;
175
150
self . intrinsics
176
151
. par_chunks ( chunk_size)
177
152
. enumerate ( )
178
153
. map ( |( i, chunk) | {
179
154
use std:: io:: Write ;
180
155
156
+ dbg ! ( chunk_size, chunk. len( ) ) ;
157
+
181
158
let rust_filename = format ! ( "rust_programs/src/mod_{i}.rs" ) ;
159
+ trace ! ( "generating `{rust_filename}`" ) ;
182
160
let mut file = File :: create ( rust_filename) . unwrap ( ) ;
183
161
184
162
write ! ( file, "{notice}" ) ?;
0 commit comments