-
Notifications
You must be signed in to change notification settings - Fork 298
intrinsic-test
: Adding x86 behavioural testing.
#1894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
intrinsic-test
: Adding x86 behavioural testing.
#1894
Conversation
41db5a8
to
5fc0f3b
Compare
match str::parse::<u32>(etype_processed.as_str()) { | ||
Ok(value) => data.bit_len = Some(value), | ||
Err(_) => { | ||
data.bit_len = match data.kind() { | ||
TypeKind::Char(_) => Some(8), | ||
TypeKind::BFloat => Some(16), | ||
TypeKind::Int(_) => Some(32), | ||
TypeKind::Float => Some(32), | ||
_ => None, | ||
}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are only some type kinds covered here? Maybe this could be a method on TypeKind
?
9e28106
to
111cd5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should rebase on top of the upstream master branch instead of merging it in. That keeps the git history clean.
ci/run.sh
Outdated
x86_64-unknown-linux-gnu*) | ||
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \ | ||
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \ | ||
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \ | ||
--runner "${TEST_RUNNER}" \ | ||
--cppcompiler "${TEST_CXX_COMPILER}" \ | ||
--target "${TARGET}" | ||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll have to see how to do this exactly, but we want to split these out of the main CI job to speed it up
f3f87f2
to
2ec747c
Compare
2ec747c
to
a8313d0
Compare
Seems like the CI run at this point failed due to this error. I'll retry shortly:
|
a119be1
to
0f3900b
Compare
Notes: 1. chunk_info has been moved to `common/mod.rs` since it will be needed for all architectures
This is looking good code-wise I think, now it just needs to work :)
Looks like the command is malformed? Where does that inner |
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \ | ||
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \ | ||
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \ | ||
--runner "${TEST_RUNNER}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@folkertdev It seems like the error comes from here, but I'm not sure how the outer runner command comes to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, right, that comes from
stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
Lines 14 to 16 in 818f064
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/intel-sde/sde64 \ | |
-cpuid-in /checkout/ci/docker/x86_64-unknown-linux-gnu/cpuid.def \ | |
-rtm-mode full -tsx --" |
In other words, any cargo run
is actually run with that runner. That is useful for the unit tests, but not here where we actually want to run the intrinsic-test
binary on the host. On aarch64
etc. we don't configure the runner.
It might work if you add CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER=""
to this command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER
cannot have a zero size value, so I set it to "true"
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that'll need a comment at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read more on what "true" does.
Apparently, it simply exits successfully and does nothing else. I think this was the reason why the CI test for x86 passed, because it did not run in the first place.
Thank you so much for pointing out this one. I've changed it to be 'bash" instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still I think it's useful here to mention that you're resetting the runner, because we want to run this binary directly on the host
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've mentioned it in a comment right above this highlighted section.
By the way, even bash
failed because it cannot execute binary files. I think eval
might be a better command for this purpose.
0e37477
to
2699a55
Compare
… instead of simd_len for AVX register types)
eadffb0
to
d64935f
Compare
d64935f
to
6f9e90e
Compare
Hang on, it isn't supposed to work like this. |
3f6010e
to
6fbdf07
Compare
"{indentation}const {ty} {name}_vals[] = {values};", | ||
"{indentation}alignas(64) const {ty} {name}_vals[] = {values};", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting, I suppose we're casting values to simd vectors and then performing some sort of aligned read? In any case, can you leave a comment on why the alignment is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really, I added this as a general precautionary measure.
Fortunately when I was working on x86, there were intrinsics that helped with unaligned reads (like _mm_loadu_epi16
and the like), but I'm not sure if the same could be told for other architectures too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yes, I'll add a comment on the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@folkertdev I wish to confer with you on this. I chose 64 so that it generalizes well across 16-bit, 32-bit and 64-bit alignment requirements.
Would 64 be a good value, or is it overkill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with either 64 or remove it completely, any other inbetween value does not really make sense.
if !output.status.success() { | ||
io::stdout() | ||
.write_all(&output.stdout) | ||
.expect("Failed to write to stdout!"); | ||
io::stderr() | ||
.write_all(&output.stderr) | ||
.expect("Failed to write to stderr!"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the debug print that is part of the assert should already print the stdoud and stderr data. Is this to get better formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, you're right.
I hadn't noticed the debug print of the assert, my bad.
crates/intrinsic-test/src/arm/mod.rs
Outdated
const PLATFORM_C_HEADERS: &[&str] = &[ | ||
"iostream", | ||
"cstring", | ||
"iomanip", | ||
"sstream", | ||
"cstddef", | ||
"cstdint", | ||
"arm_neon.h", | ||
"arm_acle.h", | ||
"arm_fp16.h", | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are additional headers needed on arm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were a couple of headers that were part of common/gen_c.rs
which I had brought here.
Oh, I think cstddef
and cstdint
won't be necessary in arm
though.
@madhav-madhusoodanan there is already a version of the |
.into_iter() | ||
// Not sure how we would compare intrinsic that returns void. | ||
.filter(|i| i.results.kind() != TypeKind::Void) | ||
.filter(|i| i.results.kind() != TypeKind::BFloat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be dropped, x86 stdarch has the bfloat16
newtype that takes the place of C __bfloat16
(at least for now)
ff8a8cc
to
571eab0
Compare
…cripts that will be used in CI
571eab0
to
d3dbbd6
Compare
d4f9db8
to
adb8124
Compare
665b698
to
381a439
Compare
neatly organize C++ headers
381a439
to
e32b078
Compare
Context
This is a redo of PR #1814, since a lot of details have changed with PRs #1863, #1862, #1861, #1852.
r? @folkertdev
cc: @Amanieu