Skip to content

Commit

Permalink
Provide separate instructions in the case that FMA is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
ggaspersic committed Oct 12, 2023
1 parent fc2a416 commit 9112912
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/block_ffm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,20 @@ unsafe fn prepare_contra_field_without_feature_value(
}

#[inline(always)]
#[cfg(not(target_feature = "fma"))]
unsafe fn prepare_contra_field_with_feature_value(
contra_fields_ptr: *mut f32,
ffm_weights_ptr: *const f32,
feature_value: __m128,
) {
let contra_fields = _mm_loadu_ps(contra_fields_ptr);
let ffm_weights = _mm_loadu_ps(ffm_weights_ptr);
let acc = _mm_add_ps(_mm_mul_ps(ffm_weights, feature_value), contra_fields);
_mm_storeu_ps(contra_fields_ptr, acc);
}

#[inline(always)]
#[cfg(target_feature = "fma")]
unsafe fn prepare_contra_field_with_feature_value(
contra_fields_ptr: *mut f32,
ffm_weights_ptr: *const f32,
Expand Down

0 comments on commit 9112912

Please sign in to comment.