mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-09-20 00:09:00 +00:00
Take path to llvm-spirv from environment
This commit is contained in:
parent
fefdd528d5
commit
3070d983ab
1 changed files with 6 additions and 1 deletions
|
@ -148,11 +148,16 @@ impl SpirvModule {
|
||||||
spirv_il: &[u8],
|
spirv_il: &[u8],
|
||||||
ptx_lib: Option<(&'static [u8], &'static [u8])>,
|
ptx_lib: Option<(&'static [u8], &'static [u8])>,
|
||||||
) -> io::Result<Vec<u8>> {
|
) -> io::Result<Vec<u8>> {
|
||||||
|
use std::env;
|
||||||
let dir = tempfile::tempdir()?;
|
let dir = tempfile::tempdir()?;
|
||||||
let mut spirv = NamedTempFile::new_in(&dir)?;
|
let mut spirv = NamedTempFile::new_in(&dir)?;
|
||||||
let llvm = NamedTempFile::new_in(&dir)?;
|
let llvm = NamedTempFile::new_in(&dir)?;
|
||||||
spirv.write_all(spirv_il)?;
|
spirv.write_all(spirv_il)?;
|
||||||
let to_llvm_cmd = Command::new(Self::LLVM_SPIRV)
|
let llvm_spirv_path = match env::var("LLVM_SPIRV") {
|
||||||
|
Ok(path) => Cow::Owned(path),
|
||||||
|
Err(_) => Cow::Borrowed(Self::LLVM_SPIRV),
|
||||||
|
};
|
||||||
|
let to_llvm_cmd = Command::new(&*llvm_spirv_path)
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg(llvm.path())
|
.arg(llvm.path())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue