Skip to content
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

impossible constraint in 'asm' #80

Closed
nomeata opened this issue Jun 1, 2015 · 5 comments
Closed

impossible constraint in 'asm' #80

nomeata opened this issue Jun 1, 2015 · 5 comments

Comments

@nomeata
Copy link
Contributor

nomeata commented Jun 1, 2015

Hi,

criterion-1.1.0.0 fails to build on arm* and powerpc:

[13 of 13] Compiling Criterion        ( Criterion.hs, dist-ghc/build/Criterion.p_o )
cbits/cycles.c: In function 'criterion_rdtsc':

cbits/cycles.c:6:3:
     error: impossible constraint in 'asm'
       __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
       ^
make: *** [build-ghc-stamp] Error 1
/usr/share/cdbs/1/class/hlibrary.mk:133: recipe for target 'build-ghc-stamp' failed

https://buildd.debian.org/status/fetch.php?pkg=haskell-criterion&arch=armel&ver=1.1.0.0-2&stamp=1430704376
https://buildd.debian.org/status/fetch.php?pkg=haskell-criterion&arch=armhf&ver=1.1.0.0-2&stamp=1430808023
https://buildd.debian.org/status/fetch.php?pkg=haskell-criterion&arch=powerpc&ver=1.1.0.0-2&stamp=1431220028

Do you have an idea what’s wrong and how to fix it?

@bos
Copy link
Collaborator

bos commented Jun 9, 2015

That's some inline assembly code that only works on i386 and x86_64. You'll want to write some sort of equivalent code for other platforms, ideally using a cycle-accurate counter like the x86 TSC. Something like clock_gettime will work more portably in extremis, but it'll be dramatically less accurate.

@nomeata
Copy link
Contributor Author

nomeata commented Jun 9, 2015

So you are saying that criterion simply does not support anything but i386 and x86_64 for now? Maybe you can conditionally set buildable: False in the cabal file to communicate that better.

@bos
Copy link
Collaborator

bos commented Jun 9, 2015

I've never encountered a user on another platform. I'm happy to accept suitable patches, but I'm not going to write them myself as obviously I can't test them :-)

@egrimley
Copy link

Are you sure that clock_gettime(CLOCK_MONOTONIC, &t) is dramatically less accurate? My understanding is that clock_gettime may use the TSC, where it is available, without doing a system call (when the program is dynamically linked). Also, how are you tackling the problems of TSC on a multi-core system, as described for example in https://en.wikipedia.org/wiki/Time_Stamp_Counter ?

@bos
Copy link
Collaborator

bos commented Mar 2, 2016

Fixed by 0673606.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants