[WIP] feat: add InfiniOps as optional kernel provider#167
Open
chen2021673 wants to merge 2 commits into
Open
Conversation
Add USE_INFINIOPS CMake option wiring the third_party/InfiniOps subproject as an optional kernel backend (requires USE_CUDA). Provide the InfiniOps adapter, CUDA handle factory, and Add/Gemm kernel implementations registered via REGISTER_KERNEL. Split the CUDA Add/Gemm registrations into dedicated registry sources so they can be excluded when InfiniOps supplies those kernels instead. Enable USE_INFINIOPS in the test build config.
347095a to
8a74bd6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
引入 InfiniOps 作为可选 kernel provider,通过
USE_INFINIOPS=ON启用。当前接入不修改
Dispatcher语义,也不新增 InfiniOps 专用 dispatch 分支。框架侧按device + op调用 kernel;启用 InfiniOps 时,由 CMake 选择 InfiniOps provider 注册对应 CUDA kernel,未启用时继续注册原生 CUDA kernel。linear、matmul、outer已在前置 GEMM PR #166 中改为通过Dispatcher::Instance().Call<void>({device.type(), "Gemm"}, ...)调用 GEMM,因此 InfiniOps 只需要提供Gemm即可透明覆盖这些上层路径。Changes
USE_INFINIOPSCMake 选项;启用时接入third_party/InfiniOps,并链接InfiniOps::infiniops。infini_train/src/core/kernel_provider/infiniops/,提供 InfiniOps kernel wrapper。adapter.{h,cc},提供ToOpsDataType/ToOpsDevice/ToOpsTensor等类型与张量桥接。gemm.cc和elementwise.cc,当前接入Gemm与AddForward。REGISTER_KERNEL(device, kernel_name, kernel_func),直接注册为 CUDA kernel。gemm_registry.cuelementwise_add_registry.cuUSE_INFINIOPS=ON时不编译上述 native registry TU,由 InfiniOps provider 注册Gemm/AddForward;USE_INFINIOPS=OFF时维持原生 CUDA 注册。scripts/test_config.json默认构建命令增加-DUSE_INFINIOPS=ON。测试
待补充截图
closed #161
issue InfiniTensor/InfiniOps#627