Skip to content

Commit

Permalink
fix test, appveyor, doc build, add bors
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Jul 18, 2018
1 parent 56a9e94 commit f8a9d43
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
environment:
matrix:
- TARGET: nightly-x86_64-pc-windows-msvc
- TARGET: nightly-i686-pc-windows-msvc
- TARGET: nightly-x86_64-pc-windows-gnu
Expand All @@ -11,5 +12,4 @@ install:
- rustc -vV
- cargo -vV
build: false
test_script:
- C:\msys64\usr\bin\sh ci\run.sh
test_script: C:\msys64\usr\bin\sh ci\run.sh
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ script:
- cargo generate-lockfile
- ci/run-docker.sh $TARGET $FEATURES

env:
global:
secure: "lPHv7s6+AxQYNaFncycVFQt++Y1asQmMhOikQU1ztlP8CK7+hn2m98cg/euOJyzIOb2iJ3ZX4cGZkzw4lc59MQBByb1GtDbazQoUOzVDbVfe9BDD2f8JVoIFh1CMfjPKQ7Gg/rJqWlwrUlSd5GNxPCutKjY7qZhJuR6SQbJjlWaGN2Vd4fVCzKXz8fHRXgMEZS+d+CR4Nsrkb83J3Z4s5kSdJmhYxJ61AWjuzJVwUh4l3/HEYlSL5XXpuh5R2i7W16h1PlNdaTUgkZli1lHzO8+6Q8LzX9+XiLIEVX9lw3A2NdIKGz8E/+7Qs5oYOkwYhjROsDQxIK7xkSM30bQuN7cwMBybAVIyOPJkqXQ1dQyp83KSdsOj7JMyDDRvcEDLI6ehRlm5EcdH7YrReuboN81iUo0Sa7VsuUmgj5hjERCt9r30f9aWuitABai7vKRtjglg7Sp5CrEVPA4PQs6PqKCCRogoggbXJ/Z5Dyw/RZaXPeNR9+qIKN1Vjm9Gew1sRN2JK/3+vXTKtyJXH/uBxgJt4jQlbuShOJuF+BSfTF88sMe67a/357SSOIb4JkaCyd0flDCWYE8576kaHPlVVMT2peXee0LeRXm1e13nG3Na0t3LS/orJLPHOShNQGoDj7qAP5aEKggRya896JGwtvlaBHHTmSQh65G7cyNErZo="
branches:
only:
- staging # bors r+
- trying # bors try
- master
notifications:
email:
on_success: never
env:
global:
secure: i5Am1bhaK+6Zw/7b6uBxCPW+TYsPQ1EHaL8FMp0+KBeGtvpOIT1HsZd31C2gdvWouOVB/vjhS5qWa9YtkUw47Z7skiVRXdJfO+8ZUbH3ac8MUDc2uMrIRtEn37ncdn6IdsedD0MfqJc5BmGu9DUztHQ2oMokzEXGJINOdbadrZv8XUKNx+nlXOFXq6wQln8XhjBIFCP/JTkOr8zeuQdSH/TpaYMxsgfxwy4TSSQFRUmgUOevegcbjakeWvfd6pPiis0h275Ppykm9Jjkf7/RxL6C6uVgOZKcO7qVT/22PbrJwl5kucYelZr+gWXnxh65wyLXIy+t//6B1/3dhwuyr6U/LlxesvB8ZnS8Bt0cA4Loxh6yX/TTYTg734O56hjXRU6rlJW6RaaO6Vukv2s8kU+LhCSWijMtwRf7c2H0K1tksBT9wRZQZ06QxnR7P7jN48/QqAp1QZdT7jhXvOr8s7ROsJhbku0scUAOoNfTZ47SHjbMxGc7klI31BhaxFeaNsWAZMyIeigebhJ8gnZcPDO78J/6svBb83AgMLRPaO4l9y1png4iLdtXtkxr0S8F8pAf9VnDVSJBH6SN9/d7dRa1QwpNDpVcW52GEY5OQkVJ1Xkp9xbnW5nJpOXQIeJeix8VwsUXX289MUyPfOxDQhRCzeSExqks7P1veL+TNss=
3 changes: 3 additions & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
status = [
"continuous-integration/travis-ci/push"
]
2 changes: 1 addition & 1 deletion ci/dox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ cargo doc
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
pip install ghp_import --install-option="--prefix=$HOME/.local"
$HOME/.local/bin/ghp-import -n target/doc
git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
git push -qf https://${GH_PAGES}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
fi
164 changes: 126 additions & 38 deletions src/api/reductions/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,19 @@ macro_rules! test_reduction_float_min_max {

let v0 = $id::splat(-3.);

let target_with_broken_last_lane_nan = !cfg!(any(
target_arch = "arm", target_arch = "aarch64",
all(target_arch = "x86", not(target_feature = "sse2"))
));

// The vector is initialized to `-3.`s: [-3, -3, -3, -3]
for i in 0..$id::lanes() {
// We replace the i-th element of the vector with `NaN`: [-3, -3, -3, NaN]
let mut v = v0.replace(i, n);
if i == $id::lanes() - 1 &&
!cfg!(any(
target_arch = "arm", target_arch = "aarch64",
all(target_arch = "x86", not(target_feature = "sse2"))
))
{

// If the NaN is in the last place, the LLVM implementation of these methods
// is broken on some targets:
if i == $id::lanes() - 1 && target_with_broken_last_lane_nan {
// FIXME (https://github.com/rust-lang-nursery/stdsimd/issues/408):
//
// If there is a NaN, the result should always the smallest element,
Expand All @@ -137,38 +142,75 @@ macro_rules! test_reduction_float_min_max {
//
// These asserts detect if this behavior changes
assert!(v.min_element().is_nan(), // FIXME: should be -3.
"[C]: nan at {} => {} | {:?}",
i, v.min_element(), v);
"[A]: nan at {} => {} | {:?}",
i, v.min_element(), v);

// If we replace all the elements in the vector up-to the `i-th` lane
// with `NaN`s, the result is still always `-3.` unless all
// elements of the vector are `NaN`s:
//
// This is also broken:
for j in 0..i {
v = v.replace(j, n);
assert!(v.min_element().is_nan(), // FIXME: should be -3.
"[D]: nan at {} => {} | {:?}",
"[B]: nan at {} => {} | {:?}",
i, v.min_element(), v);
}

// We are done here, since we were in the last lane which
// is the last iteration of the loop.
break
}
if i == $id::lanes() - 1 && !cfg!(any(
target_arch = "arm", target_arch = "aarch64",
all(target_arch = "x86", not(target_feature = "sse2"))
)) {
assert!(false, "this cannot happen, idx: {}, lanes: {}", i, $id::lanes());

// We are not in the last lane, and there is only one `NaN`
// in the vector.

// If the vector has one lane, the result is `NaN`:
if $id::lanes() == 1 {
assert!(v.min_element().is_nan(),
"[C]: all nans | v={:?} | min={} | is_nan: {}",
v, v.min_element(), v.min_element().is_nan());

// And we are done, since the vector only has one lane anyways.
break;
}

// The vector has more than one lane, since there is only
// one `NaN` in the vector, the result is always `-3`.
assert_eq!(v.min_element(), -3.,
"[A]: nan at {} => {} | {:?}",
"[D]: nan at {} => {} | {:?}",
i, v.min_element(), v);

// If we replace all the elements in the vector up-to the `i-th` lane
// with `NaN`s, the result is still always `-3.` unless all
// elements of the vector are `NaN`s:
for j in 0..i {
v = v.replace(j, n);
assert_eq!(v.min_element(), -3.,
"[B]: nan at {} => {} | {:?}",
i, v.min_element(), v);

if i == $id::lanes() - 1 && j == i - 1 {
// All elements of the vector are `NaN`s, therefore the
// result is NaN as well.
//
// Note: the #lanes of the vector is > 1, so "i - 1" does not
// overflow.
assert!(v.min_element().is_nan(),
"[E]: all nans | v={:?} | min={} | is_nan: {}",
v, v.min_element(), v.min_element().is_nan());
} else {
// There are non-`NaN` elements in the vector, therefore
// the result is `-3.`:
assert_eq!(v.min_element(), -3.,
"[F]: nan at {} => {} | {:?}",
i, v.min_element(), v);
}
}
}

// If the vector contains all NaNs the result is NaN:
let vn = $id::splat(n);
assert!(vn.min_element().is_nan(),
assert!($id::splat(n).min_element().is_nan(),
"all nans | v={:?} | min={} | is_nan: {}",
vn, vn.min_element(), vn.min_element().is_nan());
$id::splat(n), $id::splat(n).min_element(),
$id::splat(n).min_element().is_nan());
}
#[test]
fn max_element_test() {
Expand All @@ -179,11 +221,18 @@ macro_rules! test_reduction_float_min_max {

let v0 = $id::splat(-3.);

let target_with_broken_last_lane_nan = !cfg!(any(
target_arch = "arm", target_arch = "aarch64"
));

// The vector is initialized to `-3.`s: [-3, -3, -3, -3]
for i in 0..$id::lanes() {
// We replace the i-th element of the vector with `NaN`: [-3, -3, -3, NaN]
let mut v = v0.replace(i, n);
if i == $id::lanes() - 1 &&
!cfg!(any(target_arch = "arm", target_arch = "aarch64"))
{

// If the NaN is in the last place, the LLVM implementation of these methods
// is broken on some targets:
if i == $id::lanes() - 1 && target_with_broken_last_lane_nan {
// FIXME (https://github.com/rust-lang-nursery/stdsimd/issues/408):
//
// If there is a NaN, the result should always the largest element,
Expand All @@ -195,36 +244,75 @@ macro_rules! test_reduction_float_min_max {
//
// These asserts detect if this behavior changes
assert!(v.max_element().is_nan(), // FIXME: should be -3.
"[C]: nan at {} => {} | {:?}",
i, v.max_element(), v);
"[A]: nan at {} => {} | {:?}",
i, v.max_element(), v);

// If we replace all the elements in the vector up-to the `i-th` lane
// with `NaN`s, the result is still always `-3.` unless all
// elements of the vector are `NaN`s:
//
// This is also broken:
for j in 0..i {
v = v.replace(j, n);
assert!(v.max_element().is_nan(), // FIXME: should be -3.
"[D]: nan at {} => {} | {:?}",
i, v.max_element(), v);
"[B]: nan at {} => {} | {:?}",
i, v.max_element(), v);
}

// We are done here, since we were in the last lane which
// is the last iteration of the loop.
break
}

if i == $id::lanes() - 1 &&
cfg!(any(target_arch = "arm", target_arch = "aarch64")) {
assert!(false, "this cannot happen");
// We are not in the last lane, and there is only one `NaN`
// in the vector.

// If the vector has one lane, the result is `NaN`:
if $id::lanes() == 1 {
assert!(v.max_element().is_nan(),
"[C]: all nans | v={:?} | min={} | is_nan: {}",
v, v.max_element(), v.max_element().is_nan());

// And we are done, since the vector only has one lane anyways.
break;
}

// The vector has more than one lane, since there is only
// one `NaN` in the vector, the result is always `-3`.
assert_eq!(v.max_element(), -3.,
"[A]: nan at {} => {} | {:?}",
"[D]: nan at {} => {} | {:?}",
i, v.max_element(), v);

// If we replace all the elements in the vector up-to the `i-th` lane
// with `NaN`s, the result is still always `-3.` unless all
// elements of the vector are `NaN`s:
for j in 0..i {
v = v.replace(j, n);
assert_eq!(v.max_element(), -3.,
"[B]: nan at {} => {} | {:?}",
i, v.max_element(), v);

if i == $id::lanes() - 1 && j == i - 1 {
// All elements of the vector are `NaN`s, therefore the
// result is NaN as well.
//
// Note: the #lanes of the vector is > 1, so "i - 1" does not
// overflow.
assert!(v.max_element().is_nan(),
"[E]: all nans | v={:?} | max={} | is_nan: {}",
v, v.max_element(), v.max_element().is_nan());
} else {
// There are non-`NaN` elements in the vector, therefore
// the result is `-3.`:
assert_eq!(v.max_element(), -3.,
"[F]: nan at {} => {} | {:?}",
i, v.max_element(), v);
}
}
}

// If the vector contains all NaNs the result is NaN:
let vn = $id::splat(n);
assert!(vn.max_element().is_nan(),
assert!($id::splat(n).max_element().is_nan(),
"all nans | v={:?} | max={} | is_nan: {}",
vn, vn.max_element(), vn.max_element().is_nan());
$id::splat(n), $id::splat(n).max_element(),
$id::splat(n).max_element().is_nan());
}
}
}
Expand Down

0 comments on commit f8a9d43

Please sign in to comment.