-
Notifications
You must be signed in to change notification settings - Fork 1
Improve docs #49
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?
Improve docs #49
Conversation
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.
Pull Request Overview
This PR refactors the internal pointer translation helper, tightens up public exports, and enriches docstrings for remote memory operations.
- Renames
translate
to private__translate
and updates all function signatures to uselocal_ptr
/local_rank
/remote_rank
conventions - Enhances docstrings for
load
,store
,get
,put
, and atomic operations with detailed parameter and return descriptions - Removes
translate
from public exports in__init__.py
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
iris/iris.py | Renamed translate to __translate , updated signatures and improved docstrings |
iris/init.py | Removed translate from imports and __all__ to make it an internal helper |
Comments suppressed due to low confidence (3)
iris/iris.py:318
- Add a docstring for
__translate
explaining its purpose, parameters, and return value to maintain consistency with other Triton helper functions.
def __translate(local_ptr, local_rank, remote_rank, heap_bases, debug=False):
iris/init.py:11
- Removing
translate
from the public exports is a breaking change; consider deprecating it for one release or updating the changelog to notify users of this API change.
iris,
iris/iris.py:318
- The new pointer translation logic in
__translate
(and its use in load/store/get/put) should have unit tests to verify correctness across different rank configurations.
def __translate(local_ptr, local_rank, remote_rank, heap_bases, debug=False):
Why do we have to describe it as local/remote only? If we use |
Correct. It is confusing and I would like to resolve that. Do you have suggestions? I have a few: # 1. Emphasizes direction of data flow
def load(pointer, to_rank, from_rank, heap_bases, mask=None):
# 2. Uses 'cur' to indicate the calling rank
def load(pointer, cur_rank, dst_rank, heap_bases, mask=None):
# 3. Generalizes roles as caller/target
def load(pointer, caller_rank, target_rank, heap_bases, mask=None): The pointer argument can be named I do like the from/to at the moment. Here are all APIs: def load(pointer, to_rank, from_rank, heap_bases, mask=None):
def store(pointer, val, from_rank, to_rank, heap_bases, mask=None):
def get(from_pointer, to_pointer, to_rank, from_rank, heap_bases, mask=None):
def put(from_pointer, to_pointer, from_rank, to_rank, heap_bases, mask=None):
def atomic_add(pointer, val, from_rank, to_rank, heap_bases, mask=None, sem=None, scope=None):
def atomic_sub(pointer, val, from_rank, to_rank, heap_bases, mask=None, sem=None, scope=None):
def atomic_cas(pointer, cmp, val, from_rank, to_rank, heap_bases, sem=None, scope=None):
def atomic_xchg(pointer, val, from_rank, to_rank, heap_bases, mask=None, sem=None, scope=None): |
Notes
Other suggestions:
def get(from_pointer, to_pointer, to_rank, from_rank, heap_bases, mask=None):
def put(from_pointer, to_pointer, from_rank, to_rank, heap_bases, mask=None): |
No. For that reason, I was considering adding a text to warn against that e.g., for load " The shortened How about this: def load(pointer, to_rank, from_rank, heap_bases, mask=None):
def store(pointer, val, from_rank, to_rank, heap_bases, mask=None):
def atomic_add(pointer, val, from_rank, to_rank, heap_bases, mask=None, sem=None, scope=None):
def atomic_sub(pointer, val, from_rank, to_rank, heap_bases, mask=None, sem=None, scope=None):
def atomic_cas(pointer, cmp, val, from_rank, to_rank, heap_bases, sem=None, scope=None):
def atomic_xchg(pointer, val, from_rank, to_rank, heap_bases, mask=None, sem=None, scope=None): and, def get(dst_ptr, src_ptr, to_rank, from_rank, heap_bases, mask=None):
def put(dst_ptr, src_ptr, to_rank, from_rank, heap_bases, mask=None): |
I am not sure I understand the warning. You mean
I prefer spelled out as well --- triton is not consistent with their naming, you can easily find examples of these. I like this! (with |
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.
Still lots of remote
, lets discuss the best way to word some of the descriptions.
""" | ||
Loads a value from the specified memory location and rank. | ||
Loads a value from a remote rank's memory location. |
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.
Loads a value from a remote rank's memory location. | |
Loads a value stored from a pointer of the specified rank. |
|
||
This function performs a remote memory read operation by translating the pointer | ||
from the from_rank's address space to the to_rank's address space and loading | ||
data from the remote memory location. |
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.
data from the remote memory location. | |
data from the remote memory location. If `to_rank` is the same as `from_rank`, | |
this function performs a local load operation instead. | |
heap_bases (int): The heap bases. | ||
mask (Optional[tl.tensor], optional): A boolean tensor used to guard memory accesses. | ||
pointer (triton.PointerType, or block of dtype=triton.PointerType): Pointer in the from_rank's address space that will be translated to the to_rank's address space. | ||
to_rank (int): The rank ID to which the pointer will be translated. Must be the current rank where the pointer is local. |
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.
to_rank (int): The rank ID to which the pointer will be translated. Must be the current rank where the pointer is local. | |
to_rank (int): The rank ID for the pointer where the load will occur. `to_rank` must be the rank where the pointer resides. |
mask (Optional[tl.tensor], optional): A boolean tensor used to guard memory accesses. Defaults to None. | ||
pointer (triton.PointerType, or block of dtype=triton.PointerType): Pointer in the from_rank's address space that will be translated to the to_rank's address space. | ||
val (Block): The tensor of elements to be stored. | ||
from_rank (int): The rank ID from which the pointer originates. Must be the current rank where the pointer is local. |
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.
from_rank (int): The rank ID from which the pointer originates. Must be the current rank where the pointer is local. | |
from_rank (int): The rank ID from which the pointer originates. `from_rank` must be the rank where the pointer resides. |
""" | ||
Loads a value from the specified memory location and rank. | ||
Copies data from a remote rank's memory to the current rank's local memory. |
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.
Use of the word remote
again.
First attempt at improving docs. local/remote is still a bit confusing.
Closes #46