Skip to content

add rtm cpu feature intrinsics - #726

Merged
gnzlbg merged 9 commits into
rust-lang:masterfrom
mtak-:rtm-cpu-feature
Apr 25, 2019
Merged

add rtm cpu feature intrinsics#726
gnzlbg merged 9 commits into
rust-lang:masterfrom
mtak-:rtm-cpu-feature

Conversation

@mtak-

Copy link
Copy Markdown
Contributor

Blocked by rust-lang/rust#60060

This does not include any HLE functions (xacquire/xrelease prefixed operations).

Let me know what needs changing.

Comment threadcrates/core_arch/src/x86/rtm.rs Outdated

@gnzlbggnzlbg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review, this looks good to me.

Comment threadcrates/core_arch/src/x86/rtm.rs Outdated
Comment threadcrates/core_arch/src/x86/rtm.rs Outdated
Comment threadcrates/core_arch/src/x86/rtm.rs

@gnzlbggnzlbg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Can you ping me here when the upstream PR is merged? (or did that already happen?) I'll re-run CI then and merge it when its green.

@mtak-

Copy link
Copy Markdown
ContributorAuthor

Thanks! It's merged, but not yet in nightly AFAICT. I'll ping you.

#[inline]
#[target_feature(enable = "rtm")]
#[cfg_attr(test, assert_instr(xtest))]
pub unsafe fn _xtest() -> u8 {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just changed this to return u8 to match intel headers more directly. It is specified to always be 0 or 1.

Additionally, if/when stdsimd later adds HLE intrinsics, _xtest should be enabled if either hle or rtm is supported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, if/when stdsimd later adds HLE intrinsics, _xtest should be enabled if either hle or rtm is supported.

I don't think this is something that can be easily supported. We need to know which features are available when generating code for this intrinsic, so it is either rtm, or hle, or both. But if its rtm or hle, then we need to generate different code depending on the answer to which one is it.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the intel docs say either HLE or RTM. The instruction set reference for xtest says under "CPUID Feature Flag": HLE or RTM.

we need to generate different code depending on the answer to which one is it.

Does that mean we need a duplicate of _xtest (_hletest) in any future hle.rs module?

@gnzlbg This should be ready to run through travis now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_xtest&expand=6168 says RTM CPUID flag only.

Does that mean we need a duplicate of _xtest (_hletest) in any future hle.rs module?

That's what it would mean, but that would be very weird. It seems more likely that the link you posted is incorrect, you might want to ask Intel for clarification in their forums.

@gnzlbggnzlbg closed this Apr 21, 2019
@gnzlbggnzlbg reopened this Apr 21, 2019
@gnzlbggnzlbg closed this Apr 23, 2019
@gnzlbggnzlbg reopened this Apr 23, 2019
@gnzlbg

Copy link
Copy Markdown
Contributor

Can you rebase on top of master?

@mtak-

Copy link
Copy Markdown
ContributorAuthor

I have already done so. verify signatures on master is broken on CI after #733.

---- verify_all_signatures stdout ----
failed to verify `_rdtsc`
* failed to equate: `__int64` and PrimUnsigned(64) for _rdtsc
thread 'verify_all_signatures' panicked at 'assertion failed: all_valid', crates/stdsimd-verify/tests/x86-intel.rs:186:5

@gnzlbg

Copy link
Copy Markdown
Contributor

Oh I thought the fix for that already had landed!

@gnzlbg
gnzlbg merged commit 8b5aa3a into rust-lang:masterApr 25, 2019
@gnzlbg

Copy link
Copy Markdown
Contributor

Thank you @mtak- for working on this!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mtak-@gnzlbg