-
Notifications
You must be signed in to change notification settings - Fork 16
Arbitrary Matrix Shapes #9
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
base: main
Are you sure you want to change the base?
Arbitrary Matrix Shapes #9
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be left out
| # 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
| # print(f"qk: {qk.shape}") | ||
| # print(f"qk: {weight.shape}") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why these are commented?
| # 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why commented?
| self.requant_add_ffn[0]) | ||
| self.FFp_requant = self.apply_activation(self.FFp_requant, self.activation) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be omitted
| 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WO-WI*2-2 is unclear, why the bit width is set to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
| // 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 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
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 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