-
Notifications
You must be signed in to change notification settings - Fork 0
Add tests for atomic APIs. #50
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
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
Adds comprehensive unit tests for new atomic operations in the Iris library, covering add
, sub
, cas
, and xchg
across multiple data types, memory scopes, and cache‐ordering semantics.
- Introduces
test_atomic_add.py
,test_atomic_sub.py
,test_atomic_cas.py
, andtest_atomic_xchg.py
- Parameterizes tests over data types, scopes (
cta
,gpu
,sys
), semaphores (acquire
,release
,acq_rel
), and block sizes - Validates correctness of each atomic operation against expected Torch tensors
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
tests/unittests/test_atomic_add.py | New parameterized tests for iris.atomic_add |
tests/unittests/test_atomic_sub.py | New parameterized tests for iris.atomic_sub |
tests/unittests/test_atomic_cas.py | New parameterized tests for iris.atomic_cas |
tests/unittests/test_atomic_xchg.py | New parameterized tests for iris.atomic_xchg |
Comments suppressed due to low confidence (2)
tests/unittests/test_atomic_cas.py:19
- [nitpick] Using the name
cmp
may be confusing (and shadows the old Python2 builtin). Consider renaming tocmp_val
orcompare_val
for clarity.
cmp = tl.full((), 0, dtype=dtype) # scalar 0
tests/unittests/test_atomic_sub.py:1
- Triton does not support
atomic_sub
, causing these tests to fail with anAttributeError
. Add a module‐level skip, e.g.,pytest.skipif(not hasattr(iris, 'atomic_sub'), reason='atomic_sub not supported by Triton', allow_module_level=True)
.
import torch
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.
Looks good, modulo the Copilot comment and a question. Thanks!
Copilot comments are not needed in this case. |
Notes:
atomic_sub
,and
,or
,xor
,min
,max
: https://triton-lang.org/main/python-api/triton.language.html#atomic-ops