From d90b2606f9ccaf5d1a3a9540c9394fb5c5e3d246 Mon Sep 17 00:00:00 2001 From: Xiaochun Tong Date: Mon, 25 Mar 2024 09:09:49 -0400 Subject: [PATCH] added count_ones --- luisa_compute/src/lang/ops/impls.rs | 3 +++ luisa_compute/src/lang/ops/traits.rs | 1 + luisa_compute_sys/LuisaCompute | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/luisa_compute/src/lang/ops/impls.rs b/luisa_compute/src/lang/ops/impls.rs index 0ea62a1..d6edfb3 100644 --- a/luisa_compute/src/lang/ops/impls.rs +++ b/luisa_compute/src/lang/ops/impls.rs @@ -176,6 +176,9 @@ where fn leading_zeros(&self) -> Expr { Func::Clz.call(self.clone()) } + fn count_ones(&self) -> Expr { + Func::PopCount.call(self.clone()) + } } macro_rules! impl_simple_fns { diff --git a/luisa_compute/src/lang/ops/traits.rs b/luisa_compute/src/lang/ops/traits.rs index 0695211..922658b 100644 --- a/luisa_compute/src/lang/ops/traits.rs +++ b/luisa_compute/src/lang/ops/traits.rs @@ -215,6 +215,7 @@ pub trait IntExpr { fn rotate_left(&self, n: Expr) -> Self; fn trailing_zeros(&self) -> Expr; fn leading_zeros(&self) -> Expr; + fn count_ones(&self) -> Expr; } pub trait FloatExpr: Sized { diff --git a/luisa_compute_sys/LuisaCompute b/luisa_compute_sys/LuisaCompute index 79a7a6d..45f0390 160000 --- a/luisa_compute_sys/LuisaCompute +++ b/luisa_compute_sys/LuisaCompute @@ -1 +1 @@ -Subproject commit 79a7a6d27a0c590d92a9efffdb9c2c63333676fa +Subproject commit 45f0390350cafb89df078165d68e50f01fa69c86