Skip to content

Commit

Permalink
Refactoring. Just call the new executor Executor2. Remove graph - wil…
Browse files Browse the repository at this point in the history
…l use the new graph::OpGraph.

Signed-off-by: Michał Zientkiewicz <[email protected]>
  • Loading branch information
mzient committed Jun 17, 2024
1 parent 12272e8 commit 0dc690b
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 247 deletions.
2 changes: 0 additions & 2 deletions dali/pipeline/executor/executor2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

add_subdirectory(dynamic)

# Get all the source files and dump test files
collect_headers(DALI_INST_HDRS PARENT_SCOPE)
collect_sources(DALI_SRCS PARENT_SCOPE)
Expand Down
18 changes: 0 additions & 18 deletions dali/pipeline/executor/executor2/dynamic/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "dyn_exec.h"
#include "dali/pipeline/executor/executor2/exec2.h"

namespace dali {
namespace exec2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,35 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef DALI_PIPELINE_EXECUTOR2_DYNAMIC_DYN_EXEC_H_
#define DALI_PIPELINE_EXECUTOR2_DYNAMIC_DYN_EXEC_H_
#ifndef DALI_PIPELINE_EXECUTOR_EXECUTOR2_EXEC2_H_
#define DALI_PIPELINE_EXECUTOR_EXECUTOR2_EXEC2_H_

#include "../graph.h"
#include "../executor2.h"
#include "exec_graph.h"
#include <memory>
#include "dali/pipeline/graph/op_graph2.h"
#include "dali/pipeline/executor/executor2/exec_graph.h"
#include "dali/pipeline/workspace/workspace.h"

namespace dali {
namespace exec2 {

class DynExec : public Executor {
class Executor2 {
public:
void Initialize(std::shared_ptr<Graph> graph) override
{
void Initialize(std::shared_ptr<graph::OpGraph> graph) {
graph_ = graph;
}

void Run() override
{
void Run() {
}

void GetOutputs(Workspace &ws) override
{
void GetOutputs(Workspace &ws) {
}

ExecGraph exec_graph_;
std::shared_ptr<Graph> graph_;
std::shared_ptr<graph::OpGraph> graph_;
};

} // namespace exec2
} // namespace dali


#endif // DALI_PIPELINE_EXECUTOR2_DYNAMIC_DYN_EXEC_H_

#endif // DALI_PIPELINE_EXECUTOR_EXECUTOR2_EXEC2_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <gtest/gtest.h>
#include "dali/pipeline/operator/arg_helper.h"
#include "exec_graph.h"
#include "dali/pipeline/executor/executor2/exec_graph.h"
#include "dali/test/timing.h"

namespace dali {
Expand All @@ -30,7 +30,7 @@ inline OpSchema &CreateTestSchema(const std::string &name) {

class DummyOp : public Operator<CPUBackend> {
public:
DummyOp(const OpSpec &spec) : Operator<CPUBackend>(spec) {
explicit DummyOp(const OpSpec &spec) : Operator<CPUBackend>(spec) {
instance_name_ = spec_.GetArgument<string>("instance_name");
}

Expand Down Expand Up @@ -67,7 +67,6 @@ class DummyOp : public Operator<CPUBackend> {
};

TEST(Exec2Test, SimpleGraph) {
auto start = dali::test::perf_timer::now();
int batch_size = 32;
DummyOp::CreateSchema();
OpSpec spec0("DummyOp");
Expand Down Expand Up @@ -245,4 +244,4 @@ TEST(Exec2Test, Exception) {

} // namespace test
} // namespace exec2
} // namespace dali
} // namespace dali
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.

#include <cassert>
#include <utility>
#include "dali/core/cuda_event_pool.h"
#include "exec_graph.h"
#include "op_task.h"
#include "dali/pipeline/executor/executor2/exec_graph.h"
#include "dali/pipeline/executor/executor2/op_task.h"

namespace dali {
namespace exec2 {
Expand All @@ -35,7 +36,7 @@ void ClearWorkspacePayload(Workspace &ws) {
for (int i = 0; i < ws.NumArgumentInput(); i++)
ws.SetArgumentInput(i, nullptr);

for (int o = 0; o < ws.NumOutput(); o++){
for (int o = 0; o < ws.NumOutput(); o++) {
if (ws.OutputIsType<CPUBackend>(o))
ws.SetOutput<CPUBackend>(o, nullptr);
else if (ws.OutputIsType<GPUBackend>(o))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef DALI_PIPELINE_EXECUTOR2_DYNAMIC_EXEC_GRAPH_H_
#define DALI_PIPELINE_EXECUTOR2_DYNAMIC_EXEC_GRAPH_H_
#ifndef DALI_PIPELINE_EXECUTOR_EXECUTOR2_EXEC_GRAPH_H_
#define DALI_PIPELINE_EXECUTOR_EXECUTOR2_EXEC_GRAPH_H_

#include <cassert>
#include <functional>
#include <list>
#include <memory>
#include <variant>
#include <utility>
#include <vector>

#include "../graph.h"
#include "workspace_cache.h"
#include "dali/pipeline/graph/op_graph2.h"
#include "dali/pipeline/executor/executor2/workspace_cache.h"
#include "dali/core/cuda_event_pool.h"
#include "dali/pipeline/operator/operator.h"
#include "dali/pipeline/workspace/workspace.h"
Expand Down Expand Up @@ -93,7 +94,7 @@ class DLL_PUBLIC ExecNode {
return ws;
}

private:
private:
CachedWorkspace CreateOutputWorkspace();
CachedWorkspace CreateOpWorkspace();

Expand Down Expand Up @@ -157,4 +158,5 @@ class Iteration {
} // namespace exec2
} // namespace dali

#endif // DALI_PIPELINE_EXECUTOR2_DYNAMIC_EXEC_GRAPH_H_
#endif // DALI_PIPELINE_EXECUTOR_EXECUTOR2_EXEC_GRAPH_H_

39 changes: 0 additions & 39 deletions dali/pipeline/executor/executor2/executor2.h

This file was deleted.

30 changes: 0 additions & 30 deletions dali/pipeline/executor/executor2/graph.cc

This file was deleted.

116 changes: 0 additions & 116 deletions dali/pipeline/executor/executor2/graph.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <unordered_set>
#include <utility>
#include <vector>
#include "op_task.h"
#include "exec_graph.h"
#include "dali/pipeline/executor/executor2/op_task.h"
#include "dali/pipeline/executor/executor2/exec_graph.h"
#include "dali/core/nvtx.h"
#include "dali/pipeline/executor/source_info_propagation.h"

Expand All @@ -29,8 +29,9 @@ tasking::SharedTask OpTaskFunc::CreateTask(ExecNode *node, CachedWorkspace ws) {
return tasking::Task::Create(
OpTaskFunc(node, std::move(ws)).GetOutputTaskRunnable());
} else {
int nout = ws->NumOutput();
return tasking::Task::Create(
ws->NumOutput(),
nout,
OpTaskFunc(node, std::move(ws)).GetOpTaskRunnable());
}
}
Expand Down
Loading

0 comments on commit 0dc690b

Please sign in to comment.