flagos-ai / flagos-ai/FlagBLAS

gbmv accuracy fail in hygon

Open
#69 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
7
Avg merge
11h 54m
Merged PRs (30d)
38

Description

introduce by pr https://github.com/flagos-ai/FlagBLAS/pull/79
============================= test session starts ==============================
platform linux -- Python 3.10.20, pytest-9.1.1, pluggy-1.6.0
rootdir: /home/secure/actions-runner/_work/FlagBLAS/FlagBLAS
configfile: pytest.ini
plugins: md-report-0.8.0
collected 1694 items

tests/test_gbmv.py ..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F

=================================== FAILURES ===================================
__________________ test_accuracy_zgbmv[0j-1-32-32-1024-4096] ___________________

m = 1024, n = 4096, kl = 32, ku = 32, trans = 1, beta = 0j

@pytest.mark.zgbmv
@pytest.mark.parametrize("m,n", GBMV_SHAPES)
@pytest.mark.parametrize("kl,ku", GBMV_BANDS)
@pytest.mark.parametrize("trans", [CUBLAS_OP_N, CUBLAS_OP_T, CUBLAS_OP_C])
@pytest.mark.parametrize("beta", [0.0j, 0.5 + 0.25j])
def test_accuracy_zgbmv(m, n, kl, ku, trans, beta):
check_fp64_support()
actual_kl, actual_ku, is_truncated = get_effective_bands(m, n, kl, ku)
if is_truncated and max(kl, ku) > max(m, n):
pytest.skip("Skipping redundant wide-band test.")

dtype, alpha = torch.complex128, 1.5 + 0.5j
lda = actual_kl + actual_ku + 1

AB = create_banded_data(m, n, actual_kl, actual_ku, lda, dtype, flag_blas.device)
x_len, y_len = (n, m) if trans == CUBLAS_OP_N else (m, n)
x = torch.randn(x_len, dtype=dtype, device=flag_blas.device)
y = torch.randn(y_len, dtype=dtype, device=flag_blas.device)
ref_y = gbmv_reference(
trans, m, n, actual_kl, actual_ku, alpha, AB, lda, x, 1, beta, y, 1
)
flag_blas.zgbmv(trans, m, n, actual_kl, actual_ku, alpha, AB, lda, x, 1, beta, y, 1)

> blas_assert_close(
y, ref_y, dtype, reduce_dim=gbmv_reduce_dim(trans, m, n, actual_kl, actual_ku)
)

tests/test_gbmv.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/accuracy_utils.py:409: in blas_assert_close
flag_blas.testing.assert_close(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

res = tensor([3.6592+4.9394j, 3.6592+4.9394j, 3.6592+4.9394j, ...,
0.0000+0.0000j, 0.0000+0.0000j, 0.0000+0.0000j], device='cuda:0',
dtype=torch.complex128)
ref = tensor([ 7.6734-7.6019j, 10.2815-5.6319j, 9.1147-6.8996j, ...,
0.0000+0.0000j, 0.0000+0.0000j, 0.0000+0.0000j], device='cuda:0',
dtype=torch.complex128)
dtype = torch.complex128, equal_nan = False, reduce_dim = 65, atol = 0.0001

def assert_close(res, ref, dtype, equal_nan=False, reduce_dim=1, atol=1e-4):
if dtype is None:
dtype = torch.float32
assert res.dtype == dtype
ref = ref.to(dtype)
res, ref = _maybe_move_to_cpu(res, ref)
rtol = RESOLUTION[dtype]
> torch.testing.assert_close(
res, ref, atol=atol * reduce_dim, rtol=rtol, equal_nan=equal_nan
)
E AssertionError: Tensor-likes are not close!
E
E Mismatched elements: 1056 / 4096 (25.8%)
E Greatest absolute difference: 49.29983820937869 at index (303,) (up to 0.006500000000000001 allowed)
E Greatest relative difference: 61.52377177917951 at index (556,) (up to 1e-07 allowed)

src/flag_blas/testing/__init__.py:87: AssertionError
=========================== short test summary info ============================
FAILED tests/test_gbmv.py::test_accuracy_zgbmv[0j-1-32-32-1024-4096] - AssertionError: Tensor-likes are not close!

Mismatched elements: 1056 / 4096 (25.8%)
Greatest absolute difference: 49.29983820937869 at index (303,) (up to 0.006500000000000001 allowed)
Greatest relative difference: 61.52377177917951 at index (556,) (up to 1e-07 allowed)
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
================== 1 failed, 1326 passed in 497.64s (0:08:17) ==================
Error: def assert_close(res, ref, dtype, equal_nan=False, reduce_dim=1, atol=1e-4):
if dtype is None:
dtype = torch.float32
assert res.dtype == dtype
ref = ref.to(dtype)
res, ref = _maybe_move_to_cpu(res, ref)
rtol = RESOLUTION[dtype]
> torch.testing.assert_close(
res, ref, atol=atol * reduce_dim, rtol=rtol, equal_nan=equal_nan
)
E AssertionError: Tensor-likes are not close!
E
E Mismatched elements: 1056 / 4096 (25.8%)
E Greatest absolute difference: 49.29983820937869 at index (303,) (up to 0.006500000000000001 allowed)
E Greatest relative difference: 61.52377177917951 at index (556,) (up to 1e-07 allowed)

src/flag_blas/testing/__init__.py:87: AssertionError
=========================== short test summary info ============================
FAILED tests/test_gbmv.py::test_accuracy_zgbmv[0j-1-32-32-1024-4096] - AssertionError: Tensor-likes are not

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the failing test tests/test_gbmv.py::test_accuracy_zgbmv for the reported Hygon parameters and inspect the flag_blas.zgbmv entry point. Compare its output with gbmv_reference and the failure in flag_blas.testing.assert_close; done means the complex zgbmv case passes the stated accuracy check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.