diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-orjson')
2 files changed, 71 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-orjson/0001-Guard-avx512-module-with-x86-target-cfg.patch b/meta-python/recipes-devtools/python/python3-orjson/0001-Guard-avx512-module-with-x86-target-cfg.patch new file mode 100644 index 0000000000..604030e062 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-orjson/0001-Guard-avx512-module-with-x86-target-cfg.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From c5c46664a914d3a7f048c51c3b9c2ab13e21ed1b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tim Orling <tim.orling@konsulko.com> | ||
| 3 | Date: Thu, 29 Jan 2026 09:59:55 -0800 | ||
| 4 | Subject: [PATCH] Guard avx512 module with x86 target cfg | ||
| 5 | |||
| 6 | The avx512.rs module contains x86_64-specific intrinsics and target | ||
| 7 | features that are not valid on non-x86 architectures like RISC-V. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [Rejected by upstream https://github.com/ijl/orjson/pull/609] | ||
| 10 | |||
| 11 | Signed-off-by: Tim Orling <tim.orling@konsulko.com> | ||
| 12 | --- | ||
| 13 | src/ffi/pystrref/avx512.rs | 2 ++ | ||
| 14 | 1 file changed, 2 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/src/ffi/pystrref/avx512.rs b/src/ffi/pystrref/avx512.rs | ||
| 17 | index e4c7697..46450ac 100644 | ||
| 18 | --- a/src/ffi/pystrref/avx512.rs | ||
| 19 | +++ b/src/ffi/pystrref/avx512.rs | ||
| 20 | @@ -3,12 +3,14 @@ | ||
| 21 | |||
| 22 | use super::pyunicode_new::*; | ||
| 23 | |||
| 24 | +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||
| 25 | use core::arch::x86_64::{ | ||
| 26 | _mm512_and_si512, _mm512_cmpgt_epu8_mask, _mm512_cmpneq_epi8_mask, _mm512_loadu_epi8, | ||
| 27 | _mm512_mask_cmpneq_epi8_mask, _mm512_maskz_loadu_epi8, _mm512_max_epu8, _mm512_set1_epi8, | ||
| 28 | }; | ||
| 29 | |||
| 30 | #[inline(never)] | ||
| 31 | +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||
| 32 | #[target_feature(enable = "avx512f,avx512bw,avx512vl,bmi2")] | ||
| 33 | pub(crate) unsafe fn create_str_impl_avx512vl(buf: &str) -> *mut crate::ffi::PyObject { | ||
| 34 | unsafe { | ||
| 35 | -- | ||
| 36 | 2.39.5 | ||
| 37 | |||
diff --git a/meta-python/recipes-devtools/python/python3-orjson/0002-Guard-x86-feature-detection-macro-in-pystrref-object.patch b/meta-python/recipes-devtools/python/python3-orjson/0002-Guard-x86-feature-detection-macro-in-pystrref-object.patch new file mode 100644 index 0000000000..59105e723c --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-orjson/0002-Guard-x86-feature-detection-macro-in-pystrref-object.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | From 7ef16220caaa82f7a90047c8c9b5ff2eeb15b9ce Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tim Orling <tim.orling@konsulko.com> | ||
| 3 | Date: Thu, 29 Jan 2026 10:22:31 -0800 | ||
| 4 | Subject: [PATCH 2/2] Guard x86 feature detection macro in pystrref/object.rs | ||
| 5 | |||
| 6 | The std::is_x86_feature_detected! macro only works on x86/x86_64 | ||
| 7 | targets. This patch wraps the feature detection and AVX-512 code path | ||
| 8 | with cfg guards to allow compilation on non-x86 architectures. | ||
| 9 | |||
| 10 | On non-x86 targets, the code will fall through to the generic | ||
| 11 | implementation instead of attempting AVX-512 optimizations. | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [Rejected by upstream https://github.com/ijl/orjson/pull/609] | ||
| 14 | |||
| 15 | Signed-off-by: Tim Orling <tim.orling@konsulko.com> | ||
| 16 | --- | ||
| 17 | src/ffi/pystrref/object.rs | 1 + | ||
| 18 | 1 file changed, 1 insertion(+) | ||
| 19 | |||
| 20 | diff --git a/src/ffi/pystrref/object.rs b/src/ffi/pystrref/object.rs | ||
| 21 | index 9ef12eb..7c2c046 100644 | ||
| 22 | --- a/src/ffi/pystrref/object.rs | ||
| 23 | +++ b/src/ffi/pystrref/object.rs | ||
| 24 | @@ -29,6 +29,7 @@ static mut STR_CREATE_FN: StrDeserializer = super::scalar::str_impl_kind_scalar; | ||
| 25 | |||
| 26 | pub fn set_str_create_fn() { | ||
| 27 | unsafe { | ||
| 28 | + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||
| 29 | #[cfg(all(CPython, feature = "avx512"))] | ||
| 30 | if std::is_x86_feature_detected!("avx512vl") { | ||
| 31 | STR_CREATE_FN = super::avx512::create_str_impl_avx512vl; | ||
| 32 | -- | ||
| 33 | 2.39.5 | ||
| 34 | |||
