Stream: t-libs/stdarch

Topic: stdarch#804


gnzlbg (Sep 17 2019 at 15:02, on Zulip):

I prefer to keep them separate

gnzlbg (Sep 17 2019 at 15:03, on Zulip):

Also this thread has the wrong topic

Luca Barbato (Sep 17 2019 at 15:38, on Zulip):

Ok... there is something fishy going with the cupid test

Luca Barbato (Sep 17 2019 at 15:39, on Zulip):

I tried to use the env-var with the cupid test, avx2 gets disabled correctly, while sse2 stays on no matter what.

Luca Barbato (Sep 17 2019 at 15:40, on Zulip):

do you see any reason why it should?

gnzlbg (Sep 17 2019 at 15:40, on Zulip):

you can't disable sse2

gnzlbg (Sep 17 2019 at 15:40, on Zulip):

its enabled at compile-time

Luca Barbato (Sep 17 2019 at 15:41, on Zulip):

Ah, ok, so it is working as intended

gnzlbg (Sep 17 2019 at 15:41, on Zulip):

you can only disable at run-time features that are not enabled for the target at compile-time

gnzlbg (Sep 17 2019 at 15:41, on Zulip):

yes that sounds right

gnzlbg (Sep 17 2019 at 15:41, on Zulip):

you can move messages here across threads

gnzlbg (Sep 17 2019 at 15:42, on Zulip):

by clicking on the message, and changing its thread

gnzlbg (Sep 17 2019 at 15:42, on Zulip):

happens quite often that one answers in the wrong thread

Luca Barbato (Sep 17 2019 at 15:42, on Zulip):

:)

Luca Barbato (Sep 17 2019 at 15:42, on Zulip):

I'm liking zulip more and more

Luca Barbato (Sep 17 2019 at 15:42, on Zulip):

so, how to make a test that works for sure?

Luca Barbato (Sep 17 2019 at 15:43, on Zulip):

run the cuvid test and expect it to fail?

gnzlbg (Sep 17 2019 at 15:43, on Zulip):

create a new build job, for x86_64

Luca Barbato (Sep 17 2019 at 15:43, on Zulip):

we need to override the env outside the test runner

gnzlbg (Sep 17 2019 at 15:43, on Zulip):

and disable, e.g., AVX using an environment variable

gnzlbg (Sep 17 2019 at 15:43, on Zulip):

then just go to std_detect, and run cargo test my_test

Luca Barbato (Sep 17 2019 at 15:44, on Zulip):

uhm can you point me to the file?

gnzlbg (Sep 17 2019 at 15:44, on Zulip):

ci/azure.yml for a new build job

gnzlbg (Sep 17 2019 at 15:44, on Zulip):

and maybe add a shell script to ci, e.g. ci/std_detect_env_override.sh that implements the test

gnzlbg (Sep 17 2019 at 15:45, on Zulip):

you can then just add a normal test to std_detect/tests/env_override.rs

Luca Barbato (Sep 17 2019 at 15:45, on Zulip):

can I copy - job: AutomaticVerification ?

gnzlbg (Sep 17 2019 at 15:45, on Zulip):

and that test should check the cfg(feature = "env override"), and check the env:: that AVX is disabled, and then check that is_x86_feature_detected!("avx") returns false, but that "avx2" is true

gnzlbg (Sep 17 2019 at 15:46, on Zulip):

you probably want to copy the Linux docker

gnzlbg (Sep 17 2019 at 15:46, on Zulip):

and in the stragegy matrix just leave x86_64-uknown-linux-gnu

gnzlbg (Sep 17 2019 at 15:46, on Zulip):

write the script locally, and then adding the build job is not a big deal at the end

gnzlbg (Sep 17 2019 at 15:47, on Zulip):

i'll comment in the PR about how to add it

Luca Barbato (Sep 17 2019 at 15:56, on Zulip):

Test prepared

Luca Barbato (Sep 17 2019 at 19:00, on Zulip):

Ouch

Luca Barbato (Sep 17 2019 at 19:00, on Zulip):

I typoed a push ...

Luca Barbato (Sep 17 2019 at 19:00, on Zulip):

Is ok to undo?

gnzlbg (Sep 17 2019 at 19:01, on Zulip):

I've commented onthe branch

gnzlbg (Sep 17 2019 at 19:01, on Zulip):

don't worry, it happens

gnzlbg (Sep 17 2019 at 19:01, on Zulip):

just create a new branch

gnzlbg (Sep 17 2019 at 19:02, on Zulip):

fix things, and open a new PR

gnzlbg (Sep 17 2019 at 19:02, on Zulip):

don't force push to master

gnzlbg (Sep 17 2019 at 19:02, on Zulip):

ever

gnzlbg (Sep 17 2019 at 19:03, on Zulip):

as in, don't try to undo things with a force push

Luca Barbato (Sep 17 2019 at 19:04, on Zulip):

In theory IF I amended correctly the branch pushed is fine.

gnzlbg (Sep 17 2019 at 19:05, on Zulip):

you'd need to rebase the branch I think

gnzlbg (Sep 17 2019 at 19:05, on Zulip):

might work or be messy

Luca Barbato (Sep 17 2019 at 19:06, on Zulip):

I was amending pub fn from_str(_s: &str) -> Result<Feature, ()> { Err(()) }

gnzlbg (Sep 17 2019 at 19:06, on Zulip):

creating a new branch from master, fixing things there, submitting a PR and letting CI run and pass is the calm way to go

gnzlbg (Sep 17 2019 at 19:06, on Zulip):

it doesn't matter that much that master is broken

Luca Barbato (Sep 17 2019 at 19:06, on Zulip):

but it happened on the wrong shell

gnzlbg (Sep 17 2019 at 19:06, on Zulip):

but since other repos use stdarch as a submodule

gnzlbg (Sep 17 2019 at 19:06, on Zulip):

we can't really force push to it

gnzlbg (Sep 17 2019 at 19:06, on Zulip):

otherwise we break those

gnzlbg (Sep 17 2019 at 19:06, on Zulip):

i understand, I've also made that mistake sometimes

Luca Barbato (Sep 17 2019 at 19:07, on Zulip):

where is the link of the current CI run?

gnzlbg (Sep 17 2019 at 19:07, on Zulip):

:D

gnzlbg (Sep 17 2019 at 19:07, on Zulip):

https://dev.azure.com/rust-lang2/stdarch/_build?definitionId=2

gnzlbg (Sep 17 2019 at 19:07, on Zulip):

all is stopped, so don't stress, when you open a new PR, we'll see what CI says

gnzlbg (Sep 17 2019 at 19:07, on Zulip):

i'm updating stdarch in rust-lang/rust

gnzlbg (Sep 17 2019 at 19:08, on Zulip):

so we have time till the next update

gnzlbg (Sep 17 2019 at 19:08, on Zulip):

(i have a PR open for that before your changes)

Luca Barbato (Sep 17 2019 at 19:09, on Zulip):

What else was to change beside the typo on Err(())?

gnzlbg (Sep 17 2019 at 19:16, on Zulip):

I don't know, ping me there if there are more errors or you get stuck

Luca Barbato (Sep 17 2019 at 20:12, on Zulip):
error[E0635]: unknown feature `stdsimd_internal`
 --> crates/std_detect/tests/features.rs:2:12
  |
2 | #![feature(stdsimd_internal)]
Luca Barbato (Sep 17 2019 at 20:13, on Zulip):

this is strange

gnzlbg (Sep 18 2019 at 07:00, on Zulip):

You can't use Feature outside of stdsimd

gnzlbg (Sep 18 2019 at 07:01, on Zulip):

In fact, I think it can be private now

gnzlbg (Sep 18 2019 at 07:02, on Zulip):

check_for can be private as well

Luca Barbato (Sep 18 2019 at 08:34, on Zulip):

You can't use Feature outside of stdsimd

that makes writing tests outside src/ problematic :)

gnzlbg (Sep 19 2019 at 07:01, on Zulip):

Yeah, that's why some test were in the source.

But to test the feature you don't need that. You should be able to observe whether the env override works by just using is_x86_feature_detected!.

gnzlbg (Sep 19 2019 at 07:01, on Zulip):

You can add a small test for from_str in src/ if you want as long as it is properly cfg(test) out

gnzlbg (Sep 19 2019 at 07:01, on Zulip):

(#[test] does that I think)

Luca Barbato (Sep 19 2019 at 08:42, on Zulip):

Sure

Last update: Nov 15 2019 at 09:45UTC