Skip to content

Triage non-reproducible test failure in CI #1871

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,22 @@ jobs:
# create temporary empty folder to runs tests from
# https://github.com/pytest-dev/pytest/issues/11904
run: mkdir -p ${GITHUB_WORKSPACE}/test_tmp
- name: Run test_roll
working-directory: ${{ github.workspace }}/test_tmp
env:
SYCL_CACHE_PERSISTENT: 1
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate ${{ env.TEST_ENV_NAME }}
python -m pytest -s -v --pyargs $MODULE_NAME.tests.test_usm_ndarray_manipulation::test_roll_out_of_bound_shifts
- name: Run tests
working-directory: ${{ github.workspace }}/test_tmp
env:
SYCL_CACHE_PERSISTENT: 1
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate ${{ env.TEST_ENV_NAME }}
python -m pytest -v --pyargs $MODULE_NAME
python -m pytest -s -v --pyargs $MODULE_NAME

test_windows:
needs: build_windows
Expand Down
8 changes: 5 additions & 3 deletions dpctl/tensor/_manipulation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def roll(x, /, shift, *, axis=None):
res = dpt.empty(
x.shape, dtype=x.dtype, usm_type=x.usm_type, sycl_queue=exec_q
)
sz = x.size
sz = operator.index(x.size)
shift = (shift % sz) if sz > 0 else 0
dep_evs = _manager.submitted_events
hev, roll_ev = ti._copy_usm_ndarray_for_roll_1d(
Expand All @@ -373,11 +373,13 @@ def roll(x, /, shift, *, axis=None):
] * x.ndim
shape = x.shape
for sh, ax in broadcasted:
n_i = shape[ax]
shifts[ax] = (int(shifts[ax] + sh) % int(n_i)) if n_i > 0 else 0
n_i = operator.index(shape[ax])
shifted = operator.index(shifts[ax]) + operator.index(sh)
shifts[ax] = (shifted % n_i) if n_i > 0 else 0
res = dpt.empty(
x.shape, dtype=x.dtype, usm_type=x.usm_type, sycl_queue=exec_q
)
print(shifts)
dep_evs = _manager.submitted_events
ht_e, roll_ev = ti._copy_usm_ndarray_for_roll_nd(
src=x, dst=res, shifts=shifts, sycl_queue=exec_q, depends=dep_evs
Expand Down
22 changes: 11 additions & 11 deletions dpctl/tests/test_usm_ndarray_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,28 +657,28 @@ def test_roll_2d(data):
assert_array_equal(Ynp, dpt.asnumpy(Y))


def test_roll_out_bounds_shifts():
def test_roll_out_of_bound_shifts():
"See gh-1857"
get_queue_or_skip()

x = dpt.arange(4)
y = dpt.roll(x, np.uint64(2**63 + 2))
expected = dpt.roll(x, 2)
assert dpt.all(y == expected)
# y = dpt.roll(x, np.uint64(2**63 + 2))
# expected = dpt.roll(x, 2)
# assert dpt.all(y == expected)

x_empty = x[1:1]
y = dpt.roll(x_empty, 11)
assert y.size == 0
# x_empty = x[1:1]
# y = dpt.roll(x_empty, 11)
# assert y.size == 0

x_2d = dpt.reshape(x, (2, 2))
y = dpt.roll(x_2d, np.uint64(2**63 + 1), axis=1)
expected = dpt.roll(x_2d, 1, axis=1)
assert dpt.all(y == expected)

x_2d_empty = x_2d[:, 1:1]
y = dpt.roll(x_2d_empty, 3, axis=1)
expected = dpt.empty_like(x_2d_empty)
assert dpt.all(y == expected)
# x_2d_empty = x_2d[:, 1:1]
# y = dpt.roll(x_2d_empty, 3, axis=1)
# expected = dpt.empty_like(x_2d_empty)
# assert dpt.all(y == expected)


def test_roll_validation():
Expand Down
Loading