mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-02 14:19:57 +00:00
Start converting host code to HIP
This commit is contained in:
parent
9631a8d242
commit
4ae7feb93a
10 changed files with 5806 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
"detours-sys",
|
"detours-sys",
|
||||||
|
"hip_runtime-sys",
|
||||||
"level_zero-sys",
|
"level_zero-sys",
|
||||||
"level_zero",
|
"level_zero",
|
||||||
"spirv_tools-sys",
|
"spirv_tools-sys",
|
||||||
|
|
|
@ -77,6 +77,7 @@ If you are building on Linux you must also symlink (or rename) the ZLUDA output
|
||||||
```
|
```
|
||||||
ln -s libnvcuda.so target/release/libcuda.so
|
ln -s libnvcuda.so target/release/libcuda.so
|
||||||
ln -s libcuda.so target/release/libcuda.so.1
|
ln -s libcuda.so target/release/libcuda.so.1
|
||||||
|
ln -s libnvidia-ml.so target/release/libnvml.so
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
8
hip_runtime-sys/Cargo.toml
Normal file
8
hip_runtime-sys/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "hip_runtime-sys"
|
||||||
|
version = "0.0.0"
|
||||||
|
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||||
|
edition = "2018"
|
||||||
|
links = "amdhip"
|
||||||
|
|
||||||
|
[lib]
|
2
hip_runtime-sys/README
Normal file
2
hip_runtime-sys/README
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bindgen include/hip_runtime_api.h -o src/hip_runtime_api.rs --no-layout-tests --size_t-is-usize --default-enum-style=newtype --whitelist-function "hip.*" --whitelist-type "hip.*" -- -I/opt/rocm/include
|
||||||
|
sed -i 's/pub struct hipError_t/#[must_use]\npub struct hipError_t/g' src/hip_runtime_api.rs
|
7
hip_runtime-sys/build.rs
Normal file
7
hip_runtime-sys/build.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
use std::env::VarError;
|
||||||
|
|
||||||
|
fn main() -> Result<(), VarError> {
|
||||||
|
println!("cargo:rustc-link-lib=dylib=amdhip64");
|
||||||
|
println!("cargo:rustc-link-search=/opt/rocm/lib/");
|
||||||
|
Ok(())
|
||||||
|
}
|
2
hip_runtime-sys/include/hip_runtime_api.h
Normal file
2
hip_runtime-sys/include/hip_runtime_api.h
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#define __HIP_PLATFORM_HCC__
|
||||||
|
#include <hip/hip_runtime_api.h>
|
5780
hip_runtime-sys/src/hip_runtime_api.rs
Normal file
5780
hip_runtime-sys/src/hip_runtime_api.rs
Normal file
File diff suppressed because it is too large
Load diff
3
hip_runtime-sys/src/lib.rs
Normal file
3
hip_runtime-sys/src/lib.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#![allow(warnings)]
|
||||||
|
pub mod hip_runtime_api;
|
||||||
|
pub use hip_runtime_api::*;
|
|
@ -9,6 +9,7 @@ name = "zluda"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ptx = { path = "../ptx" }
|
ptx = { path = "../ptx" }
|
||||||
|
hip_runtime-sys = { path = "../hip_runtime-sys" }
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
num_enum = "0.4"
|
num_enum = "0.4"
|
||||||
lz4-sys = "1.9"
|
lz4-sys = "1.9"
|
||||||
|
|
|
@ -265,6 +265,7 @@ impl GlobalState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() -> Result<(), CUresult> {
|
pub fn init() -> Result<(), CUresult> {
|
||||||
|
eprintln!("{:?}", unsafe { hip_runtime_sys::hipInit(0) });
|
||||||
let mut global_state = GLOBAL_STATE
|
let mut global_state = GLOBAL_STATE
|
||||||
.lock()
|
.lock()
|
||||||
.map_err(|_| CUresult::CUDA_ERROR_UNKNOWN)?;
|
.map_err(|_| CUresult::CUDA_ERROR_UNKNOWN)?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue