Skip to content

Commit

Permalink
better runtime check
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Sep 23, 2023
1 parent d0aa01c commit 524ad67
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
6 changes: 3 additions & 3 deletions luisa_compute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ mod internal_prelude {
pub(crate) use crate::lang::types::vector::*;
#[allow(unused_imports)]
pub(crate) use crate::lang::{
ir, CallFuncTrait, Recorder, __compose, __extract, __insert, __module_pools,
need_runtime_check, FromNode, NodeLike, NodeRef, ToNode, __current_scope, __pop_scope,
RECORDER,
check_index_lt_usize, ir, CallFuncTrait, Recorder, __compose, __extract, __insert,
__module_pools, need_runtime_check, FromNode, NodeLike, NodeRef, ToNode, __current_scope,
__pop_scope, RECORDER,
};
pub(crate) use crate::prelude::*;
pub(crate) use crate::runtime::{
Expand Down
35 changes: 34 additions & 1 deletion luisa_compute/tests/misc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use luisa::lang::ops::AddMaybeExpr;
use luisa::lang::types::array::VLArrayVar;
use luisa::lang::types::core::*;
use luisa::lang::types::vector::alias::*;
use luisa::lang::types::{core::*, ExprProxy};
use luisa::prelude::*;
use luisa_compute as luisa;
use luisa_compute_api_types::StreamTag;
Expand Down Expand Up @@ -881,6 +882,38 @@ fn bindless_byte_buffer() {
}
}

// #[derive(Clone, Copy, Debug, Value, PartialEq)]
// #[repr(C)]
// #[value_new(pub)]
// pub struct CustomAdd {
// i: f32,
// }
// impl std::ops::Add<Expr<CustomAdd>> for CustomAddExpr {
// type Output = Expr<CustomAdd>;
// fn add(self, rhs: Expr<CustomAdd>) -> Self::Output {
// todo!()
// }
// }
// impl AddExpr<CustomAddExpr> for CustomAddExpr {
// type Output = Expr<CustomAdd>;
// #[tracked]
// fn add(self, rhs: CustomAddExpr) -> Expr<CustomAdd> {
// let rhs = rhs.as_expr_from_proxy();
// let self_ = self.self_.var();
// *self_.i += rhs.i;
// **self_
// }
// }
// impl AddMaybeExpr<CustomAddExpr, luisa_compute::lang::types::ExprType> for Expr<CustomAdd> {
// type Output = Expr<CustomAdd>;
// fn __add(self, rhs: CustomAddExpr) -> Self::Output {
// self.add(rhs)
// }
// }
// fn custom_add(a: Expr<CustomAdd>, b: Expr<CustomAdd>) -> Expr<CustomAdd> {
// track!(*a + b)
// }

#[derive(Clone, Copy, Debug, Value, PartialEq)]
#[repr(C)]
#[value_new(pub)]
Expand Down

0 comments on commit 524ad67

Please sign in to comment.