Skip to content

Commit 6d4c286

Browse files
committed
disable rust simd on linux arm
1 parent 84c5694 commit 6d4c286

File tree

4 files changed

+111
-34
lines changed

4 files changed

+111
-34
lines changed

core/rust/qdbr/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
******************************************************************************/
2424

2525
#![feature(allocator_api)]
26-
#![feature(portable_simd)]
26+
#![cfg_attr(
27+
not(all(target_os = "linux", target_arch = "aarch64")),
28+
feature(portable_simd)
29+
)]
2730
extern crate core;
2831
pub extern crate jni;
2932

core/rust/qdbr/src/parquet_write/file.rs

Lines changed: 96 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,13 +1012,26 @@ fn chunk_to_primitive_page(
10121012
}
10131013
ColumnTypeTag::Int => {
10141014
let data: &[i32] = unsafe { util::transmute_slice(column.primary_data) };
1015-
primitive::i32_slice_to_page_simd(
1016-
&data[lower_bound..upper_bound],
1017-
adjusted_column_top,
1018-
options,
1019-
primitive_type,
1020-
encoding,
1021-
)
1015+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
1016+
{
1017+
primitive::i32_slice_to_page_simd(
1018+
&data[lower_bound..upper_bound],
1019+
adjusted_column_top,
1020+
options,
1021+
primitive_type,
1022+
encoding,
1023+
)
1024+
}
1025+
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
1026+
{
1027+
primitive::int_slice_to_page_nullable::<i32, i32>(
1028+
&data[lower_bound..upper_bound],
1029+
adjusted_column_top,
1030+
options,
1031+
primitive_type,
1032+
encoding,
1033+
)
1034+
}
10221035
}
10231036
ColumnTypeTag::IPv4 => {
10241037
let data: &[IPv4] = unsafe { util::transmute_slice(column.primary_data) };
@@ -1032,13 +1045,26 @@ fn chunk_to_primitive_page(
10321045
}
10331046
ColumnTypeTag::Long | ColumnTypeTag::Date => {
10341047
let data: &[i64] = unsafe { util::transmute_slice(column.primary_data) };
1035-
primitive::i64_slice_to_page_simd(
1036-
&data[lower_bound..upper_bound],
1037-
adjusted_column_top,
1038-
options,
1039-
primitive_type,
1040-
encoding,
1041-
)
1048+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
1049+
{
1050+
primitive::i64_slice_to_page_simd(
1051+
&data[lower_bound..upper_bound],
1052+
adjusted_column_top,
1053+
options,
1054+
primitive_type,
1055+
encoding,
1056+
)
1057+
}
1058+
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
1059+
{
1060+
primitive::int_slice_to_page_nullable::<i64, i64>(
1061+
&data[lower_bound..upper_bound],
1062+
adjusted_column_top,
1063+
options,
1064+
primitive_type,
1065+
encoding,
1066+
)
1067+
}
10421068
}
10431069
ColumnTypeTag::Timestamp => {
10441070
let data: &[i64] = unsafe { util::transmute_slice(column.primary_data) };
@@ -1052,13 +1078,26 @@ fn chunk_to_primitive_page(
10521078
encoding,
10531079
)
10541080
} else {
1055-
primitive::i64_slice_to_page_simd(
1056-
&data[lower_bound..upper_bound],
1057-
adjusted_column_top,
1058-
options,
1059-
primitive_type,
1060-
encoding,
1061-
)
1081+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
1082+
{
1083+
primitive::i64_slice_to_page_simd(
1084+
&data[lower_bound..upper_bound],
1085+
adjusted_column_top,
1086+
options,
1087+
primitive_type,
1088+
encoding,
1089+
)
1090+
}
1091+
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
1092+
{
1093+
primitive::int_slice_to_page_nullable::<i64, i64>(
1094+
&data[lower_bound..upper_bound],
1095+
adjusted_column_top,
1096+
options,
1097+
primitive_type,
1098+
encoding,
1099+
)
1100+
}
10621101
}
10631102
}
10641103
ColumnTypeTag::GeoByte => {
@@ -1103,21 +1142,45 @@ fn chunk_to_primitive_page(
11031142
}
11041143
ColumnTypeTag::Float => {
11051144
let data: &[f32] = unsafe { util::transmute_slice(column.primary_data) };
1106-
primitive::f32_slice_to_page_simd(
1107-
&data[lower_bound..upper_bound],
1108-
adjusted_column_top,
1109-
options,
1110-
primitive_type,
1111-
)
1145+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
1146+
{
1147+
primitive::f32_slice_to_page_simd(
1148+
&data[lower_bound..upper_bound],
1149+
adjusted_column_top,
1150+
options,
1151+
primitive_type,
1152+
)
1153+
}
1154+
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
1155+
{
1156+
primitive::float_slice_to_page_plain::<f32, f32>(
1157+
&data[lower_bound..upper_bound],
1158+
adjusted_column_top,
1159+
options,
1160+
primitive_type,
1161+
)
1162+
}
11121163
}
11131164
ColumnTypeTag::Double => {
11141165
let data: &[f64] = unsafe { util::transmute_slice(column.primary_data) };
1115-
primitive::f64_slice_to_page_simd(
1116-
&data[lower_bound..upper_bound],
1117-
adjusted_column_top,
1118-
options,
1119-
primitive_type,
1120-
)
1166+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
1167+
{
1168+
primitive::f64_slice_to_page_simd(
1169+
&data[lower_bound..upper_bound],
1170+
adjusted_column_top,
1171+
options,
1172+
primitive_type,
1173+
)
1174+
}
1175+
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
1176+
{
1177+
primitive::float_slice_to_page_plain::<f64, f64>(
1178+
&data[lower_bound..upper_bound],
1179+
adjusted_column_top,
1180+
options,
1181+
primitive_type,
1182+
)
1183+
}
11211184
}
11221185
ColumnTypeTag::Binary => {
11231186
let aux: &[i64] = unsafe { util::transmute_slice(column.secondary_data) };

core/rust/qdbr/src/parquet_write/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod fixed_len_bytes;
88
mod jni;
99
mod primitive;
1010
pub mod schema;
11+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
1112
pub mod simd;
1213
mod string;
1314
mod symbol;

core/rust/qdbr/src/parquet_write/primitive.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,16 @@ fn build_statistics<P: NativeType>(
301301

302302
// =============================================================================
303303
// SIMD-optimized functions for common types
304+
// (disabled on Linux aarch64 due to portable_simd compatibility issues)
304305
// =============================================================================
305306

307+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
306308
use crate::parquet_write::simd::{
307309
encode_f32_def_levels, encode_f64_def_levels, encode_i32_def_levels, encode_i64_def_levels,
308310
};
309311

310312
/// SIMD-optimized version for i64 slices (Long, Timestamp, Date columns).
313+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
311314
pub fn i64_slice_to_page_simd(
312315
slice: &[i64],
313316
column_top: usize,
@@ -381,6 +384,7 @@ pub fn i64_slice_to_page_simd(
381384
.map(Page::Data)
382385
}
383386

387+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
384388
fn encode_i64_plain(slice: &[i64], null_count: usize, mut buffer: Vec<u8>) -> Vec<u8> {
385389
let non_null_count = slice.len() - null_count;
386390
buffer.reserve(std::mem::size_of::<i64>() * non_null_count);
@@ -401,6 +405,7 @@ fn encode_i64_plain(slice: &[i64], null_count: usize, mut buffer: Vec<u8>) -> Ve
401405
buffer
402406
}
403407

408+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
404409
fn encode_i64_delta(slice: &[i64], null_count: usize, mut buffer: Vec<u8>) -> Vec<u8> {
405410
let iterator = slice.iter().filter(|&&x| x != i64::MIN).copied();
406411
let iterator = ExactSizedIter::new(iterator, slice.len() - null_count);
@@ -409,6 +414,7 @@ fn encode_i64_delta(slice: &[i64], null_count: usize, mut buffer: Vec<u8>) -> Ve
409414
}
410415

411416
/// SIMD-optimized version for i32 slices (Int columns).
417+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
412418
pub fn i32_slice_to_page_simd(
413419
slice: &[i32],
414420
column_top: usize,
@@ -478,6 +484,7 @@ pub fn i32_slice_to_page_simd(
478484
.map(Page::Data)
479485
}
480486

487+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
481488
fn encode_i32_plain(slice: &[i32], null_count: usize, mut buffer: Vec<u8>) -> Vec<u8> {
482489
let non_null_count = slice.len() - null_count;
483490
buffer.reserve(std::mem::size_of::<i32>() * non_null_count);
@@ -496,6 +503,7 @@ fn encode_i32_plain(slice: &[i32], null_count: usize, mut buffer: Vec<u8>) -> Ve
496503
buffer
497504
}
498505

506+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
499507
fn encode_i32_delta(slice: &[i32], null_count: usize, mut buffer: Vec<u8>) -> Vec<u8> {
500508
let iterator = slice.iter().filter(|&&x| x != i32::MIN).map(|&x| x as i64);
501509
let iterator = ExactSizedIter::new(iterator, slice.len() - null_count);
@@ -504,6 +512,7 @@ fn encode_i32_delta(slice: &[i32], null_count: usize, mut buffer: Vec<u8>) -> Ve
504512
}
505513

506514
/// SIMD-optimized version for f64 slices (Double columns).
515+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
507516
pub fn f64_slice_to_page_simd(
508517
slice: &[f64],
509518
column_top: usize,
@@ -578,6 +587,7 @@ pub fn f64_slice_to_page_simd(
578587
}
579588

580589
/// SIMD-optimized version for f32 slices (Float columns).
590+
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
581591
pub fn f32_slice_to_page_simd(
582592
slice: &[f32],
583593
column_top: usize,

0 commit comments

Comments
 (0)