"...git@developer.sourcefind.cn:jerrrrry/infinicore.git" did not exist on "fab5ed7028d61fa861bc32a1d69756a00660302d"
Unverified Commit ef7dee4b authored by HuangHuang's avatar HuangHuang Committed by GitHub
Browse files

Fix FP8 recompute by copying amaxes/scales to updated amaxes/scales instead of referencing (#1723)



Prevent precision issues by making get_old_fp8_meta_tensors_for_recompute() 
return copies of amaxes/scales rather than references to originals.
Signed-off-by: default avatarHuangHuang <huang.huang@mthreads.com>
Co-authored-by: default avatarTim Moon <4406448+timmoon10@users.noreply.github.com>
parent 4ceb3d4c
......@@ -513,8 +513,8 @@ class FP8GlobalStateManager:
return
# Store updated amaxes and scales from phase 1 post forward.
fp8_meta["updated_amax_history_fwd"] = fp8_meta["scaling_fwd"].amax_history
fp8_meta["updated_scale_fwd"] = fp8_meta["scaling_fwd"].scale
fp8_meta["updated_amax_history_fwd"] = fp8_meta["scaling_fwd"].amax_history.clone()
fp8_meta["updated_scale_fwd"] = fp8_meta["scaling_fwd"].scale.clone()
# Retrieve stashed amaxes and scales from phase 1 pre forward.
buffer_position_key = "global_fp8_buffer_pos_fwd_recompute"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment