@@ -8,6 +8,7 @@ mod intrinsic;
88mod json_parser;
99mod types;
1010
11+ use crate :: arm:: compile:: compile_c_arm;
1112use crate :: common:: SupportedArchitectureTest ;
1213use crate :: common:: cli:: ProcessedCli ;
1314use crate :: common:: compare:: compare_outputs;
@@ -54,7 +55,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
5455 }
5556
5657 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 ( ) ;
5859 let target = & self . cli_options . target ;
5960 let cxx_toolchain_dir = self . cli_options . cxx_toolchain_dir . as_deref ( ) ;
6061 let c_target = "aarch64" ;
@@ -69,36 +70,24 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
6970 . map ( |( i, chunk) | {
7071 let c_filename = format ! ( "c_programs/mod_{i}.cpp" ) ;
7172 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 ( ) ;
7374
7475 // compile this cpp file into a .o file
7576
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" ) ) ,
9283 ) ;
93- assert ! ( output. unwrap( ) . status. success( ) ) ;
9484
9585 Ok ( ( ) )
9686 } )
9787 . collect :: < Result < ( ) , std:: io:: Error > > ( )
9888 . unwrap ( ) ;
9989
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 ( ) ;
10291 write_main_cpp (
10392 & mut file,
10493 c_target,
@@ -107,38 +96,18 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
10796 )
10897 . unwrap ( ) ;
10998
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" ) ] ;
119100 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" ) ) ;
121102 }
122- cmd. args ( & [ "-o" , "intrinsic-test-programs" ] ) ;
123103
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+ )
142111 }
143112
144113 fn build_rust_file ( & self ) -> bool {
@@ -171,14 +140,23 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
171140 let toolchain = self . cli_options . toolchain . as_deref ( ) ;
172141 let linker = self . cli_options . linker . as_deref ( ) ;
173142
143+ warn ! (
144+ "available parallelism: {:?} {}" ,
145+ std:: thread:: available_parallelism( ) ,
146+ rayon:: current_num_threads( ) ,
147+ ) ;
148+
174149 let notice = & build_notices ( "// " ) ;
175150 self . intrinsics
176151 . par_chunks ( chunk_size)
177152 . enumerate ( )
178153 . map ( |( i, chunk) | {
179154 use std:: io:: Write ;
180155
156+ dbg ! ( chunk_size, chunk. len( ) ) ;
157+
181158 let rust_filename = format ! ( "rust_programs/src/mod_{i}.rs" ) ;
159+ trace ! ( "generating `{rust_filename}`" ) ;
182160 let mut file = File :: create ( rust_filename) . unwrap ( ) ;
183161
184162 write ! ( file, "{notice}" ) ?;
0 commit comments