Skip to content

Commit 2e792e6

Browse files
Chao Wangclaude
authored andcommitted
Refactor: consolidate pto_runtime_c_api.h into src/common/worker
Merge three divergent copies into one canonical header declaring all extern-C functions (public API + record_tensor_pair). Delete arch-specific copies. Add src/common/worker to cmake include path for platform builds. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 6912849 commit 2e792e6

11 files changed

Lines changed: 54 additions & 219 deletions

File tree

src/a2a3/platform/include/host/pto_runtime_c_api.h

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/a2a3/platform/onboard/host/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Copyright (c) PyPTO Contributors.
2+
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
3+
# CANN Open Software License Agreement Version 2.0 (the "License").
4+
# Please refer to the License for details. You may not use this file except in compliance with the License.
5+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
6+
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
7+
# See LICENSE in the root of the software repository for the full text of the License.
8+
# -----------------------------------------------------------------------------------------------------------
19
# Build Host runtime using host/* + common/* + custom includes and sources (for `Runtime`)
210
# CMAKE_C_COMPILER and CMAKE_CXX_COMPILER are set when calling cmake
311
# CUSTOM_INCLUDE_DIRS and CUSTOM_SOURCE_DIRS are set when calling cmake
@@ -10,6 +18,7 @@ project(host_runtime LANGUAGES C CXX)
1018
set(CMAKE_CUSTOM_INCLUDE_DIRS "")
1119
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
1220
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/task_interface")
21+
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/worker")
1322
if(DEFINED CUSTOM_INCLUDE_DIRS)
1423
foreach(INC_DIR ${CUSTOM_INCLUDE_DIRS})
1524
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${INC_DIR}")

src/a2a3/platform/onboard/host/pto_runtime_c_api.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
* src/common/worker/pto_runtime_c_api.h. Uses real Ascend device execution.
1616
*/
1717

18-
#include "host/pto_runtime_c_api.h"
18+
#include "pto_runtime_c_api.h"
19+
20+
#include "callable.h"
21+
#include "task_args.h"
1922

2023
#include <vector>
2124

src/a2a3/platform/sim/host/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ project(host_runtime_sim LANGUAGES C CXX)
2323
set(CMAKE_CUSTOM_INCLUDE_DIRS "")
2424
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
2525
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/task_interface")
26+
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/worker")
2627

2728
if(DEFINED CUSTOM_INCLUDE_DIRS)
2829
foreach(INC_DIR ${CUSTOM_INCLUDE_DIRS})

src/a2a3/platform/sim/host/pto_runtime_c_api.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
* src/common/worker/pto_runtime_c_api.h. Uses thread-based simulation.
1616
*/
1717

18-
#include "host/pto_runtime_c_api.h"
18+
#include "pto_runtime_c_api.h"
19+
20+
#include "callable.h"
21+
#include "task_args.h"
1922

2023
#include <new>
2124
#include <vector>

src/a5/platform/include/host/pto_runtime_c_api.h

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/a5/platform/onboard/host/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Copyright (c) PyPTO Contributors.
2+
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
3+
# CANN Open Software License Agreement Version 2.0 (the "License").
4+
# Please refer to the License for details. You may not use this file except in compliance with the License.
5+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
6+
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
7+
# See LICENSE in the root of the software repository for the full text of the License.
8+
# -----------------------------------------------------------------------------------------------------------
19
# Build Host runtime using host/* + common/* + custom includes and sources (for `Runtime`)
210
# CMAKE_C_COMPILER and CMAKE_CXX_COMPILER are set when calling cmake
311
# CUSTOM_INCLUDE_DIRS and CUSTOM_SOURCE_DIRS are set when calling cmake
@@ -10,6 +18,7 @@ project(host_runtime LANGUAGES C CXX)
1018
set(CMAKE_CUSTOM_INCLUDE_DIRS "")
1119
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
1220
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/task_interface")
21+
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/worker")
1322
if(DEFINED CUSTOM_INCLUDE_DIRS)
1423
foreach(INC_DIR ${CUSTOM_INCLUDE_DIRS})
1524
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${INC_DIR}")

src/a5/platform/onboard/host/pto_runtime_c_api.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
* src/common/worker/pto_runtime_c_api.h. Uses real Ascend device execution.
1616
*/
1717

18-
#include "host/pto_runtime_c_api.h"
18+
#include "pto_runtime_c_api.h"
19+
20+
#include "callable.h"
21+
#include "task_args.h"
1922

2023
#include <vector>
2124

src/a5/platform/sim/host/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ project(host_runtime_sim LANGUAGES C CXX)
2323
set(CMAKE_CUSTOM_INCLUDE_DIRS "")
2424
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
2525
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/task_interface")
26+
list(APPEND CMAKE_CUSTOM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../common/worker")
2627

2728
if(DEFINED CUSTOM_INCLUDE_DIRS)
2829
foreach(INC_DIR ${CUSTOM_INCLUDE_DIRS})

src/a5/platform/sim/host/pto_runtime_c_api.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
* src/common/worker/pto_runtime_c_api.h. Uses thread-based simulation.
1616
*/
1717

18-
#include "host/pto_runtime_c_api.h"
18+
#include "pto_runtime_c_api.h"
19+
20+
#include "callable.h"
21+
#include "task_args.h"
1922

2023
#include <new>
2124
#include <vector>

0 commit comments

Comments
 (0)