diff --git a/src/runtime/opencl/opencl_module.cc b/src/runtime/opencl/opencl_module.cc index c5afaeba7d32..c8ccbfa09f18 100644 --- a/src/runtime/opencl/opencl_module.cc +++ b/src/runtime/opencl/opencl_module.cc @@ -30,8 +30,8 @@ #include #include "../../support/bytes_io.h" -#include "../source_utils.h" #include "opencl_common.h" +#include "source_utils.h" namespace tvm { namespace runtime { diff --git a/src/runtime/opencl/opencl_module_spirv.cc b/src/runtime/opencl/opencl_module_spirv.cc index 12b6df9aa1a5..67e7b1c1d5d7 100644 --- a/src/runtime/opencl/opencl_module_spirv.cc +++ b/src/runtime/opencl/opencl_module_spirv.cc @@ -25,10 +25,10 @@ #include #include "../../support/bytes_io.h" -#include "../source_utils.h" #include "../spirv/spirv_shader.h" #include "opencl_common.h" #include "opencl_module.h" +#include "source_utils.h" namespace tvm { namespace runtime { diff --git a/src/runtime/source_utils.cc b/src/runtime/opencl/source_utils.h similarity index 69% rename from src/runtime/source_utils.cc rename to src/runtime/opencl/source_utils.h index e1cf94e52e18..9f17d670128d 100644 --- a/src/runtime/source_utils.cc +++ b/src/runtime/opencl/source_utils.h @@ -18,15 +18,26 @@ */ /*! - * \file source_utils.cc + * \file source_utils.h + * \brief Minimum source manipulation utils for the OpenCL runtime. */ -#include "source_utils.h" + +#ifndef TVM_RUNTIME_OPENCL_SOURCE_UTILS_H_ +#define TVM_RUNTIME_OPENCL_SOURCE_UTILS_H_ + +#include +#include namespace tvm { namespace runtime { - -std::unordered_map SplitKernels(std::string source, - std::string delimiter) { +/*! + * \brief Split the source file on separate kernels by specified delimiter. + * \param source The source code of the kernels. + * \param delimiter The delimiter which is using for splitting kernels. + * \return Mapping from primitive name to kernel source + */ +inline std::unordered_map SplitKernels( + const std::string& source, const std::string& delimiter = "// Function: ") { std::unordered_map split_kernels; if (source.size()) { size_t begin = source.find(delimiter); @@ -47,3 +58,5 @@ std::unordered_map SplitKernels(std::string source, } } // namespace runtime } // namespace tvm + +#endif // TVM_RUNTIME_OPENCL_SOURCE_UTILS_H_ diff --git a/src/runtime/source_utils.h b/src/runtime/source_utils.h deleted file mode 100644 index 5476585b945c..000000000000 --- a/src/runtime/source_utils.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/*! - * \file source_utils.h - * \brief Minimum source manipulation utils for runtime. - */ - -#ifndef TVM_RUNTIME_SOURCE_UTILS_H_ -#define TVM_RUNTIME_SOURCE_UTILS_H_ - -#include -#include - -namespace tvm { -namespace runtime { -/*! - * \brief Split the source file on separate kernels by specified delimiter. - * \param source The source code of the kernels. - * \param delimiter The delimiter which is using for splitting kernels. - * \return Mapping from primitive name to kernel source - */ -std::unordered_map SplitKernels(std::string source, - std::string delimiter = "// Function: "); -} // namespace runtime -} // namespace tvm - -#endif // TVM_RUNTIME_SOURCE_UTILS_H_