Comments (8)
One might think that it would potentially affect all 32-bit-architectures without a native code generation, but it builds on other arches as well (but no idea if it actually works there. A test suite using the Cabal test (documented in http://www.haskell.org/cabal/users-guide/developing-packages.html#test-suites) would be helpful here):
https://buildd.debian.org/status/package.php?p=haskell-hashtables
from hashtables.
Bug crossreference: http://bugs.debian.org/669227
from hashtables.
Try passing in -fportable. Let me know if that works.
G
On Wed, Apr 18, 2012 at 11:19 AM, nomeata <
[email protected]
wrote:
Hi,
hashtables does not build on a powerpc machine, for a build log see
Do you think you can fix that?
Thanks,
Joachim
Reply to this email directly or view it on GitHub:
#4
Gregory Collins [email protected]
from hashtables.
No, that does not help.
Looking at the assembly code, the the culprit is definitely highestBitMask, with the instruction
lwz 3, 3(14)
lwz 4, 3(14)
srwi 4, 4, 1
or 4, 3, 4
srwi 3, 4, 2
or 4, 4, 3
srwi 3, 4, 4
or 4, 4, 3
srwi 3, 4, 8
or 4, 4, 3
srwi 3, 4, 16
or 4, 4, 3
srwi 3, 4, 32
or 4, 4, 3
lis 3, base_GHCziWord_Wzh_con_info@ha
I find it strange, though, that the same code does not cause errors in the containers library. If I look at the assembly generated for Data.IntSet, I do see the series of srwi instructions, but it is missing the 32:
lwz 3, 20(22)
lwz 4, 11(14)
xor 4, 3, 4
srwi 3, 4, 1
or 4, 4, 3
srwi 3, 4, 2
or 4, 4, 3
srwi 3, 4, 4
or 4, 4, 3
srwi 3, 4, 8
or 4, 4, 3
srwi 3, 4, 16
or 5, 4, 3
lwz 3, 16(22)
Ah, but actually, the functions are defined slightly differently. You do:
{-# INLINE highestBitMask #-}
highestBitMask :: Word -> Word
highestBitMask !x0 = case (x0 .|. shiftRL x0 1) of
x1 -> case (x1 .|. shiftRL x1 2) of
x2 -> case (x2 .|. shiftRL x2 4) of
x3 -> case (x3 .|. shiftRL x3 8) of
x4 -> case (x4 .|. shiftRL x4 16) of
x5 -> x5 .|. shiftRL x5 32
but containers has:
highestBitMask :: Nat -> Nat
highestBitMask x0
= case (x0 .|. shiftRL x0 1) of
x1 -> case (x1 .|. shiftRL x1 2) of
x2 -> case (x2 .|. shiftRL x2 4) of
x3 -> case (x3 .|. shiftRL x3 8) of
x4 -> case (x4 .|. shiftRL x4 16) of
x5 -> case (x5 .|. shiftRL x5 32) of -- for 64 bit platforms
x6 -> (x6 `xor` (shiftRL x6 1))
{-# INLINE highestBitMask #-}
Hmm, but even copying that code into Utils.hs does not help. Ah, here is the reason: You use uncheckedShiftRL# while containers use shiftRL#. Changing this makes the program compile. And indeed the documentation predicted the problem:
primop SrlOp "uncheckedShiftRL#" GenPrimOp Word# -> Int# -> Word#
{Shift right logical. Result undefined if shift amount is not
in the range 0 to word size - 1 inclusive.}
Now, as long as all your calls to shiftRL have a known second argument, using shiftRL# should cost no run-time performance over uncheckedShiftRL#. Grepping through your code, this seems to be the case. Therefore, I suggest you do that.
Thanks,
Joachim
from hashtables.
I checked the assembler output, and going from unchecked to checked shifts
changes an "shrq" assembly instruction to a function call, so that won't
fly. I'll fix this some other way.
from hashtables.
Never mind, I lied -- I forgot to pass -O2 when making the assembler output
from hashtables.
Released as 1.0.1.4 -- please try again?
from hashtables.
Yes, I could compile it on a powerpc machine without issues, and will upload it to Debian now. Thanks for your help!
from hashtables.
Related Issues (20)
- Missing instance Eq (HashTable s k v)
- Compilation failure using GHC 7.8.4 HOT 4
- Hashtables 1.2.2.0 should be marked as depending on base >= 4.7 HOT 2
- Build error with GHC 8.4.1-alpha1 HOT 5
- 1.2.3.0 breaks ghc pre 7.10 HOT 1
- Why is performance a third of hash tables in other languages? HOT 4
- Update benchmarks to criterion 1.5
- Adding Hopscotch Hashing HOT 1
- SSE4_2 Broken For Cuckoo HashTable
- Cuckoo loses data when inserting 65th element via mutate HOT 26
- Build error using primitive 0.7.0.0 HOT 2
- Support for hashable-1.3.0.0 HOT 3
- Poor performance of Basic compared to Cuckoo HOT 3
- undefined, called at src/Data/HashTable/ST/Cuckoo.hs:406:31 HOT 2
- Compile failure with GHC 9.2 HOT 3
- How to control load factor?
- Support for hashable-1.4 HOT 3
- Noncanonical mappend HOT 2
- Performance gap between 1.2.4.2 and 1.3
- How to merge two hashtables? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashtables.