Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize cinn compile tools #70382

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions cmake/cinn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ if(WITH_GPU)
list(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})

message(
STATUS
"copy paddle/cinn/common/float16.h paddle/cinn/common/bfloat16.h to $ENV{runtime_include_dir}"
)
file(COPY paddle/cinn/common/float16.h paddle/cinn/common/bfloat16.h
DESTINATION $ENV{runtime_include_dir})

find_library(CUDASTUB libcuda.so HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/
REQUIRED)
find_library(CUBLAS libcublas.so HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib64
Expand Down
8 changes: 6 additions & 2 deletions paddle/cinn/backends/nvrtc/header_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ const size_t JitSafeHeaderGenerator::size() const {
JitSafeHeaderGenerator::JitSafeHeaderGenerator() {
const auto& headers_map = ::jitify::detail::get_jitsafe_headers_map();
for (auto& pair : headers_map) {
include_names_.emplace_back(pair.first.data());
headers_.emplace_back(pair.second.data());
if (pair.first == "cstdint" || pair.first == "stdint.h" ||
pair.first == "climits" || pair.first == "stddef.h" ||
pair.first == "stdlib.h") {
include_names_.emplace_back(pair.first.data());
headers_.emplace_back(pair.second.data());
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions paddle/cinn/common/bfloat16.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

#include <stdint.h>

#include <cmath>
#include <cstring>

#ifdef CINN_WITH_CUDA
#include <cuda.h>

#if (defined(__CUDACC__) || defined(__CUDACC_RTC__)) && CUDA_VERSION >= 11000
#define CINN_CUDA_BF16
#include <cuda_bf16.h>
#else
#include <cmath>
#include <cstring>

#endif // __CUDACC__
#endif // CINN_WITH_CUDA
Expand Down
10 changes: 3 additions & 7 deletions paddle/cinn/common/float16.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
#include <immintrin.h>
#endif

#include <stdint.h>

#include <cmath>
#include <cstdint>

#ifdef CINN_WITH_CUDA
#include <cuda.h>

#if (defined(__CUDACC__) || defined(__CUDACC_RTC__)) && CUDA_VERSION >= 7050
#define CINN_CUDA_FP16
#include <cuda_fp16.h>
#else
#include <cmath>

#define CUDA_ARCH_FP16_SUPPORTED(CUDA_ARCH) (CUDA_ARCH >= 600)
#endif // __CUDACC__
Expand Down Expand Up @@ -615,10 +615,6 @@ __host__ __device__ inline float16(abs)(const float16& a) {
#endif
}

__host__ __device__ inline float16(log)(const float16& a) {
return float16(std::log(static_cast<float>(a)));
}

#ifdef __cplusplus
} // namespace common
} // namespace cinn
Expand Down
Loading