qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated
@ 2019-11-03  4:26 Shawn Landden
  2019-11-03  4:31 ` [Bug 1851095] " Shawn Landden
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Shawn Landden @ 2019-11-03  4:26 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

While qemu's scalar emulation tends to be excellent, qemu's SIMD
emulation tends to be incorrect (except for arm64 from x86_64)--i have
found this both for mipsel and arm32. Until these code paths are
audited, which is probably a large job, it would be nice if qemu knew
its emulation of this class of instructions was not very good, and thus
it would give up on finding these instructions if a "careful" operation
is passed.

** Affects: qemu
     Importance: Undecided
         Status: New

** Description changed:

  While qemu's scalar emulation tends to be excellent, qemu's SIMD
- emulation tends to be incorrect (except for arm64 from x86_64). Until
- these code paths are audited, which is probably a large job, it would be
- nice if qemu knew its emulation of this class of instructions was not
- very good, and thus it would give up on finding these instructions if a
- "careful" operation is passed.
+ emulation tends to be incorrect (except for arm64 from x86_64)--i have
+ found this both for mipsel and arm32. Until these code paths are
+ audited, which is probably a large job, it would be nice if qemu knew
+ its emulation of this class of instructions was not very good, and thus
+ it would give up on finding these instructions if a "careful" operation
+ is passed.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
@ 2019-11-03  4:31 ` Shawn Landden
  2019-11-03  9:52 ` [Bug 1851095] [NEW] " Peter Maydell
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Shawn Landden @ 2019-11-03  4:31 UTC (permalink / raw)
  To: qemu-devel

Here is a pull request for the zig language that runs into this problems
in qemu https://github.com/ziglang/zig/pull/2945/

I have more code for validation if someone is working on this.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
  2019-11-03  4:31 ` [Bug 1851095] " Shawn Landden
@ 2019-11-03  9:52 ` Peter Maydell
  2019-11-03  9:52   ` Peter Maydell
  2019-11-03 15:25 ` [Bug 1851095] " Shawn Landden
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2019-11-03  9:52 UTC (permalink / raw)
  To: Bug 1851095; +Cc: QEMU Developers

On Sun, 3 Nov 2019 at 04:41, Shawn Landden <1851095@bugs.launchpad.net> wrote:
> While qemu's scalar emulation tends to be excellent, qemu's SIMD
> emulation tends to be incorrect (except for arm64 from x86_64)--i have
> found this both for mipsel and arm32. Until these code paths are
> audited, which is probably a large job, it would be nice if qemu knew
> its emulation of this class of instructions was not very good, and thus
> it would give up on finding these instructions if a "careful" operation
> is passed.

I'm not sure how this could work. If QEMU reports (via ID regs
etc) to the guest that it supports instruction class X when it
does not, that's a bug and we should fix it. If QEMU implements
an instruction but gets it wrong, that's also a bug and we should
fix it. In both cases, we'd need to have specific bug reports,
ideally with reproduce-cases. But we don't really have "known
areas where the emulation is incorrect" that we could somehow
differentiate and disable (except at a very vague level, eg
"probably better not to rely on the x86 emulation").

You might be able by careful selection of the cpu type to avoid
CPUs which implement vector operations. Some architectures
also allow individual CPU features to be disabled with extra
'-foo' qualifiers on the -cpu argument.

For Arm in particular (32 or 64 bit) I believe our implementation
should be correct and am happy to look at bug reports for that.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated
  2019-11-03  9:52 ` [Bug 1851095] [NEW] " Peter Maydell
@ 2019-11-03  9:52   ` Peter Maydell
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2019-11-03  9:52 UTC (permalink / raw)
  To: qemu-devel

On Sun, 3 Nov 2019 at 04:41, Shawn Landden <1851095@bugs.launchpad.net> wrote:
> While qemu's scalar emulation tends to be excellent, qemu's SIMD
> emulation tends to be incorrect (except for arm64 from x86_64)--i have
> found this both for mipsel and arm32. Until these code paths are
> audited, which is probably a large job, it would be nice if qemu knew
> its emulation of this class of instructions was not very good, and thus
> it would give up on finding these instructions if a "careful" operation
> is passed.

I'm not sure how this could work. If QEMU reports (via ID regs
etc) to the guest that it supports instruction class X when it
does not, that's a bug and we should fix it. If QEMU implements
an instruction but gets it wrong, that's also a bug and we should
fix it. In both cases, we'd need to have specific bug reports,
ideally with reproduce-cases. But we don't really have "known
areas where the emulation is incorrect" that we could somehow
differentiate and disable (except at a very vague level, eg
"probably better not to rely on the x86 emulation").

You might be able by careful selection of the cpu type to avoid
CPUs which implement vector operations. Some architectures
also allow individual CPU features to be disabled with extra
'-foo' qualifiers on the -cpu argument.

For Arm in particular (32 or 64 bit) I believe our implementation
should be correct and am happy to look at bug reports for that.

thanks
-- PMM

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
  2019-11-03  4:31 ` [Bug 1851095] " Shawn Landden
  2019-11-03  9:52 ` [Bug 1851095] [NEW] " Peter Maydell
@ 2019-11-03 15:25 ` Shawn Landden
  2019-11-04 13:06 ` Laurent Desnogues
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Shawn Landden @ 2019-11-03 15:25 UTC (permalink / raw)
  To: qemu-devel

ok, here is a double precision exponent implementation that works on
arm32 hardware, but fails in qemu with the wrong checksum.
https://github.com/shawnl/zig-libmvec/blob/master/exp.zig

You need to build zig with the above patch-set.

I guess I am starting from a pessimistic perspective, where I have only
ever seen SIMD work with arm64 emulation (which is quite new), and am
sorry for that.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
                   ` (2 preceding siblings ...)
  2019-11-03 15:25 ` [Bug 1851095] " Shawn Landden
@ 2019-11-04 13:06 ` Laurent Desnogues
  2019-11-04 20:18 ` Shawn Landden
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Laurent Desnogues @ 2019-11-04 13:06 UTC (permalink / raw)
  To: qemu-devel

Can you please provide a binary (preferably statically built or with
required shared libraries attached)?

Thanks,

Laurent

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
                   ` (3 preceding siblings ...)
  2019-11-04 13:06 ` Laurent Desnogues
@ 2019-11-04 20:18 ` Shawn Landden
  2019-11-04 20:32 ` Shawn Landden
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Shawn Landden @ 2019-11-04 20:18 UTC (permalink / raw)
  To: qemu-devel

example binary doing double-precision exponent on 16 megs

expected output:

checksum: f181b401cd42aa7b

actual output:

checksum: 4004022b0ba624fb


** Attachment added: "bench_simple"
   https://bugs.launchpad.net/qemu/+bug/1851095/+attachment/5302817/+files/bench_simple

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
                   ` (4 preceding siblings ...)
  2019-11-04 20:18 ` Shawn Landden
@ 2019-11-04 20:32 ` Shawn Landden
  2019-11-04 20:51 ` Shawn Landden
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Shawn Landden @ 2019-11-04 20:32 UTC (permalink / raw)
  To: qemu-devel

Here is the same thing compiled with optimizations on

** Attachment added: "bench_simple"
   https://bugs.launchpad.net/qemu/+bug/1851095/+attachment/5302825/+files/bench_simple

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  New

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
                   ` (5 preceding siblings ...)
  2019-11-04 20:32 ` Shawn Landden
@ 2019-11-04 20:51 ` Shawn Landden
  2019-11-04 22:44 ` Alex Bennée
  2019-11-04 23:20 ` Aleksandar Markovic
  8 siblings, 0 replies; 11+ messages in thread
From: Shawn Landden @ 2019-11-04 20:51 UTC (permalink / raw)
  To: qemu-devel

appears the random number generator produces different results on 32-bit
arches, while my code seems to work fine in qemu

** Changed in: qemu
       Status: New => Invalid

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  Invalid

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
                   ` (6 preceding siblings ...)
  2019-11-04 20:51 ` Shawn Landden
@ 2019-11-04 22:44 ` Alex Bennée
  2019-11-04 23:20 ` Aleksandar Markovic
  8 siblings, 0 replies; 11+ messages in thread
From: Alex Bennée @ 2019-11-04 22:44 UTC (permalink / raw)
  To: qemu-devel

I can confirm bench_simple gives the same result on both qemu-arm and my
aarch32 hardware.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  Invalid

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug 1851095] Re: [feature request] awareness of instructions that are well emulated
  2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
                   ` (7 preceding siblings ...)
  2019-11-04 22:44 ` Alex Bennée
@ 2019-11-04 23:20 ` Aleksandar Markovic
  8 siblings, 0 replies; 11+ messages in thread
From: Aleksandar Markovic @ 2019-11-04 23:20 UTC (permalink / raw)
  To: qemu-devel

Can you provide a clearer repro example of what doesn't wirk on mipsel
platform?

In last two QEMU releases mips (Wave) developers went to great lenghts
making sure both mips SIMD and mips FP instructions (in both scalar and
vector variants) are emulated properly. Some of the unit tests were
published, but also many were left internal, and there are many
integration tests devised and run as well. We in mips (Wave) consider
these two areas well tested. Still, we'll consider seriuosly fixing your
example, if you prove experimentally that this is a mips-related bug,
but just provides us with a reasonably convenient repro procedure.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1851095

Title:
  [feature request] awareness of instructions that are well emulated

Status in QEMU:
  Invalid

Bug description:
  While qemu's scalar emulation tends to be excellent, qemu's SIMD
  emulation tends to be incorrect (except for arm64 from x86_64)--i have
  found this both for mipsel and arm32. Until these code paths are
  audited, which is probably a large job, it would be nice if qemu knew
  its emulation of this class of instructions was not very good, and
  thus it would give up on finding these instructions if a "careful"
  operation is passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1851095/+subscriptions


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-11-04 23:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-03  4:26 [Bug 1851095] [NEW] [feature request] awareness of instructions that are well emulated Shawn Landden
2019-11-03  4:31 ` [Bug 1851095] " Shawn Landden
2019-11-03  9:52 ` [Bug 1851095] [NEW] " Peter Maydell
2019-11-03  9:52   ` Peter Maydell
2019-11-03 15:25 ` [Bug 1851095] " Shawn Landden
2019-11-04 13:06 ` Laurent Desnogues
2019-11-04 20:18 ` Shawn Landden
2019-11-04 20:32 ` Shawn Landden
2019-11-04 20:51 ` Shawn Landden
2019-11-04 22:44 ` Alex Bennée
2019-11-04 23:20 ` Aleksandar Markovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).