From dfdf52e7596562e2a26be07bf4c5df493049acc1 Mon Sep 17 00:00:00 2001 From: cao lei Date: Fri, 3 May 2024 12:18:59 -0700 Subject: [PATCH] refactor cuda ops, remove contrib folder (#707) Co-authored-by: Lei Cao --- CMakeLists.txt | 6 ++---- operators/{contrib/contrib.cc => cuda/cuda_ops.cc} | 0 operators/{contrib => }/cuda/cuda_type.h | 0 operators/{contrib => }/cuda/device_prop.cuh | 0 operators/{contrib => }/cuda/fast_gelu.h | 0 operators/{contrib => }/cuda/fast_gelu_impl.cu | 0 operators/{contrib => }/cuda/fast_gelu_impl.cuh | 0 operators/{contrib => }/cuda/utils.cuh | 0 test/static_test/test_cuda_eager.cc | 2 +- 9 files changed, 3 insertions(+), 5 deletions(-) rename operators/{contrib/contrib.cc => cuda/cuda_ops.cc} (100%) rename operators/{contrib => }/cuda/cuda_type.h (100%) rename operators/{contrib => }/cuda/device_prop.cuh (100%) rename operators/{contrib => }/cuda/fast_gelu.h (100%) rename operators/{contrib => }/cuda/fast_gelu_impl.cu (100%) rename operators/{contrib => }/cuda/fast_gelu_impl.cuh (100%) rename operators/{contrib => }/cuda/utils.cuh (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a28abe47..49843d61f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -363,12 +363,10 @@ if(OCOS_ENABLE_MATH) list(APPEND TARGET_SRC ${TARGET_SRC_MATH} ${TARGET_SRC_DLIB} ${TARGET_SRC_INVERSE}) endif() -file(GLOB TARGET_SRC_CONTRIB "operators/contrib/*.cc" "operators/contrib/*.h*") if (OCOS_USE_CUDA) - file(GLOB TARGET_SRC_CONTRIB_CUDA "operators/contrib/cuda/*.*") - list(APPEND TARGET_SRC_CONTRIB ${TARGET_SRC_CONTRIB_CUDA}) + file(GLOB_RECURSE TARGET_SRC_CUDA "operators/cuda/*.*") + list(APPEND TARGET_SRC ${TARGET_SRC_CUDA}) endif() -list(APPEND TARGET_SRC ${TARGET_SRC_CONTRIB}) # enable the opencv dependency if we have ops that require it if(OCOS_ENABLE_CV2 OR OCOS_ENABLE_VISION) diff --git a/operators/contrib/contrib.cc b/operators/cuda/cuda_ops.cc similarity index 100% rename from operators/contrib/contrib.cc rename to operators/cuda/cuda_ops.cc diff --git a/operators/contrib/cuda/cuda_type.h b/operators/cuda/cuda_type.h similarity index 100% rename from operators/contrib/cuda/cuda_type.h rename to operators/cuda/cuda_type.h diff --git a/operators/contrib/cuda/device_prop.cuh b/operators/cuda/device_prop.cuh similarity index 100% rename from operators/contrib/cuda/device_prop.cuh rename to operators/cuda/device_prop.cuh diff --git a/operators/contrib/cuda/fast_gelu.h b/operators/cuda/fast_gelu.h similarity index 100% rename from operators/contrib/cuda/fast_gelu.h rename to operators/cuda/fast_gelu.h diff --git a/operators/contrib/cuda/fast_gelu_impl.cu b/operators/cuda/fast_gelu_impl.cu similarity index 100% rename from operators/contrib/cuda/fast_gelu_impl.cu rename to operators/cuda/fast_gelu_impl.cu diff --git a/operators/contrib/cuda/fast_gelu_impl.cuh b/operators/cuda/fast_gelu_impl.cuh similarity index 100% rename from operators/contrib/cuda/fast_gelu_impl.cuh rename to operators/cuda/fast_gelu_impl.cuh diff --git a/operators/contrib/cuda/utils.cuh b/operators/cuda/utils.cuh similarity index 100% rename from operators/contrib/cuda/utils.cuh rename to operators/cuda/utils.cuh diff --git a/test/static_test/test_cuda_eager.cc b/test/static_test/test_cuda_eager.cc index 65de140de..3faf1e67f 100644 --- a/test/static_test/test_cuda_eager.cc +++ b/test/static_test/test_cuda_eager.cc @@ -9,7 +9,7 @@ #ifdef USE_CUDA #include "math/cuda/negpos_def.h" -#include "contrib/cuda/fast_gelu.h" +#include "cuda/fast_gelu.h" #include #include