Skip to content
Merged
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
1 change: 1 addition & 0 deletions examples/distributed/allreduce_bias_rmsnorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
config=helion.Config(
block_sizes=[8],
num_warps=8,
reduction_loops=[1024],
),
static_shapes=True,
)
Expand Down
1 change: 1 addition & 0 deletions helion/_compiler/roll_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ def process(self, graph: torch.fx.Graph) -> torch.fx.Graph:
if (
not all((n in self.available) for n in node.all_input_nodes)
or node.op == "output"
or (node.is_impure() and self.inner_count > 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test for the issue this is fixing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_distributed.py has a test covering this case

):
self.start_new_graph()
new_node = self.outer_graph.create_node(
Expand Down
8 changes: 0 additions & 8 deletions helion/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,3 @@ def all_gather_object(obj: T) -> list[T]:
object_list = [None] * dist.get_world_size()
dist.all_gather_object(object_list, obj)
return object_list # pyrefly: ignore


def autotune_for_distributed_kernel() -> bool:
"""
Remove this once these issues regarding distributed kernels are fixed:
- https://github.com/pytorch/helion/issues/1642
"""
return os.getenv("HELION_AUTOTUNE_FOR_DISTRIBUTED_KERNEL") == "1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious are the autotune_for_distributed_kernel related changes meant to be in this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. The envvar was added as a workaround because of this issue

5 changes: 0 additions & 5 deletions helion/autotuner/config_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from .config_fragment import PowerOfTwoFragment
from .config_fragment import assert_integer_power_of_two
import helion
from helion._utils import autotune_for_distributed_kernel

if TYPE_CHECKING:
from collections.abc import Callable
Expand Down Expand Up @@ -931,10 +930,6 @@ def _flat_config(
default = min(default, base.max_reduction_threads)
value = fn(BlockSizeFragment(low, high, default))
assert isinstance(value, int)
if autotune_for_distributed_kernel():
# workaround https://github.com/pytorch/helion/issues/1642
return None

if not (low <= value <= high):
raise InvalidConfig(
f"Invalid value for reduction loop {low} <= {value} <= {high}"
Expand Down
4 changes: 1 addition & 3 deletions test/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def setUpClass(cls) -> None:
"HELION_DIST_CHECK_CONFIG_CONSISTANCY": "1",
"HELION_CAP_AUTOTUNE_NUM_NEIGHBORS": "50",
"HELION_CAP_REBENCHMARK_REPEAT": "50",
"HELION_AUTOTUNE_FOR_DISTRIBUTED_KERNEL": "1",
},
)
)
Expand Down Expand Up @@ -264,8 +263,7 @@ def test_allreduce_bias_rmsnorm(self, kernel_name, autotuner):
kernel = getattr(mod, kernel_name).fn
if autotuner == "fixed":
fixed_config = helion.Config(
block_sizes=[8],
num_warps=8,
block_sizes=[8], num_warps=8, reduction_loops=[1024]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jansel this test covered the issue fixed.

)

kernel = helion.kernel(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder should we add a single-gpu unit test that would fail without the fix in this PR? since I believe test/test_distributed.py is only run on the distributed CI job, adding a single-gpu unit test would ensure that we won't accidentally lose the coverage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't come up with a reasonable single GPU unit test. But if you have concern about coverage, I can add a specific multi-GPU test case for this one. (rather than being a parametrized test)

Expand Down
Loading