@@ -939,34 +939,34 @@ impl Step for OmpOffload {
939939
940940 let out_dir = builder. llvm_out ( target) ;
941941 static STAMP_HASH_MEMO : OnceLock < String > = OnceLock :: new ( ) ;
942- // let smart_stamp_hash = STAMP_HASH_MEMO.get_or_init(|| {
943- // generate_smart_stamp_hash(
944- // builder,
945- // &builder.config.src.join("src/llvm-project/offload"),
946- // builder.offload_info.sha().unwrap_or_default(),
947- // )
948- // });
949- // let stamp = BuildStamp::new(&out_dir).with_prefix("enzyme ").add_stamp(smart_stamp_hash);
942+ let smart_stamp_hash = STAMP_HASH_MEMO . get_or_init ( || {
943+ generate_smart_stamp_hash (
944+ builder,
945+ & builder. config . src . join ( "src/llvm-project/offload" ) ,
946+ builder. offload_info . sha ( ) . unwrap_or_default ( ) ,
947+ )
948+ } ) ;
949+ let stamp = BuildStamp :: new ( & out_dir) . with_prefix ( "offload " ) . add_stamp ( smart_stamp_hash) ;
950950
951951 trace ! ( "checking build stamp to see if we need to rebuild offload/openmp artifacts" ) ;
952- // if stamp.is_up_to_date() {
953- // trace!(?out_dir, "offload/openmp build artifacts are up to date");
954- // if stamp.stamp().is_empty() {
955- // builder.info(
956- // "Could not determine the Offload submodule commit hash. \
957- // Assuming that an Offload rebuild is not necessary.",
958- // );
959- // builder.info(&format!(
960- // "To force Offload to rebuild, remove the file `{}`",
961- // stamp.path().display()
962- // ));
963- // }
964- // return out_dir;
965- // }
966-
967- trace ! ( ?target, "(re)building offload artifacts" ) ;
968- builder. info ( & format ! ( "Building Omp /Offload for {target}" ) ) ;
969- // t!(stamp.remove());
952+ if stamp. is_up_to_date ( ) {
953+ trace ! ( ?out_dir, "offload/openmp build artifacts are up to date" ) ;
954+ if stamp. stamp ( ) . is_empty ( ) {
955+ builder. info (
956+ "Could not determine the Offload submodule commit hash. \
957+ Assuming that an Offload rebuild is not necessary.",
958+ ) ;
959+ builder. info ( & format ! (
960+ "To force Offload/OpenMP to rebuild, remove the file `{}`" ,
961+ stamp. path( ) . display( )
962+ ) ) ;
963+ }
964+ return out_dir;
965+ }
966+
967+ trace ! ( ?target, "(re)building offload/openmp artifacts" ) ;
968+ builder. info ( & format ! ( "Building OpenMP /Offload for {target}" ) ) ;
969+ t ! ( stamp. remove( ) ) ;
970970 let _time = helpers:: timeit ( builder) ;
971971 t ! ( fs:: create_dir_all( & out_dir) ) ;
972972
@@ -984,6 +984,17 @@ impl Step for OmpOffload {
984984 } ;
985985 trace ! ( ?profile) ;
986986
987+ let cc = if let Some ( p) = & builder. build . config . llvm_offload_cc {
988+ p. clone ( )
989+ } else {
990+ builder. cc ( target)
991+ } ;
992+ let cxx = if let Some ( p) = & builder. build . config . llvm_offload_cxx {
993+ p. clone ( )
994+ } else {
995+ builder. cxx ( target) . unwrap ( )
996+ } ;
997+
987998 cfg. out_dir ( & out_dir)
988999 . profile ( profile)
9891000 . env ( "LLVM_CONFIG_REAL" , & host_llvm_config)
@@ -997,9 +1008,8 @@ impl Step for OmpOffload {
9971008 // "CMAKE_CXX_COMPILER",
9981009 // "/tmp/drehwald1/prog/rust/build/x86_64-unknown-linux-gnu/llvm/bin/clang++",
9991010 //)
1000- . define ( "CMAKE_C_COMPILER" , builder. cc ( target) )
1001- . define ( "CMAKE_CXX_COMPILER" , builder. cxx ( target) . unwrap ( ) )
1002- //.define("LLVM_DEFAULT_TARGET_TRIPLE", &target.triple)
1011+ . define ( "CMAKE_C_COMPILER" , cc)
1012+ . define ( "CMAKE_CXX_COMPILER" , cxx)
10031013 . define ( "OPENMP_STANDALONE_BUILD" , "ON" )
10041014 . define ( "LLVM_ROOT" , builder. llvm_out ( target) . join ( "build" ) )
10051015 //.define(
0 commit comments