Skip to content
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

docs: update docs for element-addressable memory #1616

Merged
merged 9 commits into from
Jan 14, 2025

Conversation

plafer
Copy link
Contributor

@plafer plafer commented Jan 8, 2025

Updates the docs for element-addressable memory

@plafer plafer added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jan 9, 2025
@plafer plafer marked this pull request as ready for review January 9, 2025 21:51
@plafer plafer requested review from bobbinth and Al-Kindi-0 January 9, 2025 21:51
Copy link
Collaborator

@Al-Kindi-0 Al-Kindi-0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did an initial review and things look good.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just remove the helper registers as they have no use with the recent changes. For someone without any historical knowledge of the changes, having helper registers in the drawing will just be confusing, I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, and everywhere there are unused helper registers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal: would waddr or w_addr work better here and potentially everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find word_addr to be more descriptive, but I'm also okay with changing it

- When both the context and the address remain the same, this column contains the inverse of $(i' - i - 1)$.
- When the context remains the same but the word address changes, this column contains the inverse of $(a' - a)$.
- When both the context and the word address remain the same, this column contains the inverse of $(clk' - clk - 1)$.
- Column `f_scw` stands for "flag same context and word address", which is set to $1$ when the current and next rows have the same context and word address, and $0$ otherwise.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be "current and previous row" given the usage below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed

Comment on lines 184 to 185
- Column `t` contains the inverse of the delta between two consecutive context IDs, addresses, or clock cycles. Specifically:
- When the context changes, this column contains the inverse of $(c' - c)$.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but is this definition of t congruent with how n0 and n1 are defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm not sure I follow, could you rephrase?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, the above sentence says that t contains the inverse of c' - c but n0 is defined as n0 = (c' - c) . t'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current way it's written, it doesn't mention whether the "current" or "next" row in a frame contains the deltas. d0 and d1 are described in a similar manner.

I updated both to say that the "next" row contains the delta.

Comment on lines 281 to 301
- For the first row of the chiplet (in the "next" position of the frame), for $0 \leq i < 4$,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the selector, or at least a comment about it, for first row?
Similar comment about selector for within memory chiplet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I added the flags to all constraints

Comment on lines +274 to +294
c_i = rw' + (1 - rw') \cdot (1 - ew') \cdot (1 - f_i') \text{ | degree} = 4\\
$$
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a naming collision with regards to $c$.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed all c to ctx

Base automatically changed from plafer-1064-element-addressable-mem to element-addressable-memory January 10, 2025 16:56
@plafer plafer changed the base branch from element-addressable-memory to next January 10, 2025 16:56
@plafer plafer changed the base branch from next to element-addressable-memory January 10, 2025 16:56
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you. I left some comments inline. Assuming I didn't make too many mistakes, we should review the constraints more carefully.

@Al-Kindi-0 @paracetamolo - could you take another look as well?

docs/src/design/chiplets/memory.md Show resolved Hide resolved
docs/src/design/chiplets/memory.md Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
@bobbinth
Copy link
Contributor

Also, would be good to rebase this PR to get rid of the changes carried over from the previously merged PR.

@plafer plafer changed the base branch from element-addressable-memory to next January 13, 2025 14:32
@plafer plafer changed the base branch from next to element-addressable-memory January 13, 2025 14:32
@plafer plafer requested review from bobbinth and Al-Kindi-0 January 13, 2025 19:29
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left a few small comments inline.

Also, a question: are the memory chiplet bus constraints not implemented yet? (asking because even though we changed the description of constraints, nothing changed in the code).

docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
docs/src/design/chiplets/memory.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@Al-Kindi-0 Al-Kindi-0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Comment on lines +69 to +70
/// - `idx0` and `idx1` are selector columns used to identify which element in the word is being
/// accessed. Specifically, the index within the word is computed as `idx1 * 2 + idx0`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: probably worth adding that this is only when the op is an element op. Else, they are probably set to zero

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what we have in the sub-bullet point:

- However, when `ew` is set to $1$ (indicating that a word is accessed), these columns are meaningless and are set to $0$.

Comment on lines 309 to 310
- For all rows of the chiplet except the first, and when there is new context or word address, for $0 \leq i < 4$,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be updated after the merge of constraints

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right; fixed

@plafer
Copy link
Contributor Author

plafer commented Jan 14, 2025

Also, a question: are the memory chiplet bus constraints not implemented yet? (asking because even though we changed the description of constraints, nothing changed in the code).

The bus was modified in the previous PR (see

let is_word_access = main_trace.chiplet_selector_4(row);
let header = {
let is_read = main_trace.chiplet_selector_3(row);
let op_label = get_memory_op_label(is_read, is_word_access);
let ctx = main_trace.chiplet_memory_ctx(row);
let clk = main_trace.chiplet_memory_clk(row);
let address = {
let word = main_trace.chiplet_memory_word(row);
let idx0 = main_trace.chiplet_memory_idx0(row);
let idx1 = main_trace.chiplet_memory_idx1(row);
word + idx1.mul_small(2) + idx0
};
alphas[0] + build_value(&alphas[1..5], [op_label, ctx, address, clk])
};
if is_word_access == MEMORY_ACCESS_ELEMENT {
let idx0 = main_trace.chiplet_memory_idx0(row);
let idx1 = main_trace.chiplet_memory_idx1(row);
let value = if idx1 == ZERO && idx0 == ZERO {
main_trace.chiplet_memory_value_0(row)
} else if idx1 == ZERO && idx0 == ONE {
main_trace.chiplet_memory_value_1(row)
} else if idx1 == ONE && idx0 == ZERO {
main_trace.chiplet_memory_value_2(row)
} else if idx1 == ONE && idx0 == ONE {
main_trace.chiplet_memory_value_3(row)
} else {
panic!("Invalid word indices. idx0: {idx0}, idx1: {idx1}");
};
header + alphas[5].mul_base(value)
} else if is_word_access == MEMORY_ACCESS_WORD {
let value0 = main_trace.chiplet_memory_value_0(row);
let value1 = main_trace.chiplet_memory_value_1(row);
let value2 = main_trace.chiplet_memory_value_2(row);
let value3 = main_trace.chiplet_memory_value_3(row);
header + build_value(&alphas[5..9], [value0, value1, value2, value3])
} else {
panic!("Invalid memory element/word column value: {is_word_access}");
}
) - what we did in this PR is properly document what is already implemented.

@plafer plafer merged commit 29ef925 into element-addressable-memory Jan 14, 2025
9 checks passed
@plafer plafer deleted the plafer-docs-eam branch January 14, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog This PR does not require an entry in the `CHANGELOG.md` file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants