|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -VENDOR=${1} |
4 | | -echo "Running FlagGems tests with GEMS_VENDOR=$VENDOR" |
5 | | - |
6 | | -export MUSA_HOME=/usr/local/musa |
7 | | -export PATH=$MUSA_HOME/bin:$PATH |
8 | | -export LD_LIBRARY_PATH=$MUSA_HOME/lib:$LD_LIBRARY_PATH |
| 3 | +VENDOR=${1:-mthreads} |
9 | 4 |
|
10 | | -# PyEnv settings |
| 5 | +#=== Common setup === |
11 | 6 | export PYENV_ROOT="$HOME/.pyenv" |
12 | 7 | export PATH="$PYENV_ROOT/bin:$PATH" |
13 | 8 | eval "$(pyenv init - bash)" |
14 | | - |
15 | | -# Preamble |
16 | 9 | pip install -U pip |
17 | 10 | pip install uv |
18 | 11 | uv venv |
19 | 12 | source .venv/bin/activate |
20 | 13 |
|
| 14 | +echo "Running FlagGems tests with GEMS_VENDOR=$VENDOR" |
| 15 | + |
| 16 | +#=== Install === |
| 17 | + |
| 18 | +export FLAGOS_PYPI=https://resource.flagos.net/repository/flagos-pypi-${VENDOR}/simple |
| 19 | +uv pip install setuptools==79.0.1 scikit-build-core==0.12.2 pybind11==3.0.3 'cmake>=3.20,<4.0' ninja==1.13.0 |
| 20 | + |
21 | 21 | # Setup |
22 | 22 | uv pip install setuptools==82.0.1 scikit-build-core==0.12.2 pybind11==3.0.3 cmake==3.31.10 ninja==1.13.0 |
23 | | -uv pip install torch==2.7.1+musa.4.0.0 \ |
24 | | - --index https://resource.flagos.net/repository/flagos-pypi-mthreads/simple |
25 | | -uv pip install triton==3.1.0+musa1.4.6 \ |
26 | | - --index https://resource.flagos.net/repository/flagos-pypi-mthreads/simple |
27 | | -uv pip install torch_musa==2.7.1 \ |
28 | | - --index https://resource.flagos.net/repository/flagos-pypi-mthreads/simple |
29 | | - |
| 23 | +uv pip install --index $FLAGOS_PYPI |
| 24 | + "torch==2.7.1+musa.4.0.0" \ |
| 25 | + "torch_musa==2.7.1" \ |
| 26 | + "triton==3.1.0+musa1.4.6" |
30 | 27 | uv pip install -e .[mthreads,test] |
31 | 28 |
|
| 29 | +#=== Start testing === |
| 30 | + |
| 31 | +export MUSA_HOME=/usr/local/musa |
| 32 | +export PATH=$MUSA_HOME/bin:$PATH |
| 33 | +export LD_LIBRARY_PATH=$MUSA_HOME/lib:$LD_LIBRARY_PATH |
32 | 34 | # For the intel math library |
33 | 35 | export LD_LIBRARY_PATH=$VIRTUAL_ENV/lib:$LD_LIBRARY_PATH |
34 | 36 |
|
35 | | -# Print out package versions for debugging. |
36 | | -uv pip list |
37 | | - |
38 | | -# In case the backend detection fails |
39 | | -# export GEMS_VENDOR=$VENDOR |
40 | | - |
41 | | -# Reduction ops |
42 | | -# FIXME(moore): Softmax only support float32/float16/bfloat16 |
43 | | -# pytest -s tests/test_reduction_ops.py |
44 | | -pytest -s tests/test_general_reduction_ops.py |
45 | | -# FIXME(moore): BatchNorm supports Float/Half/BFloat16 input dtype |
46 | | -# pytest -s tests/test_norm_ops.py |
47 | | - |
48 | | -# Pointwise ops |
49 | | -pytest -s tests/test_pointwise_dynamic.py |
50 | | -# FIXME(moore): RuntimeError: _Map_base::at (missing operators) |
51 | | -pytest -s tests/test_unary_pointwise_ops.py |
52 | | -pytest -s tests/test_binary_pointwise_ops.py |
53 | | -pytest -s tests/test_pointwise_type_promotion.py |
54 | | - |
55 | | -# TODO: test_accuracy_randperm |
56 | | -pytest -s tests/test_tensor_constructor_ops.py |
57 | | - |
58 | | -# BLAS ops |
59 | | -# TODO(Qiming): Fix sharedencoding on Hopper |
60 | | -pytest -s tests/test_attention_ops.py |
61 | | -# FIXME(moore): unsupported data type DOUBLE |
62 | | -# pytest -s tests/test_blas_ops.py |
63 | | - |
64 | | -# Special ops |
65 | | -pytest -s tests/test_special_ops.py |
66 | | - |
67 | | -# Distribution |
68 | | -pytest -s tests/test_distribution_ops.py |
69 | | - |
70 | | -# Convolution ops |
71 | | -pytest -s tests/test_convolution_ops.py |
72 | | - |
73 | | -# Utils |
74 | | -# pytest -s tests/test_libentry.py |
75 | | -pytest -s tests/test_shape_utils.py |
76 | | -pytest -s tests/test_tensor_wrapper.py |
| 37 | +echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" |
| 38 | + |
| 39 | +echo "Starting tests..." |
| 40 | + |
| 41 | +TEST_FILES=( |
| 42 | + # Reduction |
| 43 | + "tests/test_reduction_ops.py" |
| 44 | + "tests/test_general_reduction_ops.py" |
| 45 | + "tests/test_norm_ops.py" |
| 46 | + # Pointwise |
| 47 | + "tests/test_pointwise_dynamic.py" |
| 48 | + "tests/test_unary_pointwise_ops.py" |
| 49 | + "tests/test_binary_pointwise_ops.py" |
| 50 | + "tests/test_pointwise_type_promotion.py" |
| 51 | + # Tensor |
| 52 | + "tests/test_tensor_constructor_ops.py" |
| 53 | + "tests/test_tensor_wrapper.py" |
| 54 | + # Attention |
| 55 | + "tests/test_attention_ops.py" |
| 56 | + "tests/test_blas_ops.py" |
| 57 | + # Special |
| 58 | + "tests/test_special_ops.py" |
| 59 | + # Distribution |
| 60 | + "tests/test_distribution_ops.py" |
| 61 | + # Convolution |
| 62 | + "tests/test_convolution_ops.py" |
| 63 | + # Utils |
| 64 | + "tests/test_libentry" |
| 65 | + "tests/test_shape_utils.py" |
| 66 | + # DSA |
| 67 | + "tests/test_DSA/test_bin_topk.py" |
| 68 | + "tests/test_DSA/test_sparse_mla_ops.py" |
| 69 | + "tests/test_DSA/test_indexer_k_tiled.py" |
| 70 | + # FLA |
| 71 | + "tests/test_FLA/test_fla_utils_input_guard.py" |
| 72 | + "tests/test_FLA/test_fused_recurrent_gated_delta_rule.py" |
| 73 | +) |
| 74 | + |
| 75 | +for testcase in "${TEST_FILES[@]}"; do |
| 76 | + echo "Testing $testcase" |
| 77 | + pytest -s --tb=line $testcase --ref cpu |
| 78 | +done |
0 commit comments