mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-02 22:30:41 +00:00
Support -nolocalra hack
This commit is contained in:
parent
690f4f3ad2
commit
b62b4ab6dc
2 changed files with 19 additions and 0 deletions
|
@ -26,6 +26,7 @@ pub struct FunctionData {
|
||||||
pub arg_size: Vec<usize>,
|
pub arg_size: Vec<usize>,
|
||||||
pub use_shared_mem: bool,
|
pub use_shared_mem: bool,
|
||||||
pub properties: Option<Box<l0::sys::ze_kernel_properties_t>>,
|
pub properties: Option<Box<l0::sys::ze_kernel_properties_t>>,
|
||||||
|
pub do_nothing_hack: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FunctionData {
|
impl FunctionData {
|
||||||
|
@ -61,6 +62,9 @@ pub fn launch_kernel(
|
||||||
}
|
}
|
||||||
GlobalState::lock_stream(hstream, |stream| {
|
GlobalState::lock_stream(hstream, |stream| {
|
||||||
let func: &mut FunctionData = unsafe { &mut *f }.as_result_mut()?;
|
let func: &mut FunctionData = unsafe { &mut *f }.as_result_mut()?;
|
||||||
|
if func.do_nothing_hack {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
for (i, arg_size) in func.arg_size.iter().enumerate() {
|
for (i, arg_size) in func.arg_size.iter().enumerate() {
|
||||||
unsafe {
|
unsafe {
|
||||||
func.base
|
func.base
|
||||||
|
|
|
@ -110,6 +110,20 @@ pub fn get_function(
|
||||||
return Err(CUresult::CUDA_ERROR_INVALID_VALUE);
|
return Err(CUresult::CUDA_ERROR_INVALID_VALUE);
|
||||||
}
|
}
|
||||||
let name = unsafe { CStr::from_ptr(name) }.to_owned();
|
let name = unsafe { CStr::from_ptr(name) }.to_owned();
|
||||||
|
let name_string = name.to_string_lossy();
|
||||||
|
let visa_options = std::env::var("IGC_VISAOptions");
|
||||||
|
let should_not_run_in_presence_of_hacks = match (
|
||||||
|
visa_options.as_ref().map(|s| s.as_str()),
|
||||||
|
name_string.as_ref(),
|
||||||
|
) {
|
||||||
|
(Ok("-nolocalra"), "square_image") // Face Detection
|
||||||
|
| (Ok("-nolocalra"), "sum_horizontal") // Face Detection
|
||||||
|
| (Ok("-nolocalra"), "sum_vertical") // Face Detection
|
||||||
|
| (Ok("-nolocalra"), "detect") // Face Detection
|
||||||
|
| (Ok("-nolocalra"), "particle") // Particle Physics
|
||||||
|
=> true,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
let function: *mut Function = GlobalState::lock_current_context(|ctx| {
|
let function: *mut Function = GlobalState::lock_current_context(|ctx| {
|
||||||
let module = unsafe { &mut *hmod }.as_result_mut()?;
|
let module = unsafe { &mut *hmod }.as_result_mut()?;
|
||||||
let device = unsafe { &mut *ctx.device };
|
let device = unsafe { &mut *ctx.device };
|
||||||
|
@ -145,6 +159,7 @@ pub fn get_function(
|
||||||
arg_size: kernel_info.arguments_sizes.clone(),
|
arg_size: kernel_info.arguments_sizes.clone(),
|
||||||
use_shared_mem: kernel_info.uses_shared_mem,
|
use_shared_mem: kernel_info.uses_shared_mem,
|
||||||
properties: None,
|
properties: None,
|
||||||
|
do_nothing_hack: should_not_run_in_presence_of_hacks,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue