Explicitly mark input to AMD as bitcode

This commit is contained in:
Andrzej Janik 2021-08-08 02:35:17 +02:00
commit 5969e59aae

View file

@ -196,6 +196,8 @@ impl SpirvModule {
.arg(Self::AMDGPU_TARGET) .arg(Self::AMDGPU_TARGET)
.arg("-o") .arg("-o")
.arg(compiled_binary.path()) .arg(compiled_binary.path())
.arg("-x")
.arg("ir")
.arg(linked_binary.path()); .arg(linked_binary.path());
if let Some((_, bitcode)) = ptx_lib { if let Some((_, bitcode)) = ptx_lib {
ptx_lib_bitcode.write_all(bitcode)?; ptx_lib_bitcode.write_all(bitcode)?;
@ -211,6 +213,7 @@ impl SpirvModule {
let mut compiled_binary = File::open(compiled_bin_path)?; let mut compiled_binary = File::open(compiled_bin_path)?;
compiled_binary.read_to_end(&mut result)?; compiled_binary.read_to_end(&mut result)?;
let mut persistent = PathBuf::from("/tmp/zluda"); let mut persistent = PathBuf::from("/tmp/zluda");
std::fs::create_dir_all(&persistent)?;
persistent.push(compiled_bin_path.file_name().unwrap()); persistent.push(compiled_bin_path.file_name().unwrap());
std::fs::copy(compiled_bin_path, persistent)?; std::fs::copy(compiled_bin_path, persistent)?;
Ok(result) Ok(result)
@ -300,6 +303,7 @@ impl SpirvModule {
assert_eq!(errcode_ret, 0, "clCreateProgramWithBinary"); assert_eq!(errcode_ret, 0, "clCreateProgramWithBinary");
unsafe { ocl_core::Program::from_raw_create_ptr(program) } unsafe { ocl_core::Program::from_raw_create_ptr(program) }
} else { } else {
Self::compile_amd("gfx1011:xnack-", byte_il, self.should_link_ptx_impl).unwrap();
Self::compile_intel( Self::compile_intel(
ctx, ctx,
dev, dev,