diff --git a/luisa_compute/src/lang/mod.rs b/luisa_compute/src/lang/mod.rs index 16fa16f..fbbe638 100644 --- a/luisa_compute/src/lang/mod.rs +++ b/luisa_compute/src/lang/mod.rs @@ -1,7 +1,6 @@ -use std::backtrace::Backtrace; use std::collections::HashSet; use std::marker::PhantomData; -use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc}; +use std::{any::Any, fmt::Debug, rc::Rc, sync::Arc}; use std::{env, unreachable}; use crate::lang::traits::VarCmp; @@ -12,19 +11,16 @@ use crate::{rtx, ResourceTracker}; use bumpalo::Bump; use indexmap::IndexMap; pub use ir::ir::NodeRef; +use ir::ir::{ + new_node, BasicBlock, Binding, Capture, Const, CpuCustomOp, Func, Instruction, IrBuilder, + KernelModule, Module, ModuleKind, Node, PhiIncoming, +}; use ir::ir::{ ArrayType, CallableModule, CallableModuleRef, ModuleFlags, ModulePools, SwitchCase, UserNodeData, INVALID_REF, }; pub use ir::CArc; use ir::Pooled; -use ir::{ - ir::{ - new_node, BasicBlock, Binding, Capture, Const, CpuCustomOp, Func, Instruction, IrBuilder, - KernelModule, Module, ModuleKind, Node, PhiIncoming, - }, - transform::{self, Transform}, -}; use luisa_compute_ir as ir; @@ -34,10 +30,9 @@ pub use luisa_compute_ir::{ ir::{StructType, Type}, TypeOf, }; -use math::Uint3; -use std::cell::{Cell, RefCell, UnsafeCell}; +use std::cell::{Cell, RefCell}; use std::ffi::CString; -use std::ops::{Bound, Deref, DerefMut, RangeBounds}; +use std::ops::{Deref, DerefMut}; use std::sync::atomic::AtomicUsize; // use self::math::Uint3; pub mod math; @@ -50,12 +45,15 @@ pub use math::*; pub use poly::*; pub use printer::*; +#[allow(dead_code)] pub(crate) static KERNEL_ID: AtomicUsize = AtomicUsize::new(0); // prevent node being shared across kernels // TODO: replace NodeRef with SafeNodeRef #[derive(Clone, Copy, Debug)] pub(crate) struct SafeNodeRef { + #[allow(dead_code)] pub(crate) node: NodeRef, + #[allow(dead_code)] pub(crate) kernel_id: usize, } pub trait Value: Copy + ir::TypeOf + 'static { diff --git a/luisa_compute/src/lang/printer.rs b/luisa_compute/src/lang/printer.rs index 6b376b9..fcbea32 100644 --- a/luisa_compute/src/lang/printer.rs +++ b/luisa_compute/src/lang/printer.rs @@ -6,6 +6,7 @@ use std::sync::atomic::AtomicBool; pub type LogFn = Box; struct PrinterItem { + #[allow(dead_code)] level: log::Level, log_fn: LogFn, count: usize, @@ -123,7 +124,8 @@ impl Printer { let item_id = items.len() as u32; if_!( - offset.cmplt(data.len().uint()) & (offset + 1 + args.count as u32).cmple(data.len().uint()), + offset.cmplt(data.len().uint()) + & (offset + 1 + args.count as u32).cmple(data.len().uint()), { data.atomic_fetch_add(0, 1); data.write(offset, item_id); @@ -194,7 +196,7 @@ impl<'a> Scope<'a> { let items = data.items.read(); let mut i = 2; let item_count = host_data[0] as usize; - for j in 0..item_count { + for _j in 0..item_count { if i >= host_data.len() { break; } diff --git a/luisa_compute/src/resource.rs b/luisa_compute/src/resource.rs index 52fbb40..23ac9e2 100644 --- a/luisa_compute/src/resource.rs +++ b/luisa_compute/src/resource.rs @@ -1004,7 +1004,9 @@ impl_storage_texel!([f16; 4], Byte4, f32, Float2, Float4, Int2, Int4, Uint2, Uin // `T` is the read out type of the texture, which is not necessarily the same as the storage type // In fact, the texture can be stored in any format as long as it can be converted to `T` pub struct Tex2d { + #[allow(dead_code)] pub(crate) width: u32, + #[allow(dead_code)] pub(crate) height: u32, pub(crate) handle: Arc, pub(crate) marker: std::marker::PhantomData, @@ -1013,8 +1015,11 @@ pub struct Tex2d { // `T` is the read out type of the texture, which is not necessarily the same as the storage type // In fact, the texture can be stored in any format as long as it can be converted to `T` pub struct Tex3d { + #[allow(dead_code)] pub(crate) width: u32, + #[allow(dead_code)] pub(crate) height: u32, + #[allow(dead_code)] pub(crate) depth: u32, pub(crate) handle: Arc, pub(crate) marker: std::marker::PhantomData, @@ -1573,10 +1578,7 @@ impl BindlessArrayVar { }; v } - pub fn byte_address_buffer( - &self, - buffer_index: impl Into>, - ) -> BindlessByteBufferVar { + pub fn byte_address_buffer(&self, buffer_index: impl Into>) -> BindlessByteBufferVar { let v = BindlessByteBufferVar { array: self.node, buffer_index: buffer_index.into(), diff --git a/luisa_compute/src/rtx.rs b/luisa_compute/src/rtx.rs index 02079c6..bc61b3f 100644 --- a/luisa_compute/src/rtx.rs +++ b/luisa_compute/src/rtx.rs @@ -41,6 +41,7 @@ pub(crate) struct ProceduralPrimitiveHandle { pub(crate) device: Device, pub(crate) handle: api::ProceduralPrimitive, pub(crate) native_handle: *mut std::ffi::c_void, + #[allow(dead_code)] pub(crate) aabb_buffer: Arc, } impl Drop for ProceduralPrimitiveHandle { @@ -85,7 +86,9 @@ pub(crate) struct MeshHandle { pub(crate) device: Device, pub(crate) handle: api::Mesh, pub(crate) native_handle: *mut std::ffi::c_void, + #[allow(dead_code)] pub(crate) vbuffer: Arc, + #[allow(dead_code)] pub(crate) ibuffer: Arc, } impl Drop for MeshHandle { @@ -148,7 +151,8 @@ impl Accel { let mut flags = api::AccelBuildModificationFlags::PRIMITIVE | AccelBuildModificationFlags::TRANSFORM; - flags |= api::AccelBuildModificationFlags::VISIBILITY | api::AccelBuildModificationFlags::USER_ID; + flags |= api::AccelBuildModificationFlags::VISIBILITY + | api::AccelBuildModificationFlags::USER_ID; if opaque { flags |= api::AccelBuildModificationFlags::OPAQUE_ON; @@ -183,7 +187,8 @@ impl Accel { ) { let mut flags = api::AccelBuildModificationFlags::PRIMITIVE; dbg!(flags); - flags |= api::AccelBuildModificationFlags::VISIBILITY | api::AccelBuildModificationFlags::USER_ID; + flags |= api::AccelBuildModificationFlags::VISIBILITY + | api::AccelBuildModificationFlags::USER_ID; if opaque { flags |= api::AccelBuildModificationFlags::OPAQUE_ON; @@ -372,8 +377,8 @@ pub enum HitType { pub fn offset_ray_origin(p: Expr, n: Expr) -> Expr { lazy_static! { - static ref F: Callable, Expr)-> Expr> = - create_static_callable::, Expr)->Expr>(|p, n| { + static ref F: Callable, Expr) -> Expr> = + create_static_callable::, Expr) -> Expr>(|p, n| { const ORIGIN: f32 = 1.0f32 / 32.0f32; const FLOAT_SCALE: f32 = 1.0f32 / 65536.0f32; const INT_SCALE: f32 = 256.0f32; diff --git a/luisa_compute/src/runtime.rs b/luisa_compute/src/runtime.rs index b267e0e..c54347e 100644 --- a/luisa_compute/src/runtime.rs +++ b/luisa_compute/src/runtime.rs @@ -367,7 +367,7 @@ impl Device { modifications: RwLock::new(HashMap::new()), } } - pub fn create_callable<'a, S: CallableSignature<'a>>(&self, f:S::Fn) -> S::Callable { + pub fn create_callable<'a, S: CallableSignature<'a>>(&self, f: S::Fn) -> S::Callable { let mut builder = KernelBuilder::new(Some(self.clone()), false); let raw_callable = CallableBuildFn::build_callable(&f, None, &mut builder); S::wrap_raw_callable(raw_callable) @@ -835,6 +835,7 @@ impl<'a> CommandList<'a> { pub fn extend>>(&mut self, commands: I) { self.commands.extend(commands); } + #[allow(dead_code)] pub fn push(&mut self, command: Command<'a>) { self.commands.push(command); } @@ -864,6 +865,7 @@ pub struct Command<'a> { pub(crate) struct AsyncShaderArtifact { shader: Option, // strange naming, huh? + #[allow(dead_code)] name: Arc, }