"googlemock/vscode:/vscode.git/clone" did not exist on "26afdba792e52cac00ce11644c3c0b1789c40bf7"
Unverified Commit 70862bcc authored by PanZezhong1725's avatar PanZezhong1725 Committed by GitHub
Browse files

Merge pull request #989 from InfiniTensor/issue/811-fix

issue/811 use relax graph capture mode
parents 1fa56298 807e5e43
...@@ -84,7 +84,7 @@ void Graph::instantiate() { ...@@ -84,7 +84,7 @@ void Graph::instantiate() {
if (infinirtStreamBeginCapture( if (infinirtStreamBeginCapture(
context::getStream(), context::getStream(),
INFINIRT_STREAM_CAPTURE_MODE_GLOBAL) INFINIRT_STREAM_CAPTURE_MODE_RELAXED)
!= INFINI_STATUS_SUCCESS) { != INFINI_STATUS_SUCCESS) {
return; return;
} }
...@@ -144,7 +144,9 @@ std::shared_ptr<Graph> GraphManager::stop_recording() { ...@@ -144,7 +144,9 @@ std::shared_ptr<Graph> GraphManager::stop_recording() {
return nullptr; return nullptr;
} }
recording_ = false; recording_ = false;
#ifdef USE_INFINIRT_GRAPH
graph_->instantiate(); graph_->instantiate();
#endif
return std::exchange(graph_, nullptr); return std::exchange(graph_, nullptr);
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include "infinicore/dtype.hpp" #include "infinicore/dtype.hpp"
#include "infinicore/tensor.hpp" #include "infinicore/tensor.hpp"
#include "../utils.hpp"
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <stdexcept> #include <stdexcept>
...@@ -62,11 +64,11 @@ Tensor TensorImpl::narrow(const std::vector<TensorSliceParams> &slices) const { ...@@ -62,11 +64,11 @@ Tensor TensorImpl::narrow(const std::vector<TensorSliceParams> &slices) const {
Tensor TensorImpl::permute(const Shape &order) const { Tensor TensorImpl::permute(const Shape &order) const {
// Validate input // Validate input
assert(meta_.shape.size() == order.size()); INFINICORE_ASSERT(meta_.shape.size() == order.size());
// Check that order contains all indices from 0 to n-1 exactly once // Check that order contains all indices from 0 to n-1 exactly once
for (size_t i = 0; i < order.size(); i++) { for (size_t i = 0; i < order.size(); i++) {
assert(std::find(order.begin(), order.end(), i) != order.end()); INFINICORE_ASSERT(std::find(order.begin(), order.end(), i) != order.end());
} }
// Permute shape and strides // Permute shape and strides
......
...@@ -205,6 +205,18 @@ if has_config("ninetoothed") then ...@@ -205,6 +205,18 @@ if has_config("ninetoothed") then
add_defines("ENABLE_NINETOOTHED") add_defines("ENABLE_NINETOOTHED")
end end
-- cuda graph
option("graph")
set_default(false)
set_showmenu(true)
set_description("Whether to use device graph instantiating feature, such as cuda graph for nvidia")
option_end()
if has_config("graph") then
add_defines("USE_INFINIRT_GRAPH")
end
-- InfiniCCL -- InfiniCCL
option("ccl") option("ccl")
set_default(false) set_default(false)
......
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