Class MxFp8BlockLinear
java.lang.Object
smile.llm.quant.MxFp8BlockLinear
- All Implemented Interfaces:
AutoCloseable, LinearOp, MxFp8Layer
Linear layer for MXFP8 weights on the native block-scaled FP8 GEMM of Hopper. The checkpoint's 1x32
E8M0 scales are folded into 128x128 float32 tile scales when the weight is installed
(
Native.mxfp8ToBlockFp8(Tensor, Tensor)), then every call is a W8A8 Fp8BlockGemm.
Unlike the Marlin path (FP8 weights, bfloat16 activations) the activations are rounded to FP8 here, so results differ slightly from W8A16 execution.
-
Constructor Summary
ConstructorsConstructorDescriptionMxFp8BlockLinear(int inFeatures, int outFeatures, boolean emulate) Constructor. -
Method Summary
-
Constructor Details
-
MxFp8BlockLinear
public MxFp8BlockLinear(int inFeatures, int outFeatures, boolean emulate) Constructor.- Parameters:
inFeatures- reduction size K; a multiple of 128.outFeatures- output size N; a multiple of 128.emulate-trueto emulate the FP8 tensor-core GEMM (runs on any CUDA GPU).
-
-
Method Details
-
setWeight
Description copied from interface:MxFp8LayerInstalls the weight from checkpoint tensors.- Specified by:
setWeightin interfaceMxFp8Layer- Parameters:
w- FP8 E4M3[N, K]on the target CUDA device.scale- E8M0 scales as uint8[N, K / 32]on the same device.
-
isLoaded
public boolean isLoaded()Description copied from interface:MxFp8LayerReturns whether the weight has been installed.- Specified by:
isLoadedin interfaceMxFp8Layer- Returns:
trueonceMxFp8Layer.setWeight(Tensor, Tensor)has run.
-
forward
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMxFp8Layer
-