Skip to content

Commit

Permalink
update submod
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Sep 9, 2023
1 parent 2dde367 commit 9374304
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
11 changes: 10 additions & 1 deletion luisa_compute/src/lang/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
13 changes: 7 additions & 6 deletions luisa_compute/src/lang/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn _store<T1: Aggregate, T2: Aggregate>(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);
}
})
}
Expand Down Expand Up @@ -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<T: Value>(&mut self) -> BufferVar<T> {
let node = new_node(
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions luisa_compute/src/lang/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output = Self::Bool> + BitAnd<Output = Self::Bool>;
fn type_() -> CArc<Type> {
<Self::Value as TypeOf>::type_()
Expand All @@ -35,7 +35,7 @@ macro_rules! impl_var_trait {
type Ulong = Expr<u64>;
type Half = Expr<f16>;
type Float = Expr<f32>;
// type Double = Expr<f64>;
type Double = Expr<f64>;
type Bool = Expr<bool>;
}
impl ScalarVarTrait for PrimExpr<$t> {}
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 3 additions & 1 deletion luisa_compute/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ impl BindlessArray {
self.var().buffer::<T>(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::{
Expand Down Expand Up @@ -1364,7 +1366,7 @@ impl BindlessByteBufferVar {
let i = index_bytes.to_u64();
Expr::<T>::from_node(__current_scope(|b| {
b.call(
Func::BindlessByteAdressBufferRead,
Func::BindlessByteBufferRead,
&[self.array, self.buffer_index.node(), i.node],
<T as TypeOf>::type_(),
)
Expand Down
5 changes: 4 additions & 1 deletion luisa_compute/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,10 @@ impl<T: CallableParameter, R: CallableRet> DynCallable<T, R> {
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(
Expand Down
2 changes: 1 addition & 1 deletion luisa_compute_derive_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)*
Expand Down

0 comments on commit 9374304

Please sign in to comment.