set(jit_file ${PADDLE_BINARY_DIR}/paddle/fluid/operators/jit/kernels.h.tmp) set(jit_file_final ${PADDLE_BINARY_DIR}/paddle/fluid/operators/jit/kernels.h) file( WRITE ${jit_file} "// Generated by the paddle/fluid/operators/jit/CMakeLists.txt. DO NOT EDIT!\n\n" ) file(APPEND ${jit_file} "\#pragma once\n") file(APPEND ${jit_file} "\#include \"paddle/fluid/operators/jit/helper.h\"\n") file(APPEND ${jit_file} "\#include \"paddle/fluid/operators/jit/registry.h\"\n\n") set(JIT_KERNEL_DEPS device_context cblas gflags enforce place xxhash) file( GLOB jit_kernel_cc_srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cc") list(REMOVE_ITEM jit_kernel_cc_srcs test.cc benchmark.cc) cc_library( jit_kernel_base SRCS ${jit_kernel_cc_srcs} DEPS ${JIT_KERNEL_DEPS}) copy_if_different(${jit_file} ${jit_file_final}) # refer must go first add_subdirectory(refer) add_subdirectory(more) if(WITH_XBYAK) add_subdirectory(gen) endif() cc_library( jit_kernel_helper INTERFACE SRCS ${jit_kernel_cc_srcs} DEPS jit_kernel_base ${JIT_KERNEL_DEPS}) cc_test( jit_kernel_test SRCS test.cc DEPS jit_kernel_helper) if(NOT WIN32) set(cuda_less12_and_gcc_greater12 false) if(DEFINED CMAKE_CUDA_COMPILER_VERSION) if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0 AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0) set(cuda_less12_and_gcc_greater12 true) endif() endif() if(NOT cuda_less12_and_gcc_greater12) cc_binary( jit_kernel_benchmark SRCS benchmark.cc DEPS jit_kernel_helper device_tracer tensor) endif() endif() if(WITH_TESTING AND TEST jit_kernel_test) set_tests_properties(jit_kernel_test PROPERTIES TIMEOUT 120) endif()