Open
Conversation
Important Changes: - Change scaling of Softmax from 2**7-1 to 2**8-1 Current Limitations: - Only works without biases - Only works with ReLU activation - FeedForward and MatMul do only work with one Tile
…63_E127_P64_F64_H1_B1
gamzeisl
requested changes
Feb 1, 2025
Collaborator
gamzeisl
left a comment
There was a problem hiding this comment.
Overall, looks good! Minor changes are needed though.
- Fix CI.
- Fix HWPE and extend CI tests.
| - python testGenerator.py -H 1 -S 64 -E 64 -P 64 -F 64 --activation gelu | ||
| - python testGenerator.py -H 1 -S 128 -E 192 -P 256 -F 256 --activation gelu | ||
| - python testGenerator.py -H 1 -S 192 -E 256 -P 128 -F 128 --activation relu | ||
| - python testGenerator.py -H 1 -S 64 -E 64 -P 64 -F 64 --activation gelu --skip-vector-validation |
Collaborator
There was a problem hiding this comment.
Is disabling validation (--skip-vector-validation) a good idea for all? I would say to enable it for a subset of tests
| "-S${input:seq_len}", | ||
| "-E${input:emb_len}", | ||
| "-P${input:prj_len}", | ||
| "--no-bias" |
Comment on lines
+116
to
+119
| # assert (self.S % self.ITA_M == 0), "Sequence length must be divisible by ITA_M" | ||
| # assert (self.P % self.ITA_M == 0), "Projection space must be divisible by ITA_M" | ||
| # assert (self.E % self.ITA_M == 0), "Embedding size must be divisible by ITA_M" | ||
| # assert (self.F % self.ITA_M == 0), "Feedforward size must be divisible by ITA_M" |
Comment on lines
+361
to
+363
| # print(f"qk: {qk.shape}") | ||
| # print(f"qk: {weight.shape}") | ||
|
|
Comment on lines
+378
to
+390
| # fig, ax = plt.subplots(1, 2) # Create a figure with two subplots | ||
| # im0 = ax[0].imshow(Input, cmap='viridis') | ||
| # im1 = ax[1].imshow(np.squeeze(weight, axis=0)) | ||
|
|
||
| # # Add colorbars for each image if needed | ||
| # fig.colorbar(im0, ax=ax[0]) | ||
| # fig.colorbar(im1, ax=ax[1]) | ||
|
|
||
| # # Set titles for each subplot | ||
| # ax[0].set_title("Inputs") | ||
| # ax[1].set_title("Weights") | ||
|
|
||
| plt.show() |
| self.requant_add_ffn[0]) | ||
| self.FFp_requant = self.apply_activation(self.FFp_requant, self.activation) | ||
|
|
||
Comment on lines
+48
to
+51
| typedef logic [WO-WI*2-2:0] seq_length_t; | ||
| typedef logic [WO-WI*2-2:0] proj_space_t; | ||
| typedef logic [WO-WI*2-2:0] embed_size_t; | ||
| typedef logic [WO-WI*2-2:0] ff_size_t; |
Collaborator
There was a problem hiding this comment.
WO-WI*2-2 is unclear, why the bit width is set to this?
Author
There was a problem hiding this comment.
I also do not know why this bit width was defined this way. It was already used for the S, E, and P dimensions, so I used it for the F dimension as well. Should I change it to a constant?
Comment on lines
+36
to
+41
| // always_comb begin | ||
| // requant_mult = ctrl_i.eps_mult[step_q4]; | ||
| // requant_shift = ctrl_i.right_shift[step_q4]; | ||
| // requant_add = ctrl_i.add[step]; | ||
| // end | ||
|
|
Typo fix Co-authored-by: Gamze İslamoğlu <54476562+gamzeisl@users.noreply.github.com>
Co-authored-by: Gamze İslamoğlu <54476562+gamzeisl@users.noreply.github.com>
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.
This PR introduces initial support for handling arbitrary matrix shapes by adjusting both the Python model and the Softmax hardware module.
Changes
Python Model:
Current Limitations
ToDo