Skip to content

Commit 1cc0c40

Browse files
committed
[utils] fix xxh3
1 parent a3fd47c commit 1cc0c40

3 files changed

Lines changed: 21 additions & 10 deletions

File tree

src/uwvm2/parser/wasm/standard/wasm1/features/function_section.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features
389389
//
390390
// You can use macro UWVM_ENABLE_SME_SVE_STREAM_MODE to enable SVE stream mode in SME in the above cpu (e.g. Apple M4).
391391

392+
// SME SVE STREAM MODE: The always_inline attribute cannot be added here because it does not match the function call.
392393
[&]
393394
# if (defined(UWVM_ENABLE_SME_SVE_STREAM_MODE) && defined(__ARM_FEATURE_SME)) && !defined(__ARM_FEATURE_SVE)
394395
__arm_locally_streaming

src/uwvm2/parser/wasm/utils/base.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::utils
4949
UWVM_GNU_ALWAYS_INLINE_ARTIFICIAL inline constexpr I& counter_selfinc_throw_when_overflow(I & i,
5050
::std::byte const* section_curr,
5151
::uwvm2::parser::wasm::base::error_impl& err) UWVM_THROWS
52+
#if defined(__ARM_FEATURE_SME)
53+
__arm_streaming_compatible
54+
#endif
5255
{
5356
if(i == ::std::numeric_limits<I>::max()) [[unlikely]]
5457
{
@@ -66,6 +69,9 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::utils
6669
I add,
6770
::std::byte const* section_curr,
6871
::uwvm2::parser::wasm::base::error_impl& err) UWVM_THROWS
72+
#if defined(__ARM_FEATURE_SME)
73+
__arm_streaming_compatible
74+
#endif
6975
{
7076
#if defined(_MSC_VER) && !defined(__clang__)
7177
if UWVM_IF_NOT_CONSTEVAL
@@ -233,7 +239,10 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::utils
233239
UWVM_GNU_ALWAYS_INLINE_ARTIFICIAL inline constexpr I& counter_addass_throw_when_overflow(I & i,
234240
I add,
235241
::std::byte const* section_curr,
236-
::uwvm2::parser::wasm::base::error_impl& err) UWVM_THROWS
242+
::uwvm2::parser::wasm::base::error_impl& err) UWVM_THROWS
243+
#if defined(__ARM_FEATURE_SME)
244+
__arm_streaming_compatible
245+
#endif
237246
{
238247
return i = counter_add_throw_when_overflow(i, add, section_curr, err);
239248
}

src/uwvm2/utils/hash/xxh3.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::utils::hash
820820
#elif __has_cpp_attribute(__gnu__::__vector_size__) && defined(__LITTLE_ENDIAN__) && \
821821
((defined(UWVM_ENABLE_SME_SVE_STREAM_MODE) && defined(__ARM_FEATURE_SME)) && !defined(__ARM_FEATURE_SVE))
822822

823+
// The always_inline attribute cannot be added here because it does not match the function call.
823824
[=] __arm_locally_streaming() constexpr noexcept -> void
824825
{
825826
auto const acc_64aligned{::std::assume_aligned<64uz>(acc)};
@@ -836,7 +837,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::utils::hash
836837
{
837838
auto mask{::uwvm2::utils::intrinsics::arm_sve::svptrue_pat_b64(::uwvm2::utils::intrinsics::arm_sve::SV_VL8)};
838839
auto vacc{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc)};
839-
auto accrnd{[&] UWVM_ALWAYS_INLINE(::uwvm2::utils::intrinsics::arm_sve::svuint64_t & acc, unsigned offset) constexpr noexcept -> void
840+
auto accrnd{[&] UWVM_ALWAYS_INLINE(::uwvm2::utils::intrinsics::arm_sve::svuint64_t & acc, unsigned offset) constexpr noexcept __arm_streaming-> void
840841
{
841842
auto const input_vec{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xinput + offset)};
842843
auto const secret_vec{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xsecret + offset)};
@@ -853,11 +854,11 @@ UWVM_MODULE_EXPORT namespace uwvm2::utils::hash
853854
else if(element_count == 2u)
854855
{ /* sve128 */
855856
auto mask{::uwvm2::utils::intrinsics::arm_sve::svptrue_pat_b64(::uwvm2::utils::intrinsics::arm_sve::SV_VL2)};
856-
auto acc0{svld1_u64(mask, xacc + 0u)};
857-
auto acc1{svld1_u64(mask, xacc + 2u)};
858-
auto acc2{svld1_u64(mask, xacc + 4u)};
859-
auto acc3{svld1_u64(mask, xacc + 6u)};
860-
auto accrnd{[&] UWVM_ALWAYS_INLINE(::uwvm2::utils::intrinsics::arm_sve::svuint64_t & acc, unsigned offset) constexpr noexcept -> void
857+
auto acc0{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc + 0u)};
858+
auto acc1{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc + 2u)};
859+
auto acc2{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc + 4u)};
860+
auto acc3{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc + 6u)};
861+
auto accrnd{[&] UWVM_ALWAYS_INLINE(::uwvm2::utils::intrinsics::arm_sve::svuint64_t & acc, unsigned offset) constexpr noexcept __arm_streaming-> void
861862
{
862863
auto const input_vec{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xinput + offset)};
863864
auto const secret_vec{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xsecret + offset)};
@@ -880,9 +881,9 @@ UWVM_MODULE_EXPORT namespace uwvm2::utils::hash
880881
else
881882
{
882883
auto mask{::uwvm2::utils::intrinsics::arm_sve::svptrue_pat_b64(::uwvm2::utils::intrinsics::arm_sve::SV_VL4)};
883-
auto acc0{svld1_u64(mask, xacc + 0u)};
884-
auto acc1{svld1_u64(mask, xacc + 4u)};
885-
auto accrnd{[&] UWVM_ALWAYS_INLINE(::uwvm2::utils::intrinsics::arm_sve::svuint64_t & acc, unsigned offset) constexpr noexcept -> void
884+
auto acc0{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc + 0u)};
885+
auto acc1{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xacc + 4u)};
886+
auto accrnd{[&] UWVM_ALWAYS_INLINE(::uwvm2::utils::intrinsics::arm_sve::svuint64_t & acc, unsigned offset) constexpr noexcept __arm_streaming -> void
886887
{
887888
auto const input_vec{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xinput + offset)};
888889
auto const secret_vec{::uwvm2::utils::intrinsics::arm_sve::svld1_u64(mask, xsecret + offset)};

0 commit comments

Comments
 (0)