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() {
if (infinirtStreamBeginCapture(
context::getStream(),
INFINIRT_STREAM_CAPTURE_MODE_GLOBAL)
INFINIRT_STREAM_CAPTURE_MODE_RELAXED)
!= INFINI_STATUS_SUCCESS) {
return;
}
......@@ -144,7 +144,9 @@ std::shared_ptr<Graph> GraphManager::stop_recording() {
return nullptr;
}
recording_ = false;
#ifdef USE_INFINIRT_GRAPH
graph_->instantiate();
#endif
return std::exchange(graph_, nullptr);
}
......
......@@ -2,6 +2,8 @@
#include "infinicore/dtype.hpp"
#include "infinicore/tensor.hpp"
#include "../utils.hpp"
#include <spdlog/spdlog.h>
#include <stdexcept>
......@@ -62,11 +64,11 @@ Tensor TensorImpl::narrow(const std::vector<TensorSliceParams> &slices) const {
Tensor TensorImpl::permute(const Shape &order) const {
// 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
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
......
......@@ -205,6 +205,18 @@ if has_config("ninetoothed") then
add_defines("ENABLE_NINETOOTHED")
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
option("ccl")
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