From 6cbd3ac63710158d20b40c835fb11ccd59e62cec Mon Sep 17 00:00:00 2001 From: "Heres, Daniel" Date: Mon, 12 Apr 2021 20:41:57 +0200 Subject: [PATCH 1/4] Support auto-vectorization for min/max --- rust/arrow/Cargo.toml | 1 + rust/arrow/src/compute/kernels/aggregate.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/rust/arrow/Cargo.toml b/rust/arrow/Cargo.toml index 5ab1f8cc02b..3bf12725675 100644 --- a/rust/arrow/Cargo.toml +++ b/rust/arrow/Cargo.toml @@ -51,6 +51,7 @@ flatbuffers = "^0.8" hex = "0.4" prettytable-rs = { version = "0.8.0", optional = true } lexical-core = "^0.7" +multiversion = "0.6.1" [features] default = [] diff --git a/rust/arrow/src/compute/kernels/aggregate.rs b/rust/arrow/src/compute/kernels/aggregate.rs index d0e3f22f541..48c92961302 100644 --- a/rust/arrow/src/compute/kernels/aggregate.rs +++ b/rust/arrow/src/compute/kernels/aggregate.rs @@ -17,6 +17,7 @@ //! Defines aggregations over Arrow arrays. +use multiversion::multiversion; use std::ops::Add; use crate::array::{ @@ -103,6 +104,10 @@ pub fn min_string( } /// Helper function to perform min/max lambda function on values from a numeric array. + +#[multiversion] +#[clone(target = "[x86|x86_64]+avx")] +#[clone(target = "[x86|x86_64]+avx2")] fn min_max_helper(array: &PrimitiveArray, cmp: F) -> Option where T: ArrowNumericType, From 018717e9263b7e11c5b2c1ad72f93503f8817812 Mon Sep 17 00:00:00 2001 From: "Heres, Daniel" Date: Mon, 12 Apr 2021 20:53:29 +0200 Subject: [PATCH 2/4] Simplify --- rust/arrow/src/compute/kernels/aggregate.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/arrow/src/compute/kernels/aggregate.rs b/rust/arrow/src/compute/kernels/aggregate.rs index 48c92961302..c361de87e7c 100644 --- a/rust/arrow/src/compute/kernels/aggregate.rs +++ b/rust/arrow/src/compute/kernels/aggregate.rs @@ -106,8 +106,8 @@ pub fn min_string( /// Helper function to perform min/max lambda function on values from a numeric array. #[multiversion] -#[clone(target = "[x86|x86_64]+avx")] -#[clone(target = "[x86|x86_64]+avx2")] +#[clone(target = "x86_64+avx")] +#[clone(target = "x86_64+avx+avx2")] fn min_max_helper(array: &PrimitiveArray, cmp: F) -> Option where T: ArrowNumericType, From e351c651a92219e681da081fa57c5bdf5e63b8f6 Mon Sep 17 00:00:00 2001 From: "Heres, Daniel" Date: Mon, 12 Apr 2021 21:00:00 +0200 Subject: [PATCH 3/4] avx only --- rust/arrow/src/compute/kernels/aggregate.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust/arrow/src/compute/kernels/aggregate.rs b/rust/arrow/src/compute/kernels/aggregate.rs index c361de87e7c..753c9a95b8c 100644 --- a/rust/arrow/src/compute/kernels/aggregate.rs +++ b/rust/arrow/src/compute/kernels/aggregate.rs @@ -107,7 +107,6 @@ pub fn min_string( #[multiversion] #[clone(target = "x86_64+avx")] -#[clone(target = "x86_64+avx+avx2")] fn min_max_helper(array: &PrimitiveArray, cmp: F) -> Option where T: ArrowNumericType, From 576508dc3afcbc3829cb3c86ff3ab6dd822c1ccb Mon Sep 17 00:00:00 2001 From: "Heres, Daniel" Date: Mon, 12 Apr 2021 21:11:11 +0200 Subject: [PATCH 4/4] Remove line --- rust/arrow/src/compute/kernels/aggregate.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust/arrow/src/compute/kernels/aggregate.rs b/rust/arrow/src/compute/kernels/aggregate.rs index 753c9a95b8c..a01b29e7b09 100644 --- a/rust/arrow/src/compute/kernels/aggregate.rs +++ b/rust/arrow/src/compute/kernels/aggregate.rs @@ -104,7 +104,6 @@ pub fn min_string( } /// Helper function to perform min/max lambda function on values from a numeric array. - #[multiversion] #[clone(target = "x86_64+avx")] fn min_max_helper(array: &PrimitiveArray, cmp: F) -> Option