Tune Vortex NVFP4 scale geometry

This commit is contained in:
Daniel Maddern 2026-08-15 02:15:19 +07:00
parent 1cc0ffdd00
commit 1fec77d2e9

View file

@ -51,10 +51,10 @@ def _env_int(name: str, default: int) -> int:
def _vortex_scale_geometry(numel: int) -> tuple[int, int]: def _vortex_scale_geometry(numel: int) -> tuple[int, int]:
threads = _env_int("H3_NVFP4_SCALE_THREADS", 256) threads = _env_int("H3_NVFP4_SCALE_THREADS", 128)
if threads not in {128, 256, 512}: if threads not in {128, 256, 512}:
raise ValueError(f"H3_NVFP4_SCALE_THREADS must be 128, 256, or 512, got {threads}") raise ValueError(f"H3_NVFP4_SCALE_THREADS must be 128, 256, or 512, got {threads}")
default_blocks = min((numel + threads - 1) // threads, 4096) default_blocks = min((numel + threads - 1) // threads, 256)
blocks = _env_int("H3_NVFP4_SCALE_BLOCKS", default_blocks) blocks = _env_int("H3_NVFP4_SCALE_BLOCKS", default_blocks)
if blocks <= 0: if blocks <= 0:
raise ValueError(f"H3_NVFP4_SCALE_BLOCKS must be positive, got {blocks}") raise ValueError(f"H3_NVFP4_SCALE_BLOCKS must be positive, got {blocks}")