Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Browse files Browse the repository at this point in the history
… debug_latex_ocr_branch
  • Loading branch information
ooooo-create committed Jan 9, 2025
2 parents 46fe168 + 266e3cd commit e9d4ea2
Show file tree
Hide file tree
Showing 62 changed files with 1,397 additions and 833 deletions.
2 changes: 1 addition & 1 deletion cmake/external/openvino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/openvino/convert.patch
native_convert)

set(OPENVINO_PATCH_COMMAND
git checkout -- . && git fetch --depth=1 origin <OPENVINO_COMMIT> && git
git checkout -- . && git fetch --depth=1 origin ${OPENVINO_COMMIT} && git
checkout ${OPENVINO_COMMIT} && patch -Np1 -d ${SOURCE_DIR} <
${native_convert} || true)

Expand Down
1 change: 0 additions & 1 deletion paddle/cinn/backends/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ void Compiler::CompileCudaModule(const Module& module,
device_fn_name_.emplace_back(kernel_fn_name);
}
engine_->Link<CodeGenGpuHost>(host_module);

#else
CINN_NOT_IMPLEMENTED
#endif
Expand Down
14 changes: 13 additions & 1 deletion paddle/cinn/backends/llvm/execution_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ std::unique_ptr<llvm::MemoryBuffer> NaiveObjectCache::getObject(

template <typename CodeGenT>
void ExecutionEngine::Link(const ir::Module &module) {
if (module.functions().size() == 0) {
return;
}
utils::RecordEvent("ExecutionEngine Link", utils::EventType::kOrdinary);

auto ir_emitter = std::make_unique<CodeGenT>(m.get(), b.get());
VLOG(3) << "ir_emitter->Compile(module) Begin";
ir_emitter->Compile(module);
Expand Down Expand Up @@ -211,6 +213,16 @@ void ExecutionEngine::Link(const ir::Module &module) {
}
}

template <>
void ExecutionEngine::Link<CodeGenGpuHost>(const ir::Module &module) {
if (module.functions().size() == 0) {
return;
}
utils::RecordEvent("ExecutionEngine Link", utils::EventType::kOrdinary);
auto ir_emitter = std::make_unique<CodeGenGpuHost>(m.get(), b.get());
ir_emitter->Compile(module);
}

bool ExecutionEngine::AddModule(std::unique_ptr<llvm::Module> module,
std::unique_ptr<llvm::LLVMContext> context) {
utils::RecordEvent("ExecutionEngine AddModule", utils::EventType::kOrdinary);
Expand Down
6 changes: 6 additions & 0 deletions paddle/fluid/eager/accumulation/accumulation_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "paddle/fluid/eager/hooks.h"
#include "paddle/utils/test_macros.h"

COMMON_DECLARE_int32(call_stack_level);

namespace egr {

class TEST_API GradNodeAccumulation : public GradNodeBase {
Expand All @@ -30,6 +32,10 @@ class TEST_API GradNodeAccumulation : public GradNodeBase {
weak_grad_ = meta->WeakGrad();
}

if (FLAGS_call_stack_level == 3) {
this->SetForwardTrace(egr::Controller::Instance().GetPythonStack());
}

SetDefaultGradInOutMeta();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class {} : public egr::GradNodeBase {{
// Node Construction
{}
// Set for forward trace
if (FLAGS_check_nan_inf) {{
if (FLAGS_check_nan_inf || FLAGS_call_stack_level == 3) {{
grad_node->SetForwardTrace(egr::Controller::Instance().GetPythonStack());
}}
// SetAttributes if needed
Expand Down Expand Up @@ -590,6 +590,7 @@ class {} : public egr::GradNodeBase {{
#include "paddle/fluid/imperative/amp_utils.h"
COMMON_DECLARE_bool(check_nan_inf);
COMMON_DECLARE_int32(call_stack_level);
COMMON_DECLARE_string(tensor_operants_mode);
COMMON_DECLARE_bool(use_stride_kernel);
{}
Expand Down
Loading

0 comments on commit e9d4ea2

Please sign in to comment.