From c3eb3c538a4dd0cd9f59c5289d42d9b9e74a11d9 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Fri, 5 Jul 2024 15:28:57 +0200 Subject: [PATCH] fix non-strict HIP device lib order --- src/compiler/c.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/compiler/c.rs b/src/compiler/c.rs index 2badc6f714..7cc51b6e24 100644 --- a/src/compiler/c.rs +++ b/src/compiler/c.rs @@ -270,10 +270,13 @@ where .read_dir() .ok() .map(|f| { - f.flatten() + let mut device_libs = f + .flatten() .filter(|f| f.path().extension().map_or(false, |ext| ext == "bc")) .map(|f| f.path()) - .collect() + .collect::>(); + device_libs.sort_unstable(); + device_libs }) .unwrap_or_default() } @@ -473,6 +476,8 @@ where } } + debug!("XXXX :: 1"); + let result = compiler .preprocess( creator, @@ -559,6 +564,7 @@ where let mut common_and_arch_args = parsed_args.common_args.clone(); common_and_arch_args.extend(parsed_args.arch_args.to_vec()); + let key = { hash_key( &executable_digest, @@ -571,6 +577,8 @@ where ) }; + debug!("[{}]: extra_hash_files={:?}", key, parsed_args.extra_hash_files); + // Cache the preprocessing step if let Some(preprocessor_key) = preprocessor_key { if !include_files.is_empty() { @@ -1413,13 +1421,16 @@ pub fn hash_key( for (var, val) in env_vars.iter() { if CACHED_ENV_VARS.contains(var.as_os_str()) { + debug!("hash_key: adding env var {:?}={:?}", var, val); var.hash(&mut HashToDigest { digest: &mut m }); m.update(&b"="[..]); val.hash(&mut HashToDigest { digest: &mut m }); } } m.update(preprocessor_output); - m.finish() + let fnl = m.finish(); + debug!("[{}]: hash_key: compiler_digest={:?}, langauge={:?}, arguments={:?}, extra_hashes={:?}, plusplus={:?}", fnl, compiler_digest, language, arguments, extra_hashes, plusplus); + fnl } #[cfg(test)]