Skip to content

Commit

Permalink
fix non-strict HIP device lib order
Browse files Browse the repository at this point in the history
  • Loading branch information
Snektron committed Jul 8, 2024
1 parent 9b5aa17 commit c3eb3c5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/compiler/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
device_libs.sort_unstable();
device_libs
})
.unwrap_or_default()
}
Expand Down Expand Up @@ -473,6 +476,8 @@ where
}
}

debug!("XXXX :: 1");

let result = compiler
.preprocess(
creator,
Expand Down Expand Up @@ -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,
Expand All @@ -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() {
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit c3eb3c5

Please sign in to comment.