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

[Lang] Revisit memory model #321

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

llvm-beanz
Copy link
Collaborator

This change cleans up some of the wording in the memory model and clearly defines the terms byte, memory location, memory access, and memory operation.

These terms will be useful in writing the Classes chapter where the layout of objects needs to be defined.

This change cleans up some of the wording in the memory model and clearly defines the terms _byte_, _memory location_, _memory access_, and _memory operation_.

These terms will be useful in writing the Classes chapter where the layout of objects needs to be defined.
specs/language/introduction.tex Outdated Show resolved Hide resolved
specs/language/introduction.tex Outdated Show resolved Hide resolved
specs/language/introduction.tex Outdated Show resolved Hide resolved
specs/language/introduction.tex Outdated Show resolved Hide resolved
specs/language/introduction.tex Outdated Show resolved Hide resolved
specs/language/introduction.tex Outdated Show resolved Hide resolved
must not alter memory at a location not contained in the set of memory locations it
is operating on\footnote{Two subtle notes here: (1) A bit-field's memory location
includes adjacent bit-fields, so reads and writes to bit-fields are expected to
read and write adjacent memory if they're within the same set of locations, (2)
Copy link

Choose a reason for hiding this comment

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

To me the usage of 'same set of locations' is a bit ambiguous. After a few reads I assume it means the adjacent bit-fields. Maybe something like:

Suggested change
read and write adjacent memory if they're within the same set of locations, (2)
read and write adjacent memory if they're within the adjacent bitfields' memory locations, (2)

Copy link

Choose a reason for hiding this comment

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

To me the usage of 'same set of locations' is a bit ambiguous. After a few reads I assume it means the adjacent bit-fields. Maybe something like:

Maybe a caveat is needed to specify the adjacent bitfields' memory locations, do not ALSO include their adjacent bitfields.

and a 128-bit \textit{minimum alignment}.
\end{note}

\p A memory location in any space may overlap with another memory location in
Copy link

Choose a reason for hiding this comment

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

Does this mean you have say a MAU of 4 bytes, but you can have a memory location that accesses at byte 0 and a different memory location that accesses at byte 2?

\p A memory location in any space may overlap with another memory location in
the same space. A memory location in thread or threadgroup memory may not
overlap with memory locations in any other memory spaces. It is implementation
defined if memory locations in other memory spaces alias with memory locations
Copy link

@spall spall Sep 20, 2024

Choose a reason for hiding this comment

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

This sentence here makes me wonder if I'm interpreting the first sentence in this paragraph correctly.

Edit: it didn't tag the line correctly. I mean line 314.


\SubSub{Constant Memory}{Intro.Memory.Spaces.Overlap}

\p The \textbf{Thread} and \textbf{Thread Group} memory spaces may not overlap
Copy link

@spall spall Sep 20, 2024

Choose a reason for hiding this comment

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

Is this paragraph just stating part of what was said in the paragraph starting on line 311?
Nit: I was initially confused by the use of both 'memory location' and 'address'; I had just glazed over the fact that they are defined to be the same thing. It might be nice to use one or the other.

Operations that perform memory accesses are called \textit{memory operations}. A
memory operation may operate on one or more memory locations. A memory operation
must not alter memory at a location not contained in the set of memory locations it
is operating on\footnote{Two subtle notes here: (1) A bit-field's memory location
Copy link
Collaborator

Choose a reason for hiding this comment

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

Defining the commonly understood term memory access granularity and specifying the access granularity to be a byte along with subsequent usage of the term may be a better option than using "bit-fields".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bit-fields are a specific language structure that has unique properties in the memory model because of their unique packing behavior.

Copy link
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

The section on bit-fields is much clearer now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants