pub struct FusionOptions {
pub skip_fusion: bool,
pub unfuse_elementwise_regions: bool,
pub keep_elementwise_regions: bool,
pub decompose_fusion_regions: bool,
pub fk_fusion: bool,
pub fuse_region_prologue: bool,
pub fuse_batch_preprocess: bool,
pub native_fk_regions: bool,
pub fusion_limits: FusionLimits,
pub disable_conv_bias_act_fusion: bool,
pub no_io_peaks_output: bool,
}Expand description
Per-target fusion toggles (env-driven on Metal today).
Fields§
§skip_fusion: boolSkip all pattern fusions (Metal: RLX_METAL_NO_FUSION).
unfuse_elementwise_regions: boolBreak ElementwiseRegion back into primitives after marking.
keep_elementwise_regions: boolKeep fused ElementwiseRegion through lowering (env: RLX_KEEP_ELEMENTWISE_REGIONS).
decompose_fusion_regions: boolDecompose FKL-style transform / batch regions before backend lowering.
fk_fusion: boolRun FKL passes (MarkTransformRegions, prologue, batch). Env: RLX_NO_FK_FUSION=1 disables.
fuse_region_prologue: boolFold ResizeNearest2x into ElementwiseRegion prologue. Env: RLX_FUSE_REGION_PROLOGUE=0 disables.
fuse_batch_preprocess: boolMerge parallel region slices into BatchElementwiseRegion. Env: RLX_FUSE_BATCH_PREPROCESS=0 disables.
native_fk_regions: boolKeep TransformRegion / BatchElementwiseRegion in MIR for native lowering. Env: RLX_NATIVE_FK_REGIONS=1.
fusion_limits: FusionLimitsCaps for fused elementwise chains (encoder / scratch limits).
disable_conv_bias_act_fusion: boolSkip Conv+Bias+Act fusion (RLX_DISABLE_CONV_BIAS_ACT_FUSION).
no_io_peaks_output: boolDisable IO-gated peaks-only output selection (RLX_NO_IO_PEAKS_OUTPUT).
Implementations§
Source§impl FusionOptions
impl FusionOptions
Sourcepub fn from_metal_env() -> FusionOptions
pub fn from_metal_env() -> FusionOptions
Read Metal-specific env overrides.
Sourcepub fn merge_env(self) -> FusionOptions
pub fn merge_env(self) -> FusionOptions
Merge session options with compile-time env overrides.
Sourcepub fn apply_native_fk_defaults(self, target: FusionTarget) -> FusionOptions
pub fn apply_native_fk_defaults(self, target: FusionTarget) -> FusionOptions
GPU-class targets keep native FKL regions unless opted out.
Sourcepub fn for_cpu() -> FusionOptions
pub fn for_cpu() -> FusionOptions
CPU executes element-wise chains as per-op thunks — mark then unfuse.
Sourcepub fn for_metal() -> FusionOptions
pub fn for_metal() -> FusionOptions
Metal keeps RMSNorm / matmul fusions but unfuses ElementwiseRegion by
default (fused MSL mis-lowers long chains on deep transformer graphs) —
UNLESS RLX_KEEP_ELEMENTWISE_REGIONS asks to keep them (short chains lower
fine and stay fused → fewer dispatches on the dispatch-bound backward).
Sourcepub fn for_wgpu() -> FusionOptions
pub fn for_wgpu() -> FusionOptions
wgpu region kernel only supports trailing/scalar broadcast via modulus — unfuse so LegalizeBroadcast Expand + Binary run separately.
Source§impl FusionOptions
impl FusionOptions
Sourcepub fn for_target(target: FusionTarget) -> FusionOptions
pub fn for_target(target: FusionTarget) -> FusionOptions
Canonical option set for a target, matching what each backend’s
compile path uses: CPU unfuses element-wise regions (it executes them
as per-op thunks), Metal/MLX keep matmul/norm fusions but unfuse long
element-wise chains, wgpu unfuses for its modulus-broadcast kernel, and
the remaining GPU-class targets take the defaults (native FKL regions
are then enabled by apply_native_fk_defaults).
This is the option set the one-call fuse / Fuse entries pick.
Trait Implementations§
Source§impl Clone for FusionOptions
impl Clone for FusionOptions
Source§fn clone(&self) -> FusionOptions
fn clone(&self) -> FusionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FusionOptions
Source§impl Debug for FusionOptions
impl Debug for FusionOptions
Source§impl Default for FusionOptions
impl Default for FusionOptions
Source§fn default() -> FusionOptions
fn default() -> FusionOptions
impl Eq for FusionOptions
Source§impl PartialEq for FusionOptions
impl PartialEq for FusionOptions
impl StructuralPartialEq for FusionOptions
Auto Trait Implementations§
impl Freeze for FusionOptions
impl RefUnwindSafe for FusionOptions
impl Send for FusionOptions
impl Sync for FusionOptions
impl Unpin for FusionOptions
impl UnsafeUnpin for FusionOptions
impl UnwindSafe for FusionOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more