mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-02 22:30:41 +00:00
zoc: Refactoring and fix build
This commit is contained in:
parent
63b7858720
commit
8e3a15ec3b
2 changed files with 6 additions and 8 deletions
|
@ -23,7 +23,7 @@ members = [
|
||||||
"zoc",
|
"zoc",
|
||||||
]
|
]
|
||||||
|
|
||||||
default-members = ["zluda", "zluda_ml", "zluda_inject", "zluda_redirect"]
|
default-members = ["zluda", "zluda_ml", "zluda_inject", "zluda_redirect", "zoc"]
|
||||||
|
|
||||||
[profile.release-lto]
|
[profile.release-lto]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::error::Error;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::mem;
|
use std::mem::MaybeUninit;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
|
@ -54,12 +54,10 @@ fn ptx_to_llvm(ptx: &str) -> Result<LLVMArtifacts, Box<dyn Error>> {
|
||||||
|
|
||||||
fn llvm_to_elf(module: &LLVMArtifacts) -> Result<Vec<u8>, ElfError> {
|
fn llvm_to_elf(module: &LLVMArtifacts) -> Result<Vec<u8>, ElfError> {
|
||||||
use hip_runtime_sys::*;
|
use hip_runtime_sys::*;
|
||||||
unsafe { hipInit(0) }?;
|
let mut dev_props: MaybeUninit<hipDeviceProp_tR0600> = MaybeUninit::uninit();
|
||||||
let dev = 0;
|
unsafe { hipGetDevicePropertiesR0600(dev_props.as_mut_ptr(), 0) }?;
|
||||||
let mut stream = unsafe { mem::zeroed() };
|
let dev_props = unsafe { dev_props.assume_init() };
|
||||||
unsafe { hipStreamCreate(&mut stream) }?;
|
|
||||||
let mut dev_props = unsafe { mem::zeroed() };
|
|
||||||
unsafe { hipGetDevicePropertiesR0600(&mut dev_props, dev) }?;
|
|
||||||
comgr::compile_bitcode(
|
comgr::compile_bitcode(
|
||||||
unsafe { CStr::from_ptr(dev_props.gcnArchName.as_ptr()) },
|
unsafe { CStr::from_ptr(dev_props.gcnArchName.as_ptr()) },
|
||||||
&module.bitcode,
|
&module.bitcode,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue