diff options
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | ltrace.txt | 16 | ||||
-rw-r--r-- | ptx/lib/zluda_ptx_impl.cl (renamed from ptx/lib/notcuda_ptx_impl.cl) | 6 | ||||
-rw-r--r-- | ptx/lib/zluda_ptx_impl.spv (renamed from ptx/lib/notcuda_ptx_impl.spv) | bin | 49600 -> 49600 bytes | |||
-rw-r--r-- | ptx/src/test/spirv_run/assertfail.spvtxt | 2 | ||||
-rw-r--r-- | ptx/src/test/spirv_run/atom_inc.spvtxt | 4 | ||||
-rw-r--r-- | ptx/src/test/spirv_run/bfe.spvtxt | 2 | ||||
-rw-r--r-- | ptx/src/test/spirv_run/mod.rs | 6 | ||||
-rw-r--r-- | ptx/src/test/spirv_run/shl_link_hack.spvtxt | 2 | ||||
-rw-r--r-- | ptx/src/translate.rs | 10 | ||||
-rw-r--r-- | zluda/Cargo.toml (renamed from notcuda/Cargo.toml) | 4 | ||||
-rw-r--r-- | zluda/README (renamed from notcuda/README) | 0 | ||||
-rw-r--r-- | zluda/build.rs (renamed from notcuda/build.rs) | 0 | ||||
-rw-r--r-- | zluda/src/cuda.rs (renamed from notcuda/src/cuda.rs) | 0 | ||||
-rw-r--r-- | zluda/src/cuda_impl/mod.rs (renamed from notcuda/src/cuda_impl/mod.rs) | 0 | ||||
-rw-r--r-- | zluda/src/cuda_impl/rt.rs (renamed from notcuda/src/cuda_impl/rt.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/context.rs (renamed from notcuda/src/impl/context.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/device.rs (renamed from notcuda/src/impl/device.rs) | 2 | ||||
-rw-r--r-- | zluda/src/impl/export_table.rs (renamed from notcuda/src/impl/export_table.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/function.rs (renamed from notcuda/src/impl/function.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/memory.rs (renamed from notcuda/src/impl/memory.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/mod.rs (renamed from notcuda/src/impl/mod.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/module.rs (renamed from notcuda/src/impl/module.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/stream.rs (renamed from notcuda/src/impl/stream.rs) | 0 | ||||
-rw-r--r-- | zluda/src/impl/test.rs (renamed from notcuda/src/impl/test.rs) | 36 | ||||
-rw-r--r-- | zluda/src/lib.rs (renamed from notcuda/src/lib.rs) | 0 | ||||
-rw-r--r-- | zluda_inject/Cargo.toml (renamed from notcuda_inject/Cargo.toml) | 6 | ||||
-rw-r--r-- | zluda_inject/src/bin.rs (renamed from notcuda_inject/src/bin.rs) | 6 | ||||
-rw-r--r-- | zluda_inject/src/main.rs (renamed from notcuda_inject/src/main.rs) | 0 | ||||
-rw-r--r-- | zluda_inject/src/win.rs (renamed from notcuda_inject/src/win.rs) | 0 | ||||
-rw-r--r-- | zluda_redirect/Cargo.toml (renamed from notcuda_redirect/Cargo.toml) | 2 | ||||
-rw-r--r-- | zluda_redirect/src/lib.rs (renamed from notcuda_redirect/src/lib.rs) | 26 |
32 files changed, 76 insertions, 60 deletions
@@ -4,9 +4,9 @@ members = [ "level_zero-sys",
"level_zero",
"spirv_tools-sys",
- "notcuda",
- #"notcuda_inject",
- #"notcuda_redirect",
+ "zluda",
+ #"zluda_inject",
+ #"zluda_redirect",
"ptx",
]
diff --git a/ltrace.txt b/ltrace.txt new file mode 100644 index 0000000..a10aa76 --- /dev/null +++ b/ltrace.txt @@ -0,0 +1,16 @@ +LD_LIBRARY_PATH=/media/vosen/01D3D293C1C33E60/dev/ZLUDA/target/debug_run/ ltrace -x 'cu*@libcuda*' -L /home/vosen/cuda-samples-dbg/bin/x86_64/linux/debug/vectorAdd +LD_LIBRARY_PATH=/media/vosen/01D3D293C1C33E60/dev/ZLUDA/target/debug_run/ gdb /home/vosen/cuda-samples-dbg/bin/x86_64/linux/debug/vectorAdd + +/usr/local/cuda-11.0/bin/nvcc vectorAdd2.cu -I../../common/inc/ -lcudart -lcuda -o vectorAdd2 -g -O0 + +/usr/local/cuda-11.0/bin/fatbinary --create="vectorAdd_temp.fatbin" -64 "--image3=kind=ptx,sm=52,file=vectorAdd3.ptx" --compress false + +cd /home/vosen/cuda-samples-dbg/0_Simple/vectorAdd +/usr/local/cuda-11.0/bin/fatbinary --create vectorAdd_temp.fatbin -64 --image3 kind=ptx,sm=52,file=vectorAdd3.big.ptx --compress true + +LD_LIBRARY_PATH=/media/vosen/01D3D293C1C33E60/dev/ZLUDA/target/debug_run/ ./geekbench_x86_64 --no-upload --compute-list +LD_LIBRARY_PATH=/media/vosen/01D3D293C1C33E60/dev/ZLUDA/target/debug_run/ ./geekbench_x86_64 --no-upload --compute CUDA + +LD_LIBRARY_PATH=/media/vosen/01D3D293C1C33E60/dev/ZLUDA/target/debug_run/ ./geekbench_x86_64 --no-upload --compute OpenCL --compute-platform-id 1 + +LI_DumpBuffersForKernel=lens_blur_gpu CLI_DumpBuffersBeforeEnqueue=1 CLI_DumpBuffersAfterEnqueue=1 ~/opencl-intercept-layer/build/cliloader/cliloader -c ./geekbench_x86_64 --no-upload --compute OpenCL --compute-platform-id 1 &> log.txt diff --git a/ptx/lib/notcuda_ptx_impl.cl b/ptx/lib/zluda_ptx_impl.cl index c633ddc..94d02ec 100644 --- a/ptx/lib/notcuda_ptx_impl.cl +++ b/ptx/lib/zluda_ptx_impl.cl @@ -1,9 +1,9 @@ // Every time this file changes it must te rebuilt:
-// ocloc -file notcuda_ptx_impl.cl -64 -options "-cl-std=CL2.0 -Dcl_intel_bit_instructions" -out_dir . -device kbl -output_no_suffix -spv_only
+// ocloc -file zluda_ptx_impl.cl -64 -options "-cl-std=CL2.0 -Dcl_intel_bit_instructions" -out_dir . -device kbl -output_no_suffix -spv_only
// Additionally you should strip names:
-// spirv-opt --strip-debug notcuda_ptx_impl.spv -o notcuda_ptx_impl.spv
+// spirv-opt --strip-debug zluda_ptx_impl.spv -o zluda_ptx_impl.spv
-#define FUNC(NAME) __notcuda_ptx_impl__ ## NAME
+#define FUNC(NAME) __zluda_ptx_impl__ ## NAME
#define atomic_inc(NAME, SUCCESS, FAILURE, SCOPE, SPACE) \
uint FUNC(NAME)(SPACE uint* ptr, uint threshold) { \
diff --git a/ptx/lib/notcuda_ptx_impl.spv b/ptx/lib/zluda_ptx_impl.spv Binary files differindex aa30fb8..aa30fb8 100644 --- a/ptx/lib/notcuda_ptx_impl.spv +++ b/ptx/lib/zluda_ptx_impl.spv diff --git a/ptx/src/test/spirv_run/assertfail.spvtxt b/ptx/src/test/spirv_run/assertfail.spvtxt index 09f9abf..33cdb7f 100644 --- a/ptx/src/test/spirv_run/assertfail.spvtxt +++ b/ptx/src/test/spirv_run/assertfail.spvtxt @@ -10,7 +10,7 @@ %67 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %12 "assertfail" - OpDecorate %1 LinkageAttributes "__notcuda_ptx_impl____assertfail" Import + OpDecorate %1 LinkageAttributes "__zluda_ptx_impl____assertfail" Import %void = OpTypeVoid %ulong = OpTypeInt 64 0 %_ptr_Function_ulong = OpTypePointer Function %ulong diff --git a/ptx/src/test/spirv_run/atom_inc.spvtxt b/ptx/src/test/spirv_run/atom_inc.spvtxt index fda26c5..9469835 100644 --- a/ptx/src/test/spirv_run/atom_inc.spvtxt +++ b/ptx/src/test/spirv_run/atom_inc.spvtxt @@ -10,8 +10,8 @@ %47 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %1 "atom_inc" - OpDecorate %38 LinkageAttributes "__notcuda_ptx_impl__atom_relaxed_gpu_generic_inc" Import - OpDecorate %42 LinkageAttributes "__notcuda_ptx_impl__atom_relaxed_gpu_global_inc" Import + OpDecorate %38 LinkageAttributes "__zluda_ptx_impl__atom_relaxed_gpu_generic_inc" Import + OpDecorate %42 LinkageAttributes "__zluda_ptx_impl__atom_relaxed_gpu_global_inc" Import %void = OpTypeVoid %uint = OpTypeInt 32 0 %_ptr_Generic_uint = OpTypePointer Generic %uint diff --git a/ptx/src/test/spirv_run/bfe.spvtxt b/ptx/src/test/spirv_run/bfe.spvtxt index edcf138..5f9edad 100644 --- a/ptx/src/test/spirv_run/bfe.spvtxt +++ b/ptx/src/test/spirv_run/bfe.spvtxt @@ -10,7 +10,7 @@ %40 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %1 "bfe" - OpDecorate %34 LinkageAttributes "__notcuda_ptx_impl__bfe_u32" Import + OpDecorate %34 LinkageAttributes "__zluda_ptx_impl__bfe_u32" Import %void = OpTypeVoid %uint = OpTypeInt 32 0 %43 = OpTypeFunction %uint %uint %uint %uint diff --git a/ptx/src/test/spirv_run/mod.rs b/ptx/src/test/spirv_run/mod.rs index 3148120..86f9c16 100644 --- a/ptx/src/test/spirv_run/mod.rs +++ b/ptx/src/test/spirv_run/mod.rs @@ -170,9 +170,9 @@ fn test_ptx_assert<'a, T: From<u8> + ze::SafeRepr + Debug + Copy + PartialEq>( let mut errors = Vec::new();
let ast = ptx::ModuleParser::new().parse(&mut errors, ptx_text)?;
assert!(errors.len() == 0);
- let notcuda_module = translate::to_spirv_module(ast)?;
+ let zluda_module = translate::to_spirv_module(ast)?;
let name = CString::new(name)?;
- let result = run_spirv(name.as_c_str(), notcuda_module, input, output)
+ let result = run_spirv(name.as_c_str(), zluda_module, input, output)
.map_err(|err| DisplayError { err })?;
assert_eq!(result.as_slice(), output);
Ok(())
@@ -331,7 +331,7 @@ fn test_spvtxt_assert<'a>( } else {
Cow::Owned(spirv_module.spirv.disassemble())
};
- if let Ok(dump_path) = env::var("NOTCUDA_TEST_SPIRV_DUMP_DIR") {
+ if let Ok(dump_path) = env::var("ZLUDA_TEST_SPIRV_DUMP_DIR") {
let mut path = PathBuf::from(dump_path);
if let Ok(()) = fs::create_dir_all(&path) {
path.push(spirv_file_name);
diff --git a/ptx/src/test/spirv_run/shl_link_hack.spvtxt b/ptx/src/test/spirv_run/shl_link_hack.spvtxt index 0114a55..8656049 100644 --- a/ptx/src/test/spirv_run/shl_link_hack.spvtxt +++ b/ptx/src/test/spirv_run/shl_link_hack.spvtxt @@ -10,7 +10,7 @@ %34 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %1 "shl_link_hack" - OpDecorate %29 LinkageAttributes "__notcuda_ptx_impl__atom_relaxed_gpu_generic_inc" Import + OpDecorate %29 LinkageAttributes "__zluda_ptx_impl__atom_relaxed_gpu_generic_inc" Import %void = OpTypeVoid %uint = OpTypeInt 32 0 %_ptr_Generic_uint = OpTypePointer Generic %uint diff --git a/ptx/src/translate.rs b/ptx/src/translate.rs index 3133fdc..15211ab 100644 --- a/ptx/src/translate.rs +++ b/ptx/src/translate.rs @@ -9,7 +9,7 @@ use std::{ use rspirv::binary::Assemble;
-static NOTCUDA_PTX_IMPL: &'static [u8] = include_bytes!("../lib/notcuda_ptx_impl.spv");
+static ZLUDA_PTX_IMPL: &'static [u8] = include_bytes!("../lib/zluda_ptx_impl.spv");
quick_error! {
#[derive(Debug)]
@@ -506,7 +506,7 @@ pub fn to_spirv_module<'a>(ast: ast::Module<'a>) -> Result<Module, TranslateErro spirv,
kernel_info,
should_link_ptx_impl: if must_link_ptx_impl {
- Some(NOTCUDA_PTX_IMPL)
+ Some(ZLUDA_PTX_IMPL)
} else {
None
},
@@ -1226,7 +1226,7 @@ fn translate_function<'a>( ) -> Result<Option<Function<'a>>, TranslateError> {
let import_as = match &f.func_directive {
ast::MethodDecl::Func(_, "__assertfail", _) => {
- Some("__notcuda_ptx_impl____assertfail".to_owned())
+ Some("__zluda_ptx_impl____assertfail".to_owned())
}
_ => None,
};
@@ -1667,7 +1667,7 @@ fn to_ptx_impl_atomic_call( let scope = ptx_scope_name(details.scope);
let space = ptx_space_name(details.space);
let fn_name = format!(
- "__notcuda_ptx_impl__atom_{}_{}_{}_{}",
+ "__zluda_ptx_impl__atom_{}_{}_{}_{}",
semantics, scope, space, op
);
// TODO: extract to a function
@@ -1757,7 +1757,7 @@ fn to_ptx_impl_bfe_call( typ: ast::IntType,
arg: ast::Arg4<ExpandedArgParams>,
) -> ExpandedStatement {
- let prefix = "__notcuda_ptx_impl__";
+ let prefix = "__zluda_ptx_impl__";
let suffix = match typ {
ast::IntType::U32 => "bfe_u32",
ast::IntType::U64 => "bfe_u64",
diff --git a/notcuda/Cargo.toml b/zluda/Cargo.toml index 56ec4d6..218fe8f 100644 --- a/notcuda/Cargo.toml +++ b/zluda/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "notcuda" +name = "zluda" version = "0.0.0" authors = ["Andrzej Janik <[email protected]>"] edition = "2018" [lib] -name = "notcuda" +name = "zluda" crate-type = ["cdylib"] [dependencies] diff --git a/notcuda/README b/zluda/README index 089ddcd..089ddcd 100644 --- a/notcuda/README +++ b/zluda/README diff --git a/notcuda/build.rs b/zluda/build.rs index 3b8999f..3b8999f 100644 --- a/notcuda/build.rs +++ b/zluda/build.rs diff --git a/notcuda/src/cuda.rs b/zluda/src/cuda.rs index 2dc26f5..2dc26f5 100644 --- a/notcuda/src/cuda.rs +++ b/zluda/src/cuda.rs diff --git a/notcuda/src/cuda_impl/mod.rs b/zluda/src/cuda_impl/mod.rs index 63b9049..63b9049 100644 --- a/notcuda/src/cuda_impl/mod.rs +++ b/zluda/src/cuda_impl/mod.rs diff --git a/notcuda/src/cuda_impl/rt.rs b/zluda/src/cuda_impl/rt.rs index 3931bc3..3931bc3 100644 --- a/notcuda/src/cuda_impl/rt.rs +++ b/zluda/src/cuda_impl/rt.rs diff --git a/notcuda/src/impl/context.rs b/zluda/src/impl/context.rs index 873fc47..873fc47 100644 --- a/notcuda/src/impl/context.rs +++ b/zluda/src/impl/context.rs diff --git a/notcuda/src/impl/device.rs b/zluda/src/impl/device.rs index f277f0e..23b75f0 100644 --- a/notcuda/src/impl/device.rs +++ b/zluda/src/impl/device.rs @@ -8,7 +8,7 @@ use std::{ sync::atomic::{AtomicU32, Ordering}, }; -const PROJECT_URL_SUFFIX: &'static str = " [github.com/vosen/notCUDA]"; +const PROJECT_URL_SUFFIX: &'static str = " [github.com/vosen/ZLUDA]"; #[repr(transparent)] #[derive(Clone, Copy, Eq, PartialEq, Hash)] diff --git a/notcuda/src/impl/export_table.rs b/zluda/src/impl/export_table.rs index 87d7f40..87d7f40 100644 --- a/notcuda/src/impl/export_table.rs +++ b/zluda/src/impl/export_table.rs diff --git a/notcuda/src/impl/function.rs b/zluda/src/impl/function.rs index 27bf9b6..27bf9b6 100644 --- a/notcuda/src/impl/function.rs +++ b/zluda/src/impl/function.rs diff --git a/notcuda/src/impl/memory.rs b/zluda/src/impl/memory.rs index f33a08c..f33a08c 100644 --- a/notcuda/src/impl/memory.rs +++ b/zluda/src/impl/memory.rs diff --git a/notcuda/src/impl/mod.rs b/zluda/src/impl/mod.rs index 086d260..086d260 100644 --- a/notcuda/src/impl/mod.rs +++ b/zluda/src/impl/mod.rs diff --git a/notcuda/src/impl/module.rs b/zluda/src/impl/module.rs index cba030e..cba030e 100644 --- a/notcuda/src/impl/module.rs +++ b/zluda/src/impl/module.rs diff --git a/notcuda/src/impl/stream.rs b/zluda/src/impl/stream.rs index e212dfc..e212dfc 100644 --- a/notcuda/src/impl/stream.rs +++ b/zluda/src/impl/stream.rs diff --git a/notcuda/src/impl/test.rs b/zluda/src/impl/test.rs index b6ed926..b36ccd8 100644 --- a/notcuda/src/impl/test.rs +++ b/zluda/src/impl/test.rs @@ -1,6 +1,6 @@ #![allow(non_snake_case)] -use crate::cuda as notcuda; +use crate::cuda as zluda; use crate::cuda::CUstream; use crate::cuda::CUuuid; use crate::{ @@ -18,8 +18,8 @@ macro_rules! cuda_driver_test { ($func:ident) => { paste! { #[test] - fn [<$func _notcuda>]() { - $func::<crate::r#impl::test::NotCuda>() + fn [<$func _zluda>]() { + $func::<crate::r#impl::test::Zluda>() } #[test] @@ -46,58 +46,58 @@ pub trait CudaDriverFns { fn cuStreamDestroy_v2(stream: CUstream) -> CUresult; } -pub struct NotCuda(); +pub struct Zluda(); -impl CudaDriverFns for NotCuda { +impl CudaDriverFns for Zluda { fn cuInit(_flags: c_uint) -> CUresult { - notcuda::cuInit(_flags as _) + zluda::cuInit(_flags as _) } fn cuCtxCreate_v2(pctx: *mut *mut c_void, flags: c_uint, dev: c_int) -> CUresult { - notcuda::cuCtxCreate_v2(pctx as *mut _, flags, CUdevice(dev)) + zluda::cuCtxCreate_v2(pctx as *mut _, flags, CUdevice(dev)) } fn cuCtxDestroy_v2(ctx: *mut c_void) -> CUresult { - notcuda::cuCtxDestroy_v2(ctx as *mut _) + zluda::cuCtxDestroy_v2(ctx as *mut _) } fn cuCtxPopCurrent_v2(pctx: *mut *mut c_void) -> CUresult { - notcuda::cuCtxPopCurrent_v2(pctx as *mut _) + zluda::cuCtxPopCurrent_v2(pctx as *mut _) } fn cuCtxGetApiVersion(ctx: *mut c_void, version: *mut c_uint) -> CUresult { - notcuda::cuCtxGetApiVersion(ctx as *mut _, version) + zluda::cuCtxGetApiVersion(ctx as *mut _, version) } fn cuCtxGetCurrent(pctx: *mut *mut c_void) -> CUresult { - notcuda::cuCtxGetCurrent(pctx as *mut _) + zluda::cuCtxGetCurrent(pctx as *mut _) } fn cuMemAlloc_v2(dptr: *mut *mut c_void, bytesize: usize) -> CUresult { - notcuda::cuMemAlloc_v2(dptr as *mut _, bytesize) + zluda::cuMemAlloc_v2(dptr as *mut _, bytesize) } fn cuDeviceGetUuid(uuid: *mut CUuuid, dev: c_int) -> CUresult { - notcuda::cuDeviceGetUuid(uuid, CUdevice(dev)) + zluda::cuDeviceGetUuid(uuid, CUdevice(dev)) } fn cuDevicePrimaryCtxGetState(dev: c_int, flags: *mut c_uint, active: *mut c_int) -> CUresult { - notcuda::cuDevicePrimaryCtxGetState(CUdevice(dev), flags, active) + zluda::cuDevicePrimaryCtxGetState(CUdevice(dev), flags, active) } fn cuStreamGetCtx(hStream: CUstream, pctx: *mut *mut c_void) -> CUresult { - notcuda::cuStreamGetCtx(hStream, pctx as _) + zluda::cuStreamGetCtx(hStream, pctx as _) } fn cuStreamCreate(stream: *mut CUstream, flags: c_uint) -> CUresult { - notcuda::cuStreamCreate(stream, flags) + zluda::cuStreamCreate(stream, flags) } fn cuMemFree_v2(dptr: *mut c_void) -> CUresult { - notcuda::cuMemFree_v2(CUdeviceptr(dptr as _)) + zluda::cuMemFree_v2(CUdeviceptr(dptr as _)) } fn cuStreamDestroy_v2(stream: CUstream) -> CUresult { - notcuda::cuStreamDestroy_v2(stream) + zluda::cuStreamDestroy_v2(stream) } } diff --git a/notcuda/src/lib.rs b/zluda/src/lib.rs index 0f7d014..0f7d014 100644 --- a/notcuda/src/lib.rs +++ b/zluda/src/lib.rs diff --git a/notcuda_inject/Cargo.toml b/zluda_inject/Cargo.toml index 9c6163d..5dbb14b 100644 --- a/notcuda_inject/Cargo.toml +++ b/zluda_inject/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "notcuda_inject" +name = "zluda_inject" version = "0.0.0" authors = ["Andrzej Janik <[email protected]>"] edition = "2018" [[bin]] -name = "notcuda" +name = "zluda" path = "src/main.rs" [target.'cfg(windows)'.dependencies] -notcuda_redirect = { path = "../notcuda_redirect" } +zluda_redirect = { path = "../zluda_redirect" } winapi = { version = "0.3", features = ["processthreadsapi", "std", "synchapi"] } detours-sys = "0.1" clap = "2.33" diff --git a/notcuda_inject/src/bin.rs b/zluda_inject/src/bin.rs index 857ff91..e021a41 100644 --- a/notcuda_inject/src/bin.rs +++ b/zluda_inject/src/bin.rs @@ -20,11 +20,11 @@ use clap::{App, AppSettings, Arg}; mod win;
fn main() -> Result<(), Box<dyn Error>> {
- let matches = App::new("notCUDA injector")
+ let matches = App::new("ZLUDA injector")
.setting(AppSettings::TrailingVarArg)
.arg(
Arg::with_name("EXE")
- .help("Path to the executable to be injected with notCUDA")
+ .help("Path to the executable to be injected with ZLUDA")
.required(true),
)
.arg(
@@ -67,7 +67,7 @@ fn main() -> Result<(), Box<dyn Error>> { ptr::null(),
&mut startup_info as *mut _,
&mut proc_info as *mut _,
- "notcuda_redirect.dll\0".as_ptr() as *const i8,
+ "zluda_redirect.dll\0".as_ptr() as *const i8,
Option::None
),
|x| x != 0
diff --git a/notcuda_inject/src/main.rs b/zluda_inject/src/main.rs index 6e292f2..6e292f2 100644 --- a/notcuda_inject/src/main.rs +++ b/zluda_inject/src/main.rs diff --git a/notcuda_inject/src/win.rs b/zluda_inject/src/win.rs index ec57ffb..ec57ffb 100644 --- a/notcuda_inject/src/win.rs +++ b/zluda_inject/src/win.rs diff --git a/notcuda_redirect/Cargo.toml b/zluda_redirect/Cargo.toml index 4943b47..46069bc 100644 --- a/notcuda_redirect/Cargo.toml +++ b/zluda_redirect/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "notcuda_redirect" +name = "zluda_redirect" version = "0.0.0" authors = ["Andrzej Janik <[email protected]>"] edition = "2018" diff --git a/notcuda_redirect/src/lib.rs b/zluda_redirect/src/lib.rs index 57b54cc..c6cd4be 100644 --- a/notcuda_redirect/src/lib.rs +++ b/zluda_redirect/src/lib.rs @@ -19,8 +19,8 @@ use winapi::um::winbase::lstrcmpiW; use winapi::um::winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH, HANDLE, LPCWSTR}; const NVCUDA_PATH: &[u16] = wch_c!(r"C:\WINDOWS\system32\nvcuda.dll"); -const NOTCUDA_DLL: &[u16] = wch!(r"nvcuda.dll"); -static mut NOTCUDA_PATH: Option<Vec<u16>> = None; +const ZLUDA_DLL: &[u16] = wch!(r"nvcuda.dll"); +static mut ZLUDA_PATH: Option<Vec<u16>> = None; static mut LOAD_LIBRARY_EX: unsafe extern "system" fn( lpLibFileName: LPCWSTR, @@ -30,13 +30,13 @@ static mut LOAD_LIBRARY_EX: unsafe extern "system" fn( #[allow(non_snake_case)] #[no_mangle] -unsafe extern "system" fn NotCudaLoadLibraryExW( +unsafe extern "system" fn ZludaLoadLibraryExW( lpLibFileName: LPCWSTR, hFile: HANDLE, dwFlags: DWORD, ) -> HMODULE { let nvcuda_file_name = if lstrcmpiW(lpLibFileName, NVCUDA_PATH.as_ptr()) == 0 { - NOTCUDA_PATH.as_ref().unwrap().as_ptr() + ZLUDA_PATH.as_ref().unwrap().as_ptr() } else { lpLibFileName }; @@ -48,15 +48,15 @@ unsafe extern "system" fn NotCudaLoadLibraryExW( unsafe extern "system" fn DllMain(_: *const u8, dwReason: u32, _: *const u8) -> i32 { if dwReason == DLL_PROCESS_ATTACH { DetourRestoreAfterWith(); - match get_notcuda_dll_path() { - Some((path, len)) => set_notcuda_dll_path(path, len), + match get_zluda_dll_path() { + Some((path, len)) => set_zluda_dll_path(path, len), None => return FALSE, } DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach( std::mem::transmute(&mut LOAD_LIBRARY_EX), - NotCudaLoadLibraryExW as *mut _, + ZludaLoadLibraryExW as *mut _, ); DetourTransactionCommit(); } else if dwReason == DLL_PROCESS_DETACH { @@ -64,14 +64,14 @@ unsafe extern "system" fn DllMain(_: *const u8, dwReason: u32, _: *const u8) -> DetourUpdateThread(GetCurrentThread()); DetourDetach( std::mem::transmute(&mut LOAD_LIBRARY_EX), - NotCudaLoadLibraryExW as *mut _, + ZludaLoadLibraryExW as *mut _, ); DetourTransactionCommit(); } TRUE } -fn get_notcuda_dll_path() -> Option<(*const u16, usize)> { +fn get_zluda_dll_path() -> Option<(*const u16, usize)> { let guid = guid! {"C225FC0C-00D7-40B8-935A-7E342A9344C1"}; let mut module = std::ptr::null_mut(); loop { @@ -90,16 +90,16 @@ fn get_notcuda_dll_path() -> Option<(*const u16, usize)> { None } -unsafe fn set_notcuda_dll_path(path: *const u16, len: usize) { +unsafe fn set_zluda_dll_path(path: *const u16, len: usize) { let len = len as usize; - let mut result = Vec::<u16>::with_capacity(len + NOTCUDA_DLL.len() + 2); + let mut result = Vec::<u16>::with_capacity(len + ZLUDA_DLL.len() + 2); for i in 0..len { result.push(*path.add(i)); } result.push(0x5c); // \ - for c in NOTCUDA_DLL.iter().copied() { + for c in ZLUDA_DLL.iter().copied() { result.push(c); } result.push(0); - NOTCUDA_PATH = Some(result); + ZLUDA_PATH = Some(result); } |