| Copyright | (c) Jeremy Nuttall 2025 |
|---|---|
| License | BSD-3-Clause |
| Maintainer | jeremy@jeremy-nuttall.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Foreign.GPU.Marshal.Aligned
Description
Synopsis
- type PackedPtr (layout :: MemoryLayout) a = AlignedPtr layout (Packed layout a)
- withPacked :: forall (layout :: MemoryLayout) a m b. (MonadUnliftIO m, AlignedStorable layout a) => a -> (PackedPtr layout a -> m b) -> m b
- allocaPacked :: forall (layout :: MemoryLayout) a b m. (MonadUnliftIO m, AlignedStorable layout a) => (PackedPtr layout a -> m b) -> m b
- type StridedPtr (layout :: MemoryLayout) a = AlignedPtr layout (Strided layout a)
- withStrided :: forall m (layout :: MemoryLayout) a b. (MonadUnliftIO m, AlignedStorable layout a) => a -> (StridedPtr layout a -> m b) -> m b
- allocaStrided :: forall m (layout :: MemoryLayout) a b. (MonadUnliftIO m, AlignedStorable layout a) => (StridedPtr layout a -> m b) -> m b
- alignedCopyVector :: forall (layout :: MemoryLayout) a m. (MonadIO m, AlignedStorable layout a) => AlignedPtr layout a -> Vector (Strided layout a) -> m ()
Utilities for Packed values
type PackedPtr (layout :: MemoryLayout) a = AlignedPtr layout (Packed layout a) Source #
Convenience type for Packed AlignedPtr
withPacked :: forall (layout :: MemoryLayout) a m b. (MonadUnliftIO m, AlignedStorable layout a) => a -> (PackedPtr layout a -> m b) -> m b Source #
Temporarily allocates a zero-initialized block of memory and pokes a
Packed value into it, providing a pointer to the result.
The storage is freed automatically. The pointer is only valid within the continuation.
allocaPacked :: forall (layout :: MemoryLayout) a b m. (MonadUnliftIO m, AlignedStorable layout a) => (PackedPtr layout a -> m b) -> m b Source #
Allocates temporary, zero-initialized storage for a Packed value on the stack.
The pointer is only valid within the continuation.
Utilities for Strided values
type StridedPtr (layout :: MemoryLayout) a = AlignedPtr layout (Strided layout a) Source #
Convenience type for Strided AlignedPtr
withStrided :: forall m (layout :: MemoryLayout) a b. (MonadUnliftIO m, AlignedStorable layout a) => a -> (StridedPtr layout a -> m b) -> m b Source #
Temporarily allocates a zero-initialized block of memory and pokes a
Strided value into it, providing a pointer to the result.
The storage is freed automatically. The pointer is only valid within the continuation.
allocaStrided :: forall m (layout :: MemoryLayout) a b. (MonadUnliftIO m, AlignedStorable layout a) => (StridedPtr layout a -> m b) -> m b Source #
Allocates temporary, zero-initialized storage for a Strided value on the stack.
The pointer is only valid within the continuation.
Utilities for runtime length arrays
alignedCopyVector :: forall (layout :: MemoryLayout) a m. (MonadIO m, AlignedStorable layout a) => AlignedPtr layout a -> Vector (Strided layout a) -> m () Source #