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

Add Flash decoding kernel ROCm #2855

Merged
merged 7 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
revert silu
  • Loading branch information
mht-sharma committed Dec 10, 2024
commit ca071bdd1d34cd7fab8e9430b2173cecb7e4664e
Original file line number Diff line number Diff line change
@@ -398,31 +398,10 @@ def forward(self, hidden_states, adapter_data):
return self.down_proj(out, adapter_data)
else:
gate_up_states = self.gate_up_proj(hidden_states, adapter_data)
# x = gate_up_states.view(-1, 1,self.intermediate_size)
# from loguru import logger
# logger.info(f"gate_up_states: {gate_up_states.shape}")
# x = self.act(gate_up_states[:, 0]) * gate_up_states[:, 1]
# logger.info(f"x: {x.shape}")

# return self.down_proj(
# x, adapter_data
# )

# gate_up_states: torch.Size([4096, 2, 14336])
# x: torch.Size([4096, 14336])

# gate_up_states = self.gate_up_proj(hidden_states, adapter_data)
# x = gate_up_states.view(-1, 2, self.intermediate_size)
# # x = gate_up_states[:, 0] * self.act(gate_up_states[:, 1])

output_shape = gate_up_states.shape[:-1] + (self.intermediate_size,)

out = torch.empty(
output_shape, dtype=gate_up_states.dtype, device=gate_up_states.device
gate_up_states = gate_up_states.view(-1, 2, self.intermediate_size)
return self.down_proj(
self.act(gate_up_states[:, 0]) * gate_up_states[:, 1], adapter_data
)
ops.silu_and_mul(out, gate_up_states)

return self.down_proj(out, adapter_data)


class FlashLlamaLayer(nn.Module):
Loading