Skip to content
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

Streamk v0.2 #646

Open
wants to merge 20 commits into
base: main_perf
Choose a base branch
from
Open

Streamk v0.2 #646

wants to merge 20 commits into from

Conversation

xiaohuguo2023
Copy link
Member

streamk v0.2:

  • new streamk tuning script to reduce compiling and profiling time

  • use load/store cache modifier to reimplement spinning lock

  • add CI test for streamk-kernel

  • able to use streampipelineV2

@neoblizz neoblizz self-requested a review September 26, 2024 21:17
Copy link

@neoblizz neoblizz left a comment

Choose a reason for hiding this comment

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

I put in some comments.

Choose a reason for hiding this comment

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

Note, for gfx90a the load/stores with cache_modifiers do not work. Documented here: https://github.com/ROCm/triton-internal/issues/311

rm1 = tl.max_contiguous(tl.multiple_of(rm1, BLOCK_SIZE_M), BLOCK_SIZE_M)
rn1 = tl.max_contiguous(tl.multiple_of(rn1, BLOCK_SIZE_N), BLOCK_SIZE_N)
P_ = P + pid * BLOCK_SIZE_M * BLOCK_SIZE_N + rm1[:, None] * BLOCK_SIZE_N + rn1[None, :]
tl.store(P_, acc, cache_modifier=".wt")

Choose a reason for hiding this comment

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

Note, for gfx90a the load/stores with cache_modifiers do not work. Documented here: https://github.com/ROCm/triton-internal/issues/311

# todo: try use tl.load once cache modifier landed upstream
while tl.atomic_cas(locks + next_pid, 1, 1) != 1:
while (end < tile_iter_end and next_pid < NUM_SMS):
while tl.load(locks + next_pid, cache_modifier=".cv", volatile=True) != 1:

Choose a reason for hiding this comment

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

This also does not work in gfx90a: https://github.com/ROCm/triton-internal/issues/311

EVEN_K: tl.constexpr,
):
pid = tl.program_id(0)
pid = get_new_pid(pid, num_cus)
pid = (pid % 8) * (NUM_SMS // 8) + (pid // 8)

Choose a reason for hiding this comment

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

This is not needed for anything but gfx942, so we will actually remove this if the arch was gfx90a.

P = torch.zeros((num_cus, block_m * block_n), device="cuda", dtype=torch.float32)
triton_output = matmul(a, b, c, P, locks, num_cus, block_m, block_n, block_k, group_m, num_warps, num_stages,
waves_per_eu, mfmaInstrSize, kpack, EVEN_K)
locks = torch.zeros((num_sms, ), device="cuda", dtype=torch.int32)

Choose a reason for hiding this comment

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

locks can be less than int32 type, we only need 1 byte: uint8 should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants