| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
MLIR.Native
Description
This module defines a set of Haskell types wrapping references to native C++
MLIR objects along with some basic operations on them. See the submodules for
more specialized components such as an ExecutionEngine
or PassManager.
Synopsis
- data Context
- createContext :: IO Context
- destroyContext :: Context -> IO ()
- withContext :: (Context -> IO a) -> IO a
- class HasContext a where
- getContext :: a -> IO Context
- registerAllDialects :: Context -> IO ()
- getNumLoadedDialects :: Context -> IO Int
- data Type
- data Location
- getFileLineColLocation :: Context -> StringRef -> CUInt -> CUInt -> IO Location
- getNameLocation :: Context -> StringRef -> Location -> IO Location
- getUnknownLocation :: Context -> IO Location
- data Operation
- getOperationName :: Operation -> IO Identifier
- showOperation :: Operation -> IO ByteString
- showOperationWithLocation :: Operation -> IO ByteString
- verifyOperation :: Operation -> IO Bool
- data Region
- getOperationRegions :: Operation -> IO [Region]
- getRegionBlocks :: Region -> IO [Block]
- data Block
- showBlock :: Block -> IO ByteString
- getBlockOperations :: Block -> IO [Operation]
- data Module
- createEmptyModule :: Location -> IO Module
- parseModule :: Context -> StringRef -> IO (Maybe Module)
- destroyModule :: Module -> IO ()
- getModuleBody :: Module -> IO Block
- moduleAsOperation :: Module -> IO Operation
- moduleFromOperation :: Operation -> IO (Maybe Module)
- showModule :: Module -> IO ByteString
- data StringRef = StringRef (Ptr CChar) CSize
- withStringRef :: ByteString -> (StringRef -> IO a) -> IO a
- data Identifier
- createIdentifier :: Context -> StringRef -> IO Identifier
- identifierString :: Identifier -> IO StringRef
- data LogicalResult
- pattern Failure :: LogicalResult
- pattern Success :: LogicalResult
- setDebugMode :: Bool -> IO ()
- class HasDump a where
Contexts
A native MLIR context.
Instances
createContext :: IO Context Source #
Creates a native MLIR context.
destroyContext :: Context -> IO () Source #
Destroys a native MLIR context.
withContext :: (Context -> IO a) -> IO a Source #
Wraps an IO action that gets access to a fresh MLIR context.
class HasContext a where Source #
A typeclass for retrieving MLIR contexts managing other native types.
Methods
getContext :: a -> IO Context Source #
Retrieve the MLIR context that manages the storage of the native value.
Instances
| HasContext Module Source # | |
Defined in MLIR.Native | |
Dialect registration
registerAllDialects :: Context -> IO () Source #
Register all builtin MLIR dialects in the specified Context.
getNumLoadedDialects :: Context -> IO Int Source #
Retrieve the count of dialects currently registered in the Context.
Type
A native MLIR type object.
Location
A native MLIR location object.
Instances
| Storable Location Source # | |
Defined in MLIR.Native.FFI | |
| FromAST Location Location Source # | |
Operation
A native MLIR operation instance.
Instances
| Storable Operation Source # | |
Defined in MLIR.Native.FFI | |
| HasDump Operation Source # | |
| FromAST Operation Operation Source # | |
Defined in MLIR.AST Methods fromAST :: Context -> ValueAndBlockMapping -> Operation -> IO Operation0 Source # | |
getOperationName :: Operation -> IO Identifier Source #
Retrieve the name of the given operation.
showOperation :: Operation -> IO ByteString Source #
Show the operation using the MLIR printer.
showOperationWithLocation :: Operation -> IO ByteString Source #
Show the operation with location using the MLIR printer.
Region
A native MLIR region.
Instances
| Storable Region Source # | |
| FromAST Region Region Source # | |
Block
A native MLIR block object.
Every block is a list of Operations.
Instances
| Storable Block Source # | |
| FromAST Block Block Source # | |
Module
A native MLIR module operation.
Since every module is an operation, it can be converted to
an Operation using moduleAsOperation.
Instances
| Storable Module Source # | |
| HasDump Module Source # | |
| HasContext Module Source # | |
Defined in MLIR.Native | |
parseModule :: Context -> StringRef -> IO (Maybe Module) Source #
Parse a module from a string. Returns Nothing in case of parse failure.
moduleFromOperation :: Operation -> IO (Maybe Module) Source #
Inverse of moduleAsOperation. Returns Nothing if the operation is not a
builtin MLIR module operation.
showModule :: Module -> IO ByteString Source #
Show the module using the MLIR printer.
StringRef
withStringRef :: ByteString -> (StringRef -> IO a) -> IO a Source #
Use a ByteString as a StringRef. This is O(n) due to MLIR sometimes
requiring the StringRefs to be null-terminated.
Identifier
data Identifier Source #
A native MLIR identifier. Identifiers are strings interned in the MLIR context.
Instances
| Storable Identifier Source # | |
Defined in MLIR.Native.FFI Methods sizeOf :: Identifier -> Int # alignment :: Identifier -> Int # peekElemOff :: Ptr Identifier -> Int -> IO Identifier # pokeElemOff :: Ptr Identifier -> Int -> Identifier -> IO () # peekByteOff :: Ptr b -> Int -> IO Identifier # pokeByteOff :: Ptr b -> Int -> Identifier -> IO () # peek :: Ptr Identifier -> IO Identifier # poke :: Ptr Identifier -> Identifier -> IO () # | |
createIdentifier :: Context -> StringRef -> IO Identifier Source #
Create an identifier from a StringRef.
identifierString :: Identifier -> IO StringRef Source #
LogicalResult
data LogicalResult Source #
Instances
| Eq LogicalResult Source # | |
Defined in MLIR.Native.FFI Methods (==) :: LogicalResult -> LogicalResult -> Bool # (/=) :: LogicalResult -> LogicalResult -> Bool # | |
| Show LogicalResult Source # | |
Defined in MLIR.Native.FFI Methods showsPrec :: Int -> LogicalResult -> ShowS # show :: LogicalResult -> String # showList :: [LogicalResult] -> ShowS # | |
| Storable LogicalResult Source # | |
Defined in MLIR.Native.FFI Methods sizeOf :: LogicalResult -> Int # alignment :: LogicalResult -> Int # peekElemOff :: Ptr LogicalResult -> Int -> IO LogicalResult # pokeElemOff :: Ptr LogicalResult -> Int -> LogicalResult -> IO () # peekByteOff :: Ptr b -> Int -> IO LogicalResult # pokeByteOff :: Ptr b -> Int -> LogicalResult -> IO () # peek :: Ptr LogicalResult -> IO LogicalResult # poke :: Ptr LogicalResult -> LogicalResult -> IO () # | |
pattern Failure :: LogicalResult Source #
Indicates a filure of an MLIR operation. Inspect the diagnostics output to find the cause of the issue.
pattern Success :: LogicalResult Source #
Indicates a successful completion of an MLIR operation.
Debugging utilities
setDebugMode :: Bool -> IO () Source #
Enable or disable debug logging in MLIR.