Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion torchft/multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class _MonitoredPipe:
def __init__(self, pipe: "Connection[object, object]") -> None:
def __init__(self, pipe: "Connection[object, object]") -> None: # type: ignore
self._pipe = pipe

def send(self, obj: object) -> None:
Expand Down
4 changes: 2 additions & 2 deletions torchft/multiprocessing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from torchft.multiprocessing import _MonitoredPipe


def pipe_get(q: "Connection[object, object]") -> None:
def pipe_get(q: "Connection[object, object]") -> None: # type: ignore
q.recv()


def pipe_put(q: "Connection[object, object]") -> None:
def pipe_put(q: "Connection[object, object]") -> None: # type: ignore
q.recv()
q.send(1)

Expand Down
4 changes: 2 additions & 2 deletions torchft/process_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,8 +1443,8 @@ def _worker(
store_addr: str,
rank: int,
world_size: int,
req_pipe: "Connection[object, object]",
future_pipe: "Connection[object, object]",
req_pipe: "Connection[object, object]", # type: ignore
future_pipe: "Connection[object, object]", # type: ignore
curr_device: int,
) -> None:
try:
Expand Down
14 changes: 7 additions & 7 deletions torchft/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _fused_kernel_quantize_into_fp8(
# be written
o_curr_ptr = o_ptr + o_offset
o_scale_ptr = o_curr_ptr.to(tl.pointer_type(SCALE_TL_DTYPE))
o_quant_ptr = (o_curr_ptr + SCALE_TL_DTYPE_BYTES).to(tl.pointer_type(TL_FP8_TYPE))
o_quant_ptr = (o_curr_ptr + SCALE_TL_DTYPE_BYTES).to(tl.pointer_type(TL_FP8_TYPE)) # type: ignore

# Compute maximum for the current row block by block
col_offsets = tl.arange(0, BLOCK_SIZE)
Expand Down Expand Up @@ -233,7 +233,7 @@ def _fused_kernel_dequantize_from_fp8(
# written
o_curr_ptr = o_ptr + o_offset
o_scale_ptr = o_curr_ptr.to(tl.pointer_type(SCALE_TL_DTYPE))
o_quant_ptr = (o_curr_ptr + SCALE_TL_DTYPE_BYTES).to(tl.pointer_type(TL_FP8_TYPE))
o_quant_ptr = (o_curr_ptr + SCALE_TL_DTYPE_BYTES).to(tl.pointer_type(TL_FP8_TYPE)) # type: ignore

# Load row scale
i_row_scale = tl.load(o_scale_ptr)
Expand Down Expand Up @@ -342,7 +342,7 @@ def _fused_kernel_reduce_fp8(
o_rank_row_ptr = o_ptr + all_reduce_rank * o_size_bytes_per_rank + o_offset
o_rank_scale_ptr = o_rank_row_ptr.to(tl.pointer_type(SCALE_TL_DTYPE))
o_rank_quant_ptr = (o_rank_row_ptr + SCALE_TL_DTYPE_BYTES).to(
tl.pointer_type(TL_FP8_TYPE)
tl.pointer_type(TL_FP8_TYPE) # type: ignore
)

col_offsets = tl.arange(0, BLOCK_SIZE)
Expand Down Expand Up @@ -411,7 +411,7 @@ def _fused_kernel_accumulate_block(
# Load row scale and block of quantized row
o_scale_ptr = o_row_ptr.to(tl.pointer_type(tl.float32))
o_quant_ptr = (o_row_ptr + SCALE_TL_DTYPE_BYTES).to(
tl.pointer_type(TL_FP8_TYPE)
tl.pointer_type(TL_FP8_TYPE) # type: ignore
)

o_row_scale = tl.load(o_scale_ptr)
Expand Down Expand Up @@ -580,7 +580,7 @@ def fused_quantize_into_fp8(
output,
output_size // all_reduce_group_size,
all_reduce_group_size,
BLOCK_SIZE=BLOCK_SIZE_T,
BLOCK_SIZE=BLOCK_SIZE_T, # type: ignore
TL_FP8_TYPE=_get_fp8_type(),
TL_FP8_MAX=_get_fp8_max(),
)
Expand Down Expand Up @@ -630,7 +630,7 @@ def fused_dequantize_from_fp8(
output,
output_size // all_reduce_group_size,
all_reduce_group_size,
BLOCK_SIZE=BLOCK_SIZE_T,
BLOCK_SIZE=BLOCK_SIZE_T, # type: ignore
TL_FP8_TYPE=_get_fp8_type(),
)

Expand Down Expand Up @@ -680,7 +680,7 @@ def fused_reduce_fp8(
all_reduce_group_size,
all_reduce_rank,
1.0 if reduce_op == ReduceOp.SUM else float(all_reduce_group_size),
BLOCK_SIZE=BLOCK_SIZE_T,
BLOCK_SIZE=BLOCK_SIZE_T, # type: ignore
TL_FP8_TYPE=_get_fp8_type(),
TL_FP8_MAX=_get_fp8_max(),
)
Loading