[GHC] #11143: Feature request: Add index/read/write primops with byte offset for ByteArray#
GHC
ghc-devs at haskell.org
Mon Aug 20 23:14:23 UTC 2018
#11143: Feature request: Add index/read/write primops with byte offset for
ByteArray#
-------------------------------------+-------------------------------------
Reporter: vagarenko | Owner: sjakobi
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords: newcomers
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #4442 | Differential Rev(s): Phab:D4433
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by jberryman):
I would also appreciate this. My use case is I'd like, for performance and
coding simplicity, to be able to do potentially unaligned reads of Word64
when we're compiled for x86_64 arch.
Library writers need to think about alignment when using the `Addr`
interface to pinned ByteArrays, so I don't think it's a big deal to expose
this (though docs could use improvement, see
https://ghc.haskell.org/trac/ghc/ticket/14731)
That said I would love it if the compiler didn't push this complexity down
to library writers (both here and in the Addr load/store primops), and
handled twiddling on architectures that don't support unaligned reads. I
would like my code to be compatible but don't particularly care if there
is a performance hit (99% of people are using x86). The alternative is I
just have to write my own slow code and put it behind a CPP pragma.
But it's not clear to me if vagarenko actually wants to do any unaligned
reads (and I don't want to hijack this request). Perhaps they just want to
do aligned reads on their heterogeneous structure. In that case you can
write your own implementation easily by dividing the byte offset provided
by the width of the payload you're requesting.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11143#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list