Repository navigation
spec: IS_WH
#1003
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
Merged
Merged
spec: IS_WH
#1003
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #import "/meta.typ": aside | ||
| #import "/src.typ": load_config, load_chip | ||
| #import "/chip.typ": ( | ||
| render_chip_variable_table, | ||
| total_nr_variables, | ||
| total_nr_instantiated_columns, | ||
| compute_nr_interactions, | ||
| render_constraint_table, | ||
| render_chip_assumptions, | ||
| render_chip_padding_table, | ||
| ) | ||
|
|
||
| #let config = load_config() | ||
| #let chip = load_chip("src/is_wh.toml", config) | ||
| #let is_wh = raw(chip.name) | ||
|
|
||
| Several chips load/write vast amounts of data from/to memory as part of their execution. | ||
| This quickly involves many memory interactions, as each interaction operates on | ||
| at most eight bytes at a time. | ||
| For each of these interactions, the address of the memory section being accessed | ||
| has to be stored on the chip in some way. | ||
| Given that many of these loads/writes operate on contiguous memory, these address | ||
| values typically only differ in their lowest limb, but exceptions exist. | ||
| As a result of these exceptions, the values of the upper limbs still need to | ||
| be range checked for every single address. | ||
|
|
||
| This #is_wh is introduced to reduce the range-checking pressure on these chips. | ||
| Rather than range checking all 64 bits locally, chips now only need to check the | ||
| bottom `Half` limb, and defer the check for the top 48 bits to this chip. | ||
| With several range checks for the same 48 bits coming in, the overhead incurred | ||
| on this chip is limited. | ||
| As a bonus, the calling chips can now often represent an address with a | ||
| `DWordWHH` rather than a `DWordHL`. | ||
| Hence, why the input of this chip are `Word`-`Half` pairs rather than `Half` triples. | ||
|
|
||
| = Variables | ||
| #let nr_variables = total_nr_variables(chip) | ||
| #let nr_columns = total_nr_instantiated_columns(chip, config) | ||
| #let nr_interactions = compute_nr_interactions(chip) | ||
|
|
||
| The #is_wh chip leverages #nr_variables variables, spanning #nr_columns columns and leverages #nr_interactions interactions: | ||
| #render_chip_variable_table(chip, config) | ||
|
|
||
| = Constraints | ||
| #render_constraint_table(chip, config, groups: "all") | ||
|
|
||
| = Padding | ||
|
|
||
| The table can be padded to the next power of two with the following value assignments: | ||
|
|
||
| #render_chip_padding_table(chip, config) | ||
|
|
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
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
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
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
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
|
RobinJadoul marked this conversation as resolved.
Resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name = "IS_WH" | ||
|
|
||
| [[variables.input]] | ||
| name = "value" | ||
| type = ["Half", 3] | ||
| desc = "`Word`-`Half` pair being range checked" | ||
| pad = 0 | ||
|
|
||
| [[variables.multiplicity]] | ||
| name = "μ" | ||
| type = "BaseField" | ||
| desc = "" | ||
| pad = 0 | ||
|
|
||
| [[constraint_groups]] | ||
| name = "all" | ||
|
|
||
| [[constraints.all]] | ||
| kind = "interaction" | ||
| tag = "IS_HALF" | ||
| input = [["idx", "value", "i"]] | ||
| iter = ["i", 0, 2] | ||
| multiplicity = "μ" | ||
| ref = "is_wh:c:range_value" | ||
|
|
||
| [[constraints.all]] | ||
| kind = "interaction" | ||
| tag = "IS_WH" | ||
| input = [["+", ["idx", "value", 1], ["*", ["^", 2, 16], ["idx", "value", 2]]], ["idx", "value", 0]] | ||
| multiplicity = ["-", "μ"] | ||
| ref = "is_wh:c:is_wh" |
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
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
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
Oops, something went wrong.
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.
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 affects one of the listed possible optimizations in ecsm.typ too
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.
You're right. updated the section.
Reading through the list of potential optimizations, I noticed that we could ~ halve this chip's size by supporting B24 carries. Given the push to reduce the size of this table, might be worthwile to pursue, or at least raise during the next meeting. wdyt?
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.
Might be worth discussing, depending on the current cost/load of this table on recursion