Repository navigation
Matrix llvmir - #11
Merged
Merged
Conversation
YWHyuk
reviewed
Jan 11, 2024
| var = self.cse.generate(self.loads, line) | ||
| # stride is input row size | ||
| stride = self.ranges[-1] * align | ||
| # NOTE. Since clang 16.0 always used this constant, 2 is hard coded |
Collaborator
There was a problem hiding this comment.
This sentence is unnecessarily copied
| var = self.cse.generate(self.stores, line) | ||
| # stride is input row size | ||
| stride = self.ranges[-1] * align | ||
| # NOTE. Since clang 16.0 always used this constant, 2 is hard coded |
| raise AssertionError(reduction_type) | ||
|
|
||
| def matrix_reduction_combine(reduction_type, start_value, vector_value): | ||
| tile_rows = 4 # FIXME. hard coded |
Collaborator
There was a problem hiding this comment.
I think it is better to use global variable to define tile row, tile col and tile size
| raise AssertionError(reduction_type) | ||
|
|
||
| def matrix_partial_reduction_combine(reduction_type, vector_value): | ||
| tile_rows = 4 # FIXME. hard coded |
| class MatrixOverrides(ExtensionOverrides): | ||
| @staticmethod | ||
| def add(operand1, operand2): | ||
| tile_size = 16 # FIXME. hard coded |
| self.index_cse = common.CSE(self.newvar_prefix, self.suffix, name_prefix="tmp_idx") | ||
| self.tile_size = 16 # FIXME. hard coded | ||
| self.tile_row = 4 # FIXME. hard coded | ||
| self.tile_col = 4 # FIXME. hard coded |
| for j in range(self.tile_row): | ||
| line += f"i32 {i*self.tile_row+j}, " | ||
| # replace last comma to ">" | ||
| line = line[:-2] + ">" |
Collaborator
There was a problem hiding this comment.
var = [f"i32 {i*self.tile_row+j}, " for j in self.tile_row]
var2 = ","
line.join(var)
?
| else: | ||
| line = f"shufflevector <{size} x {type_name}> %{op1}, <{size} x {type_name}> %{op2}, <{size * 2} x i32> <" | ||
| for j in range(size * 2): | ||
| line += f"i32 {j}, " |
| reduction_vars: Dict[str, str] = None | ||
| tile_size = 16 # FIXME. hard coded | ||
| tile_row = 4 | ||
| tile_col = 4 |
| def codegen_loops(self): | ||
| code = common.BracesBuffer() | ||
| # Loop body part | ||
| loops = [MatrixLoopLevel(var, size, idx) for idx, (var, size) in enumerate(zip(self.itervars, self.ranges))] |
Collaborator
There was a problem hiding this comment.
Since we use 2D tiling, number of MatrixLoopLevel would be max 2. It seems that this code can lead error
YunseonShin
force-pushed
the
matrix_llvmir
branch
from
January 12, 2024 12:58
0cda113 to
0cffeb9
Compare
Collaborator
|
LGTM! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Matrix LLVM IR Code generation is implemented.
TILE SIZE is hard coded and notified with "FIXME"