Unverified Commit a05b4823 authored by Chris Sullivan's avatar Chris Sullivan Committed by GitHub

Default the GPU backend to DEX. (#4327)

parent 8063c2ec
...@@ -620,7 +620,7 @@ if (NGRAPH_MLIR_ENABLE) ...@@ -620,7 +620,7 @@ if (NGRAPH_MLIR_ENABLE)
include(cmake/external_mlir.cmake) include(cmake/external_mlir.cmake)
endif() endif()
if ((NGRAPH_GPU_ENABLE OR NGRAPH_CPU_ENABLE) AND NOT NGRAPH_DEX_ONLY) if (NGRAPH_CPU_ENABLE AND NOT NGRAPH_DEX_ONLY)
set(NGRAPH_CODEGEN_ENABLE TRUE) set(NGRAPH_CODEGEN_ENABLE TRUE)
else() else()
set(NGRAPH_CODEGEN_ENABLE FALSE) set(NGRAPH_CODEGEN_ENABLE FALSE)
......
...@@ -51,10 +51,6 @@ set(SRC ...@@ -51,10 +51,6 @@ set(SRC
op/rnn.cpp op/rnn.cpp
) )
if (NOT NGRAPH_DEX_ONLY)
list(APPEND SRC gpu_external_function.cpp)
endif()
set(CUDA_INC set(CUDA_INC
${PROJECT_SOURCE_DIR}/src/ ${PROJECT_SOURCE_DIR}/src/
) )
...@@ -152,11 +148,6 @@ if (NGRAPH_GPU_ENABLE) ...@@ -152,11 +148,6 @@ if (NGRAPH_GPU_ENABLE)
SOVERSION ${NGRAPH_API_VERSION}) SOVERSION ${NGRAPH_API_VERSION})
endif() endif()
target_link_libraries(gpu_backend PUBLIC ngraph) target_link_libraries(gpu_backend PUBLIC ngraph)
if (NGRAPH_DEX_ONLY)
target_compile_definitions(gpu_backend PRIVATE "NGRAPH_DEX_ONLY")
else()
target_link_libraries(gpu_backend PUBLIC codegen)
endif()
find_library(CUDA_nvrtc_LIBRARY nvrtc find_library(CUDA_nvrtc_LIBRARY nvrtc
PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64) PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)
find_library(CUDA_cuda_LIBRARY cuda find_library(CUDA_cuda_LIBRARY cuda
......
...@@ -120,31 +120,7 @@ std::shared_ptr<runtime::gpu::GPUCompiledFunction> runtime::gpu::GPUCompiledFunc ...@@ -120,31 +120,7 @@ std::shared_ptr<runtime::gpu::GPUCompiledFunction> runtime::gpu::GPUCompiledFunc
const std::shared_ptr<ngraph::Function>& function, const std::shared_ptr<ngraph::Function>& function,
const std::shared_ptr<GPU_Backend::BackendContext>& shared_context) const std::shared_ptr<GPU_Backend::BackendContext>& shared_context)
{ {
#if defined(NGRAPH_DEX_ONLY)
return std::make_shared<runtime::gpu::GPUInternalFunction>(function, shared_context); return std::make_shared<runtime::gpu::GPUInternalFunction>(function, shared_context);
#else
// For now codegen is default unless explicitly disabled
bool use_codegen = true;
if (auto env = std::getenv("NGRAPH_CODEGEN"))
{
std::string env_codegen(env);
for (auto& opt : get_case_variants({"0", "false"}))
{
if (env_codegen == opt)
{
use_codegen = false;
}
}
}
if (use_codegen)
{
return std::make_shared<runtime::gpu::GPUExternalFunction>(function, shared_context);
}
else
{
return std::make_shared<runtime::gpu::GPUInternalFunction>(function, shared_context);
}
#endif
} }
void runtime::gpu::GPUCompiledFunction::compile() void runtime::gpu::GPUCompiledFunction::compile()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment