Skip to content

Added support for waves_per_eu function attribute. #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: rocm-jaxlib-v0.5.0
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions jax/_src/pallas/triton/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ class TritonCompilerParams(pallas_core.CompilerParams):
32 threads.
num_stages: The number of stages the compiler should use for software
pipelining loops.
waves_per_eu: Manages Vector General Purpose Registers (VGPR) usage to achieve
desired occupancy levels.
serialized_metadata: Additional compiler metadata. This field is unstable
and may be removed in the future.
"""
PLATFORM: ClassVar[str] = "triton"
num_warps: int | None = None
num_stages: int | None = None
waves_per_eu: int | None = None
serialized_metadata: bytes | None = None
4 changes: 4 additions & 0 deletions jax/_src/pallas/triton/pallas_call_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ def pallas_call_lowering(
if lowering_platform == "rocm":
num_stages = triton_params.get("num_stages", 1)
num_stages = 1 if num_stages is None else num_stages
waves_per_eu = triton_params.get("waves_per_eu", 1)
waves_per_eu = 1 if waves_per_eu is None else waves_per_eu
else:
num_stages = triton_params.get("num_stages", 3)
num_stages = 3 if num_stages is None else num_stages
waves_per_eu = 1

if debug:
print(f"\nThe kernel jaxpr for pallas_call {name_and_src_info}:")
Expand Down Expand Up @@ -98,6 +101,7 @@ def pallas_call_lowering(
ir=ir.StringAttr.get(buf.getvalue()),
num_stages=mlir.i32_attr(num_stages),
num_warps=mlir.i32_attr(num_warps),
waves_per_eu=mlir.i32_attr(waves_per_eu),
grid_x=mlir.i32_attr(grid_x),
grid_y=mlir.i32_attr(grid_y),
grid_z=mlir.i32_attr(grid_z),
Expand Down
Loading