-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Attention] Improve next token latency when (#threads >= 2 * #heads) …
…by sharding the head into multiple splits (#70) * support head split for cross attention * format the code
- Loading branch information
1 parent
1a522a2
commit 7430fe5
Showing
4 changed files
with
380 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <cstddef> | ||
#include <type_traits> | ||
|
||
template <typename T, std::size_t Alignment> | ||
struct AlignedType { | ||
alignas(Alignment) T data; | ||
|
||
// Default constructor | ||
AlignedType() = default; | ||
|
||
// Constructor to initialize with a value of type T | ||
explicit AlignedType(const T &value) : data(value) {} | ||
|
||
// Conversion operator to convert AlignedType to T | ||
operator T() const { return data; } | ||
|
||
// Overload the assignment operator to assign a value of type T | ||
AlignedType &operator=(const T &value) { | ||
data = value; | ||
return *this; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.