The refpage for FunctionCompile's option CompilerOptions is empty of examples:

enter image description here

Does anyone know what keys and values can be used in the Association given to CompilerOptions?


A support case with the identification [CASE:4959188] was created.


1 Answer 1


These are accepted as valid rules for CompilerOptions -> { rules }:

{"AbortHandling" :> Compile`Utilities`$AbortHandling, 
 "AddRuntime" -> "SharedLibrary", "CacheExpr" -> False, 
 "DataLayout" -> Automatic, "Debug" -> False, 
 "EntryFunctionName" -> Automatic, "ErrorFunction" -> Null, 
 "ExceptionsModel" :> Compile`Utilities`$ExceptionsModel, 
 "ExecutionEngine" -> Automatic, "ExpressionInterface" -> Automatic, 
 "ExternalLibraries" -> {}, "ExtraPasses" -> {}, 
 "InlinePolicy" -> Automatic, "InvocationMode" -> "WolframEngine", 
 "LazyJIT" -> False, "LLVMOptimization" -> Automatic, 
 "LLVMOptions" -> Automatic, 
 "MacroEnvironment" :> Compile`$DefaultMacroEnvironment, 
 "MacroRecursionLimit" -> 5, "OptimizationLevel" -> 2, 
 "PassLogger" -> Automatic, "PassOptions" -> {}, 
 "ResetVariableID" -> True, "SaveIR" -> False, 
 "TargetArchitecture" -> Automatic, "TargetSystemID" -> Automatic, 
 "TargetTriple" -> Automatic, "TypeEnvironment" :> Automatic, 
 "TypeSystem" -> Automatic}

However, CompilerOptions -> Association[..] throws an error:

FunctionCompile::compopts: CompilerOptions setting <|AbortHandling :> Compile`Utilities`$AbortHandling|> is not a rule or a list of rules.

As for the values, the only official discussion of the compiler I'm aware of can be found in the presentations of Abdul Dakkak and Tom Wickham-Jones at WTC 2019. In Dakkak's notebook you can find "InvocationMode" -> "Standalone", "LLVMOptimization" -> "ClangOptimization"[3], and "AbortHandling" -> False. GeneralUtilities`PrintDefinitions@Compile`Driver`Private`getCodeGenOptions will yield a few sparse insights into the options.

The above was discovered with my usual trick:

FunctionCompile[Function[Typed[arg, "MachineInteger"], arg + 1], 
 CompilerOptions -> {Foo -> True}]

OptionValue::nodef: Unknown option Foo for Compile`CompileToCodeFunction.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.