From 9374304e9b60bef90b3dbb62ec59e67b8498529e Mon Sep 17 00:00:00 2001 From: Xiaochun Tong Date: Sat, 9 Sep 2023 04:32:37 -0400 Subject: [PATCH] update submod --- luisa_compute/src/lang/math.rs | 11 ++++++++++- luisa_compute/src/lang/mod.rs | 13 +++++++------ luisa_compute/src/lang/traits.rs | 10 +++++----- luisa_compute/src/resource.rs | 4 +++- luisa_compute/src/runtime.rs | 5 ++++- luisa_compute_derive_impl/src/lib.rs | 2 +- luisa_compute_sys/LuisaCompute | 2 +- 7 files changed, 31 insertions(+), 16 deletions(-) diff --git a/luisa_compute/src/lang/math.rs b/luisa_compute/src/lang/math.rs index f474ec1..6c4e0f4 100644 --- a/luisa_compute/src/lang/math.rs +++ b/luisa_compute/src/lang/math.rs @@ -661,6 +661,10 @@ impl_vec_proxy!(Float2, Float2Expr, Float2Var, f32, Float32, 2, x, y); impl_vec_proxy!(Float3, Float3Expr, Float3Var, f32, Float32, 3, x, y, z); impl_vec_proxy!(Float4, Float4Expr, Float4Var, f32, Float32, 4, x, y, z, w); +impl_vec_proxy!(Double2, Double2Expr, Double2Var, f64, Float64, 2, x, y); +impl_vec_proxy!(Double3, Double3Expr, Double3Var, f64, Float64, 3, x, y, z); +impl_vec_proxy!(Double4, Double4Expr, Double4Var, f64, Float64, 4, x, y, z, w); + impl_vec_proxy!(Ushort2, Ushort2Expr, Ushort2Var, u16, Uint16, 2, x, y); impl_vec_proxy!(Ushort3, Ushort3Expr, Ushort3Var, u16, Uint16, 3, x, y, z); impl_vec_proxy!(Ushort4, Ushort4Expr, Ushort4Var, u16, Uint16, 4, x, y, z, w); @@ -1499,7 +1503,7 @@ macro_rules! impl_var_trait2 { type Float = Float2Expr; type Half = Half2Expr; type Bool = Bool2Expr; - // type Double = Double2Expr; + type Double = Double2Expr; type Long = Long2Expr; type Ulong = Ulong2Expr; } @@ -1524,6 +1528,7 @@ macro_rules! impl_var_trait3 { type Float = Float3Expr; type Half = Half3Expr; type Bool = Bool3Expr; + type Double = Double3Expr; type Long = Long3Expr; type Ulong = Ulong3Expr; } @@ -1546,6 +1551,7 @@ macro_rules! impl_var_trait4 { type Int = Int4Expr; type Uint = Uint4Expr; type Float = Float4Expr; + type Double = Double4Expr; type Half = Half4Expr; type Bool = Bool4Expr; type Long = Long4Expr; @@ -1564,6 +1570,7 @@ macro_rules! impl_var_trait4 { impl_var_trait2!(Half2Expr, Half2); impl_var_trait2!(Float2Expr, Float2); +impl_var_trait2!(Double2Expr, Double2); impl_var_trait2!(Short2Expr, Short2); impl_var_trait2!(Ushort2Expr, Ushort2); impl_var_trait2!(Int2Expr, Int2); @@ -1574,6 +1581,7 @@ impl_var_trait2!(Ulong2Expr, Ulong2); impl_var_trait3!(Half3Expr, Half3); impl_var_trait3!(Float3Expr, Float3); +impl_var_trait3!(Double3Expr, Double3); impl_var_trait3!(Short3Expr, Short3); impl_var_trait3!(Ushort3Expr, Ushort3); impl_var_trait3!(Int3Expr, Int3); @@ -1584,6 +1592,7 @@ impl_var_trait3!(Ulong3Expr, Ulong3); impl_var_trait4!(Half4Expr, Half4); impl_var_trait4!(Float4Expr, Float4); +impl_var_trait4!(Double4Expr, Double4); impl_var_trait4!(Short4Expr, Short4); impl_var_trait4!(Ushort4Expr, Ushort4); impl_var_trait4!(Int4Expr, Int4); diff --git a/luisa_compute/src/lang/mod.rs b/luisa_compute/src/lang/mod.rs index 6044955..1b74ea9 100644 --- a/luisa_compute/src/lang/mod.rs +++ b/luisa_compute/src/lang/mod.rs @@ -98,7 +98,7 @@ fn _store(var: &T1, value: &T2) { assert_eq!(value_nodes.len(), self_nodes.len()); __current_scope(|b| { for (value_node, self_node) in value_nodes.into_iter().zip(self_nodes.into_iter()) { - b.store(self_node, value_node); + b.update(self_node, value_node); } }) } @@ -1894,10 +1894,7 @@ impl KernelBuilder { Node::new(CArc::new(Instruction::Buffer), Type::void()), ); self.args.push(node); - ByteBufferVar { - node, - handle: None, - } + ByteBufferVar { node, handle: None } } pub fn buffer(&mut self) -> BufferVar { let node = new_node( @@ -2126,8 +2123,12 @@ pub struct KernelBuildOptions { impl Default for KernelBuildOptions { fn default() -> Self { + let enable_debug_info = match env::var("LUISA_DEBUG") { + Ok(s) => s == "1", + Err(_) => false, + }; Self { - enable_debug_info: false, + enable_debug_info, enable_optimization: true, async_compile: false, enable_cache: true, diff --git a/luisa_compute/src/lang/traits.rs b/luisa_compute/src/lang/traits.rs index 4bef5a4..8c02e94 100644 --- a/luisa_compute/src/lang/traits.rs +++ b/luisa_compute/src/lang/traits.rs @@ -17,7 +17,7 @@ pub trait VarTrait: Copy + Clone + 'static + FromNode { type Ulong: VarTrait; type Half: VarTrait; type Float: VarTrait; - // type Double: VarTrait; + type Double: VarTrait; type Bool: VarTrait + Not + BitAnd; fn type_() -> CArc { ::type_() @@ -35,7 +35,7 @@ macro_rules! impl_var_trait { type Ulong = Expr; type Half = Expr; type Float = Expr; - // type Double = Expr; + type Double = Expr; type Bool = Expr; } impl ScalarVarTrait for PrimExpr<$t> {} @@ -138,9 +138,9 @@ pub trait CommonVarOp: VarTrait { fn half(&self) -> Self::Half { _cast(*self) } - // fn double(&self) -> Self::Double { - // _cast(*self) - // } + fn double(&self) -> Self::Double { + _cast(*self) + } fn bool_(&self) -> Self::Bool { _cast(*self) } diff --git a/luisa_compute/src/resource.rs b/luisa_compute/src/resource.rs index 2425408..52fbb40 100644 --- a/luisa_compute/src/resource.rs +++ b/luisa_compute/src/resource.rs @@ -802,6 +802,8 @@ impl BindlessArray { self.var().buffer::(buffer_index) } } +unsafe impl Send for BindlessArray {} +unsafe impl Sync for BindlessArray {} pub use api::{PixelFormat, PixelStorage, Sampler, SamplerAddress, SamplerFilter}; use luisa_compute_ir::context::type_hash; use luisa_compute_ir::ir::{ @@ -1364,7 +1366,7 @@ impl BindlessByteBufferVar { let i = index_bytes.to_u64(); Expr::::from_node(__current_scope(|b| { b.call( - Func::BindlessByteAdressBufferRead, + Func::BindlessByteBufferRead, &[self.array, self.buffer_index.node(), i.node], ::type_(), ) diff --git a/luisa_compute/src/runtime.rs b/luisa_compute/src/runtime.rs index 4a3c8f6..c78bdfa 100644 --- a/luisa_compute/src/runtime.rs +++ b/luisa_compute/src/runtime.rs @@ -1230,7 +1230,10 @@ impl DynCallable { RECORDER.with(|r| { *r.borrow_mut() = r_backup; }); - assert!(lang::__check_callable(&new_callable.inner.module, nodes)); + assert!( + lang::__check_callable(&new_callable.inner.module, nodes), + "Callable builder returned a callable that does not match the arguments" + ); let callables = &mut inner.callables; callables.push(new_callable); CallableRet::_from_return(lang::__invoke_callable( diff --git a/luisa_compute_derive_impl/src/lib.rs b/luisa_compute_derive_impl/src/lib.rs index 70c145d..a3edfdc 100644 --- a/luisa_compute_derive_impl/src/lib.rs +++ b/luisa_compute_derive_impl/src/lib.rs @@ -355,7 +355,7 @@ impl Compiler { } } impl #impl_generics #crate_path ::StructInitiaizable for #name #ty_generics #where_clause{ - type Init = #ctor_proxy_name; + type Init = #ctor_proxy_name #ty_generics; } impl #impl_generics #expr_proxy_name #ty_generics #where_clause { #(#expr_proxy_field_methods)* diff --git a/luisa_compute_sys/LuisaCompute b/luisa_compute_sys/LuisaCompute index 92560f2..14e2315 160000 --- a/luisa_compute_sys/LuisaCompute +++ b/luisa_compute_sys/LuisaCompute @@ -1 +1 @@ -Subproject commit 92560f2452e09707e2ee85558bc09d868dd91295 +Subproject commit 14e23158619b9c450aab26b033b2374149204443