Configuration Options
Scoped Values
Warning
Currently options are scattered in the form of global variables and scoped values. We are in the process of migrating all of them into scoped values.
Reactant.with_config Function
with_config(f; kwargs...)
Run the function f
within a dynamic scope such that all uses of the config within this scope will use the provided values.
Extended Help
Configuration Options
Lowering
lower_partialsort_to_approx_top_k
: Whether to lowerpartialsort
andpartialsortperm
toOps.approx_top_k
. Note that XLA only supports loweringApproxTopK
for TPUs unlessfallback_approx_top_k_lowering
is set totrue
.fallback_approx_top_k_lowering
: Whether to lowerOps.approx_top_k
tostablehlo.top_k
if the XLA backend doesn't supportApproxTopK
. Defaults totrue
.
DotGeneral
dot_general_algorithm
: Algorithm preset forstablehlo.dot_general
. Can benothing
,DotGeneralAlgorithm
orDotGeneralAlgorithmPreset
. Defaults toDotGeneralAlgorithmPreset.DEFAULT
.dot_general_precision
: Precision forstablehlo.dot_general
. Can benothing
, orDotGeneralPrecision
. Defaults toDotGeneralPrecision.DEFAULT
.
Values
DOT_GENERAL_PRECISION
: Controls theprecision_config
forstablehlo.dot_general
.DOT_GENERAL_ALGORITHM
: Controls thealgorithm
forstablehlo.dot_general
.LOWER_PARTIALSORT_TO_APPROX_TOP_K
: Whether to lowerpartialsort
toOps.approx_top_k
. Note that XLA only supports loweringApproxTopK
for TPUs unlessFALLBACK_APPROX_TOP_K_LOWERING
is set totrue
. Defaults tofalse
.FALLBACK_APPROX_TOP_K_LOWERING
: Whether to fallback to loweringApproxTopK
tostablehlo.top_k
if the XLA backend doesn't supportApproxTopK
. Defaults totrue
.
DotGeneral
Reactant.DotGeneralAlgorithmPreset Module
DotGeneralAlgorithmPreset
Controls the precision_config
for stablehlo.dot_general
. Valid values are:
DEFAULT
ANY_F8_ANY_F8_F32
ANY_F8_ANY_F8_F32_FAST_ACCUM
ANY_F8_ANY_F8_ANY
ANY_F8_ANY_F8_ANY_FAST_ACCUM
F16_F16_F16
F16_F16_F32
BF16_BF16_BF16
BF16_BF16_F32
BF16_BF16_F32_X3
BF16_BF16_F32_X6
BF16_BF16_F32_X9
F32_F32_F32
F64_F64_F64
The following functions are available:
supported_lhs_eltype(dot_algorithm_preset::DotGeneralAlgorithmPreset.T)
supported_rhs_eltype(dot_algorithm_preset::DotGeneralAlgorithmPreset.T)
accumulation_eltype(dot_algorithm_preset::DotGeneralAlgorithmPreset.T)
supported_output_eltype(dot_algorithm_preset::DotGeneralAlgorithmPreset.T, T1, T2)
MLIR.IR.Attribute(dot_algorithm_preset::DotGeneralAlgorithmPreset.T, T1, T2)
Reactant.DotGeneralPrecision Module
DotGeneralPrecision
Controls the precision_config
for stablehlo.dot_general
. Valid values are:
DEFAULT
HIGH
HIGHEST
The following functions are available:
MLIR.IR.Attribute(precision::DotGeneralPrecision.T)
Reactant.DotGeneralAlgorithm Type
DotGeneralAlgorithm(
::Type{lhsT}, ::Type{rhsT}, ::Type{accumT},
rhs_component_count::Int, lhs_component_count::Int, num_primitive_operations::Int,
allow_imprecise_accumulation::Bool
)
DotGeneralAlgorithm{lhsT,rhsT,accumT}(
lhs_component_count::Int, rhs_component_count::Int, num_primitive_operations::Int,
allow_imprecise_accumulation::Bool
)
Represents the configuration of the stablehlo.dot_general
operation.
Arguments
lhsT
: The type of the left-hand side operand.rhsT
: The type of the right-hand side operand.accumT
: The type of the accumulation operand.lhs_component_count
: The number of components in the left-hand side operand.rhs_component_count
: The number of components in the right-hand side operand.num_primitive_operations
: The number of primitive operations in thestablehlo.dot_general
operation.
Environment Variables
The following environment variables can be used to configure Reactant.
GPU Configuration
XLA_REACTANT_GPU_MEM_FRACTION
: The fraction of GPU memory to use for XLA. Defaults to0.75
.XLA_REACTANT_GPU_PREALLOCATE
: Whether to preallocate GPU memory. Defaults totrue
.REACTANT_VISIBLE_GPU_DEVICES
: A comma-separated list of GPU device IDs to use. Defaults to all visible GPU devices. Preferably useCUDA_VISIBLE_DEVICES
instead.
TPU Configuration
TPU_LIBRARY_PATH
: The path to the libtpu.so library. If not provided, we download and use Scratch.jl to save the library.
Distributed Setup
REACTANT_COORDINATOR_BIND_ADDRESS
: The address to bind the coordinator to. If not provided, we try to automatically infer it from the environment.