Skip to content

refactor: make data type mappings and shared CUDA headers device-aware - #38

Merged
voltjia merged 13 commits into
feat/dev-infrafrom
refactor/device-aware-data-types
Apr 1, 2026
Merged

voltjia merged 13 commits into
feat/dev-infrafrom
refactor/device-aware-data-types

Conversation

@voltjia

@voltjia voltjia commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make TypeMap, IsFP16, IsBFloat16, and DispatchFunc accept a Device::Type template parameter so each platform can specialize float16/bfloat16 to its own C++ type (half, __half, __mt_bfloat16, etc.)
  • Remove platform-specific symbols (QueryMaxThreadsPerBlock, half, DevicePropertyCache) from shared cuda/ headers; each platform's device_.h now provides its own TypeMap specializations, Caster definition, and Backend::GetOptimalBlockSize()
  • Update all call sites across CPU, NVIDIA, Iluvatar, MetaX, Moore, and Cambricon backends
  • Fix cuda/swiglu kernels to use IsFP16<kDev, T> / IsBFloat16<kDev, T> predicates and Caster<kDev> instead of direct CUDA type names, making them include-order-independent
  • Fix cuBLAS handle exhaustion in Blas by replacing per-instance blasHandle_t with a static singleton

Motivation

The shared cuda/ headers previously referenced platform-specific types like half and half2 directly. This created implicit include-order dependencies — clang-format's IncludeBlocks: Regroup would silently break compilation by reordering includes. Every file that touched these headers needed // clang-format off/on guards.

Additionally, TypeMap<dtype> mapped kFloat16/kBFloat16 to a single C++ type, ignoring that each platform uses a different underlying type.

@voltjia

voltjia commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator Author
<== PASS  iluvatar_gpu   (98s)
<== PASS  nvidia_gpu     (172s)
<== PASS  metax_gpu      (240s)
<== PASS  cambricon_gpu  (288s)

========== Failed ==========
  FAIL  moore_gpu  error (0s)

Copilot AI left a comment

Copy link
Copy Markdown

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 dtype/type-dispatch layer to be device-aware so each backend can provide its own float16/bfloat16 C++ types, and removes backend-specific CUDA symbols from shared src/cuda/ headers to avoid include-order fragility across GPU platforms.

Changes:

  • Make TypeMap / IsFP16 / IsBFloat16 and DispatchFunc device-parameterized, with per-backend device_.h specializations.
  • Refactor shared CUDA-like kernels (add/swiglu/rms_norm/causal_softmax) to use device-aware TypeMapType<kDev,...> and Caster<kDev>, and move block-size selection behind Backend::GetOptimalBlockSize().
  • Change BLAS handle management to a static singleton handle.

Reviewed changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
src/tensor.cc Updates dtype dispatch to pass Device::Type::kCpu.
src/pybind11_utils.h Builds Torch device-name map from ActiveDevices list.
src/dispatcher.h Adds Device::Type parameterization for DataType dispatch adapters and list-alias dispatch.
src/data_type.h Makes TypeMap device-aware; updates IsFP16/IsBFloat16 predicates accordingly.
src/common/constexpr_map.h Minor formatting update.
src/cpu/device_.h New CPU TypeMap specializations for FP16/BF16.
src/cpu/caster_.h Includes CPU device mapping and updates FP16/BF16 predicates to be device-aware.
src/cpu/add/add.h Updates dtype dispatch and FP16/BF16 predicate usage for CPU.
src/cpu/swiglu/swiglu.h Updates dtype dispatch and FP16/BF16 predicate usage for CPU.
src/cpu/rms_norm/rms_norm.h Updates dtype dispatch for CPU.
src/cpu/causal_softmax/causal_softmax.h Updates dtype dispatch for CPU.
src/cpu/gemm/gemm.h Updates dtype dispatch for CPU.
src/cuda/caster_.h Introduces CudaCasterImpl<kDev> and removes platform header selection from shared CUDA caster.
src/cuda/kernel_commons.h Removes platform-specific includes and device-property helpers from shared CUDA header.
src/cuda/add/kernel.h Uses Backend::GetOptimalBlockSize() and device-aware TypeMapType.
src/cuda/add/kernel.cuh Makes the add kernel/device predicates device-aware.
src/cuda/swiglu/kernel.h Uses Backend::GetOptimalBlockSize() and device-aware TypeMapType; passes kDev into kernel.
src/cuda/swiglu/kernel.cuh Reworks swiglu to use IsFP16<kDev,T> / IsBFloat16<kDev,T> and Caster<kDev>.
src/cuda/rms_norm/kernel.h Uses Backend::GetOptimalBlockSize() and device-aware TypeMapType; passes kDev into kernel; changes dtype checks to assert.
src/cuda/rms_norm/kernel.cuh Makes casts device-aware via Caster<kDev>.
src/cuda/causal_softmax/kernel.h Uses Backend::GetOptimalBlockSize() and device-aware TypeMapType; passes kDev into kernel; changes dtype checks to assert.
src/cuda/causal_softmax/kernel.cuh Makes casts device-aware via Caster<kDev>.
src/cuda/gemm/blas.h Replaces per-instance BLAS handle with a static singleton handle.
src/nvidia/device_.h Adds NVIDIA TypeMap specializations, CUDA prop cache, QueryMaxThreadsPerBlock(), and Caster specialization.
src/nvidia/add/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/nvidia/swiglu/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/nvidia/rms_norm/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/nvidia/causal_softmax/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/iluvatar/device_.h Adds Iluvatar TypeMap specializations, CUDA prop cache, QueryMaxThreadsPerBlock(), and Caster specialization.
src/iluvatar/add/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/iluvatar/swiglu/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/iluvatar/rms_norm/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/iluvatar/causal_softmax/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/metax/device_.h Adds MetaX TypeMap specializations, QueryMaxThreadsPerBlock(), and Caster specialization.
src/metax/add/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/metax/swiglu/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/metax/rms_norm/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/metax/causal_softmax/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/moore/device_.h Adds Moore TypeMap specializations, QueryMaxThreadsPerBlock(), and Caster specialization.
src/moore/add/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/moore/swiglu/kernel.h Adds kDeviceType and GetOptimalBlockSize(), and adjusts includes.
src/cambricon/device_.h New Cambricon TypeMap specializations for FP16/BF16.
src/cambricon/rms_norm/rms_norm.h Includes Cambricon device mapping and updates dispatch to pass device type.
src/cambricon/rms_norm/kernel.mlu Formatting and pointer-cast cleanup; keeps explicit template instantiations.
Comments suppressed due to low confidence (1)

src/cuda/kernel_commons.h:13

  • kernel_commons.h now uses size_t / ptrdiff_t in the public API but doesn't include <cstddef>. Relying on transitive includes makes this header non-self-contained and can break builds depending on include order. Add the direct standard includes needed for the types it uses.
#include "caster.h"

namespace infini::ops {

using AllCudaBlockSizes = List<128, 256, 512, 1024, 2048>;

__forceinline__ __device__ __host__ size_t
IndexToOffset(size_t flat_index, size_t ndim, const size_t* shape,
              const ptrdiff_t* strides) {
  size_t res = 0;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/nvidia/add/kernel.h
Comment thread src/nvidia/swiglu/kernel.h
Comment thread src/nvidia/rms_norm/kernel.h
Comment thread src/nvidia/causal_softmax/kernel.h
Comment thread src/iluvatar/add/kernel.h
Comment thread src/cuda/rms_norm/kernel.h
Comment thread src/cuda/causal_softmax/kernel.h
Comment thread src/cuda/gemm/blas.h
Comment thread src/cuda/swiglu/kernel.cuh
Comment thread src/pybind11_utils.h
… `clang-format off` and `clang-format on`
@voltjia

voltjia commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator Author

Moore

WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing ./.
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: InfiniOps
  Building wheel for InfiniOps (pyproject.toml): started
  Building wheel for InfiniOps (pyproject.toml): finished with status 'done'
  Created wheel for InfiniOps: filename=infiniops-0.1.0-cp310-cp310-linux_x86_64.whl size=349904 sha256=8b9e309fd2618d51abf2d91dcb8d90931762f6159ec5301ce3475f6dfcfb3d64
  Stored in directory: /tmp/pip-ephem-wheel-cache-gahsqqeh/wheels/b5/f3/6e/961028f73a2712eb7b753a23bdd1baaa714e27760fd92de56c
Successfully built InfiniOps
Installing collected packages: InfiniOps
  Attempting uninstall: InfiniOps
    Found existing installation: InfiniOps 0.1.0
    Uninstalling InfiniOps-0.1.0:
      Successfully uninstalled InfiniOps-0.1.0
Successfully installed InfiniOps-0.1.0
============================= test session starts ==============================
platform linux -- Python 3.10.20, pytest-7.2.2, pluggy-1.6.0
rootdir: /home/huangjiacheng/InfiniOps, configfile: pyproject.toml, testpaths: tests
plugins: cov-7.0.0, xdist-3.8.0, hypothesis-6.145.0, anyio-4.10.0
collected 3372 items

tests/test_add.py ...................................................... [  1%]
........................................................................ [  3%]
......................................................ssssssssssssssssss [  5%]
ssssssssssssssssss                                                       [  6%]
tests/test_causal_softmax.py ..................Fatal Python error: Segmentation fault

Current thread 0x00007f7f26971740 (most recent call first):
  File "/home/huangjiacheng/InfiniOps/tests/test_causal_softmax.py", line 43 in _causal_softmax
  File "/home/huangjiacheng/InfiniOps/tests/conftest.py", line 80 in pytest_pyfunc_call
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_callers.py", line 121 in _multicall
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py", line 512 in __call__
  File "/usr/local/lib/python3.10/dist-packages/_pytest/python.py", line 1789 in runtest
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 167 in pytest_runtest_call
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_callers.py", line 121 in _multicall
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py", line 512 in __call__
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 260 in <lambda>
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 339 in from_call
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 259 in call_runtest_hook
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 220 in call_and_report
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 131 in runtestprotocol
  File "/usr/local/lib/python3.10/dist-packages/_pytest/runner.py", line 112 in pytest_runtest_protocol
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_callers.py", line 121 in _multicall
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py", line 512 in __call__
  File "/usr/local/lib/python3.10/dist-packages/_pytest/main.py", line 349 in pytest_runtestloop
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_callers.py", line 121 in _multicall
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py", line 512 in __call__
  File "/usr/local/lib/python3.10/dist-packages/_pytest/main.py", line 324 in _main
  File "/usr/local/lib/python3.10/dist-packages/_pytest/main.py", line 270 in wrap_session
  File "/usr/local/lib/python3.10/dist-packages/_pytest/main.py", line 317 in pytest_cmdline_main
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_callers.py", line 121 in _multicall
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py", line 512 in __call__
  File "/usr/local/lib/python3.10/dist-packages/_pytest/config/__init__.py", line 167 in main
  File "/usr/local/lib/python3.10/dist-packages/_pytest/config/__init__.py", line 190 in console_main
  File "/usr/local/lib/python3.10/dist-packages/pytest/__main__.py", line 5 in <module>
  File "/home/huangjiacheng/.local/share/uv/python/cpython-3.10-linux-x86_64-gnu/lib/python3.10/runpy.py", line 86 in _run_code
  File "/home/huangjiacheng/.local/share/uv/python/cpython-3.10-linux-x86_64-gnu/lib/python3.10/runpy.py", line 196 in _run_module_as_main

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, torch._C, torch._C._dynamo.autograd_compiler, torch._C._dynamo.eval_frame, torch._C._dynamo.guards, torch._C._dynamo.utils, torch._C._fft, torch._C._linalg, torch._C._nested, torch._C._nn, torch._C._sparse, torch._C._special, torch_musa._MUSAC, markupsafe._speedups (total: 26)

@Ziminli

Ziminli commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator
image

Comment thread src/cambricon/rms_norm/rms_norm.h Outdated
Comment thread src/cambricon/device_.h Outdated
Comment thread src/data_type.h Outdated
Comment thread src/iluvatar/add/kernel.h Outdated
@voltjia

voltjia commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

output.log:

<== PASS  iluvatar_gpu   (94s)
<== FAIL  nvidia_gpu     (159s)
--- error output (last 50 lines) ---
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype1-0.01-0.01-1e-06-input_shape0-weight_shape0-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype1-0.01-0.01-1e-06-input_shape4-weight_shape4-input_strides4-weight_strides4-out_strides4]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype1-0.01-0.01-1e-05-input_shape3-weight_shape3-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype1-0.01-0.01-1e-06-input_shape5-weight_shape5-input_strides5-weight_strides5-out_strides5]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype1-0.01-0.01-1e-05-input_shape5-weight_shape5-input_strides5-weight_strides5-out_strides5]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype1-0.01-0.01-1e-05-input_shape4-weight_shape4-input_strides4-weight_strides4-out_strides4]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype0-0.0001-0.0001-1e-06-input_shape1-weight_shape1-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-06-input_shape0-weight_shape0-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-06-input_shape4-weight_shape4-input_strides4-weight_strides4-out_strides4]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-05-input_shape3-weight_shape3-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype0-0.0001-0.0001-1e-06-input_shape2-weight_shape2-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-06-input_shape5-weight_shape5-input_strides5-weight_strides5-out_strides5]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-06-input_shape1-weight_shape1-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype0-0.0001-0.0001-1e-06-input_shape3-weight_shape3-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-05-input_shape4-weight_shape4-input_strides4-weight_strides4-out_strides4]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-06-input_shape2-weight_shape2-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-05-input_shape0-weight_shape0-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype0-0.0001-0.0001-1e-06-input_shape4-weight_shape4-input_strides4-weight_strides4-out_strides4]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-05-input_shape5-weight_shape5-input_strides5-weight_strides5-out_strides5]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype0-0.0001-0.0001-1e-06-input_shape5-weight_shape5-input_strides5-weight_strides5-out_strides5]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-05-input_shape1-weight_shape1-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-06-input_shape3-weight_shape3-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype0-0.0001-0.0001-1e-05-input_shape0-weight_shape0-None-None-None]
    FAILED tests/test_rms_norm.py::test_rms_norm[cuda-dtype2-0.02-0.01-1e-05-input_shape2-weight_shape2-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape0-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape1-input_strides1-gate_strides1-out_strides1]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape4-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape5-input_strides5-gate_strides5-out_strides5]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape6-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape7-input_strides7-gate_strides7-out_strides7]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape2-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape0-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype0-1e-07-1e-07-shape3-input_strides3-gate_strides3-out_strides3]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape2-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape1-input_strides1-gate_strides1-out_strides1]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape6-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape3-input_strides3-gate_strides3-out_strides3]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape4-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape7-input_strides7-gate_strides7-out_strides7]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype1-0.001-0.001-shape5-input_strides5-gate_strides5-out_strides5]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape0-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape3-input_strides3-gate_strides3-out_strides3]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape1-input_strides1-gate_strides1-out_strides1]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape2-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape4-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape6-None-None-None]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape7-input_strides7-gate_strides7-out_strides7]
    FAILED tests/test_swiglu.py::test_swiglu[cuda-dtype2-0.01-0.005-shape5-input_strides5-gate_strides5-out_strides5]
    ================ 1686 failed, 1686 passed in 105.48s (0:01:45) =================
    ========== Summary ==========
---
<== PASS  metax_gpu      (206s)
<== PASS  moore_gpu      (211s)
<== PASS  cambricon_gpu  (284s)

========== Failed ==========
  FAIL  nvidia_gpu  failure (159s)

英伟达上的错误是因为 CI 运行时选择的卡 OOM 了,我换了张卡单独跑了一下:

Processing /home/huangjiacheng/InfiniOps
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: InfiniOps
  Building wheel for InfiniOps (pyproject.toml): started
  Building wheel for InfiniOps (pyproject.toml): finished with status 'done'
  Created wheel for InfiniOps: filename=infiniops-0.1.0-cp310-cp310-linux_x86_64.whl size=388303 sha256=0811314bd939174d98d07444b496d0bf2b323e910dd6f7fe707606888a2d7d12
  Stored in directory: /tmp/pip-ephem-wheel-cache-6xt04dsk/wheels/b5/f3/6e/961028f73a2712eb7b753a23bdd1baaa714e27760fd92de56c
Successfully built InfiniOps
Installing collected packages: InfiniOps
  Attempting uninstall: InfiniOps
    Found existing installation: InfiniOps 0.1.0
    Uninstalling InfiniOps-0.1.0:
      Successfully uninstalled InfiniOps-0.1.0
Successfully installed InfiniOps-0.1.0
============================= test session starts ==============================
platform linux -- Python 3.10.16, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/huangjiacheng/InfiniOps
configfile: pyproject.toml
testpaths: tests
plugins: anyio-4.12.1, xdist-3.8.0, cov-7.0.0, typeguard-4.4.4
collected 3372 items

tests/test_add.py ...................................................... [  1%]
........................................................................ [  3%]
........................................................................ [  5%]
..................                                                       [  6%]
tests/test_causal_softmax.py ....................................        [  7%]
tests/test_gemm.py ..................................................... [  9%]
........................................................................ [ 11%]
........................................................................ [ 13%]
........................................................................ [ 15%]
........................................................................ [ 17%]
........................................................................ [ 19%]
........................................................................ [ 21%]
........................................................................ [ 23%]
........................................................................ [ 26%]
........................................................................ [ 28%]
........................................................................ [ 30%]
........................................................................ [ 32%]
........................................................................ [ 34%]
........................................................................ [ 36%]
........................................................................ [ 38%]
........................................................................ [ 41%]
........................................................................ [ 43%]
........................................................................ [ 45%]
........................................................................ [ 47%]
........................................................................ [ 49%]
........................................................................ [ 51%]
........................................................................ [ 53%]
........................................................................ [ 56%]
........................................................................ [ 58%]
........................................................................ [ 60%]
........................................................................ [ 62%]
........................................................................ [ 64%]
........................................................................ [ 66%]
........................................................................ [ 68%]
........................................................................ [ 70%]
........................................................................ [ 73%]
........................................................................ [ 75%]
........................................................................ [ 77%]
........................................................................ [ 79%]
........................................................................ [ 81%]
........................................................................ [ 83%]
........................................................................ [ 85%]
........................................................................ [ 88%]
........................................................................ [ 90%]
........................................................................ [ 92%]
........................................................................ [ 94%]
...................................................................      [ 96%]
tests/test_rms_norm.py ................................................. [ 97%]
.......................                                                  [ 98%]
tests/test_swiglu.py ................................................    [100%]

======================= 3372 passed in 263.41s (0:04:23) =======================

@voltjia
voltjia requested a review from Ziminli April 1, 2026 06:14
Comment thread src/cuda/swiglu/kernel.cuh
Comment thread src/cuda/gemm/blas.h
@voltjia

voltjia commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

output.log:

<== PASS  iluvatar_gpu   (96s)
<== PASS  nvidia_gpu     (174s)
<== PASS  metax_gpu      (214s)
<== PASS  moore_gpu      (222s)
<== PASS  cambricon_gpu  (281s)

@voltjia
voltjia merged commit 2816b58 into feat/dev-infra Apr 1, 2026
@voltjia
voltjia deleted the refactor/device-aware-data-types branch April 1, 2026 08:32
@voltjia voltjia mentioned this pull request Jul 28, 2026
10 of 19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants