Skip to content

Commit

Permalink
Shared fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
entropylost committed Mar 15, 2024
1 parent 6838dc5 commit 51d1ff8
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions luisa_compute/src/lang/types/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ pub struct Shared<T: Value> {
}
impl<T: Value> Shared<T> {
pub fn new(length: usize) -> Self {
let shared = with_recorder(|r| {
let shared = new_node(
&r.pools,
Node::new(
CArc::new(Instruction::Shared),
ir::context::register_type(Type::Array(ArrayType {
element: T::type_(),
length,
})),
),
)
.into();

r.shared.push(shared);
shared
});
Self {
marker: PhantomData,
node: with_recorder(|r| {
let shared = new_node(
&r.pools,
Node::new(
CArc::new(Instruction::Shared),
ir::context::register_type(Type::Array(ArrayType {
element: T::type_(),
length,
})),
),
)
.into();

r.shared.push(shared);
shared.into()
}),
node: shared.into(),
}
}
pub fn len_expr(&self) -> Expr<u64> {
Expand Down

0 comments on commit 51d1ff8

Please sign in to comment.