summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorachirkin <>2021-04-07 06:29:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2021-04-07 06:29:00 (GMT)
commitb6789067c0eec40153db469b6d6c6913afc74f9d (patch)
tree5a19975ae40f090cf8fe76671c6433eaae444850
parent0bc818ac2f4b9951782bf8266cf964f012bf0106 (diff)
version 2.1.1.1HEAD2.1.1.1master
-rw-r--r--easytensor.cabal4
-rw-r--r--src-base/Numeric/DataFrame/Internal/Backend/Family/ArrayBase.hs14
2 files changed, 10 insertions, 8 deletions
diff --git a/easytensor.cabal b/easytensor.cabal
index 062a5ae..c2715a9 100644
--- a/easytensor.cabal
+++ b/easytensor.cabal
@@ -4,10 +4,10 @@ cabal-version: 1.24
--
-- see: https://github.com/sol/hpack
--
--- hash: 3c6d02c6fd2233f54c11cad29fb86ebe9dd802a64c7a3d880ee6d3bd047673ca
+-- hash: 2d4e2e7679d96cbfb12d0d6ea1fb7ba9016d3f0ccf97cdb07569122f5bd91c70
name: easytensor
-version: 2.1.1.0
+version: 2.1.1.1
synopsis: Pure, type-indexed haskell vector, matrix, and tensor library.
description: Pure, type-indexed haskell vector, matrix, and tensor library. Features dimensionality type-checking for all operations. Generic n-dimensional versions are implemented using low-level prim ops. Allows ad-hoc replacement with fixed low-dimensionality vectors and matrices without changing user interface. Please see the README on GitHub at <https://github.com/achirkin/easytensor#readme>
category: math, geometry
diff --git a/src-base/Numeric/DataFrame/Internal/Backend/Family/ArrayBase.hs b/src-base/Numeric/DataFrame/Internal/Backend/Family/ArrayBase.hs
index d7a9e0d..74d7ea7 100644
--- a/src-base/Numeric/DataFrame/Internal/Backend/Family/ArrayBase.hs
+++ b/src-base/Numeric/DataFrame/Internal/Backend/Family/ArrayBase.hs
@@ -75,10 +75,7 @@ instance (PrimBytes t, Dimensions ds) => PrimBytes (ArrayBase t ds) where
getBytes = withArrayContent'
(\t -> let tbs = byteSize t
in go tbs (tbs *# totalDim# @ds) t)
- -- very weird trick with touch# allows to workaround GHC bug
- -- "internal error: ARR_WORDS object entered!"
- -- TODO: report this
- (\_ _ arr -> case runRW# (\s -> (# touch# arr s, arr #)) of (# _, ba #) -> ba)
+ (\_ _ arr -> arr)
where
go :: Int# -> Int# -> t -> ByteArray#
go tbs bsize t = case runRW#
@@ -94,7 +91,7 @@ instance (PrimBytes t, Dimensions ds) => PrimBytes (ArrayBase t ds) where
g :: Int# -> ByteArray# -> State# RealWorld -> (# State# RealWorld, ByteArray# #)
g off arr s0
| isTrue# (isByteArrayPinned# arr)
- = (# touch# arr s0, arr #)
+ = (# s0, arr #)
| tba <- byteAlign @t undefined
, bsize <- sizeofByteArray# arr
, (# s1, mba #) <- newAlignedPinnedByteArray# bsize tba s0
@@ -525,9 +522,14 @@ withArrayContent' ::
-> (CumulDims -> Int# -> ByteArray# -> r)
-> ArrayBase t ds -> r
withArrayContent' f _ (ArrayBase (# e | #)) = f e
-withArrayContent' _ g (ArrayBase (# | (# steps, off, ba, _ #) #)) = g steps off ba
+withArrayContent' _ g (ArrayBase (# | (# steps, off, ba, _ #) #)) = g steps off (workaroundUSum ba)
{-# INLINE withArrayContent' #-}
+{- A workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/19645 -}
+workaroundUSum :: ByteArray# -> ByteArray#
+workaroundUSum x = x
+{-# NOINLINE workaroundUSum #-}
+
fromElems' :: forall (t :: Type) (ds :: [Nat])
. PrimBytes t => CumulDims -> Int# -> ByteArray# -> ArrayBase t ds
fromElems' steps off ba = ArrayBase (# | (# steps, off, ba, Dict #) #)