Skip to content

Commit

Permalink
cmake changes for HexagonBuffer unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
adstraw committed Nov 19, 2021
1 parent ce85c0a commit 61db96e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ list(APPEND COMPILER_SRCS "src/target/datatype/myfloat/myfloat.cc")
file(GLOB RUNTIME_SRCS
src/runtime/*.cc
src/runtime/vm/*.cc
src/runtime/hexagon/hexagon/hexagon_buffer.cc
)

if(BUILD_FOR_HEXAGON)
Expand Down Expand Up @@ -600,6 +599,8 @@ endif()
if(GTEST_FOUND)
file(GLOB_RECURSE TEST_SRCS tests/cpp/*.cc)
add_executable(cpptest ${TEST_SRCS})
# include runtime files for unit testing
target_include_directories(cpptest PUBLIC "src/runtime")
target_link_libraries(cpptest PRIVATE ${TVM_TEST_LIBRARY_NAME} GTest::GTest GTest::Main pthread dl)
set_target_properties(cpptest PROPERTIES EXCLUDE_FROM_ALL 1)
set_target_properties(cpptest PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/Hexagon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ endif()
# Don't run these checks when compiling Hexagon device code,
# e.g. when compiling the TVM runtime for Hexagon.
if (NOT BUILD_FOR_HEXAGON)
# append select runtime sources for unit testing
list(APPEND RUNTIME_SRCS src/runtime/hexagon/hexagon/hexagon_buffer.cc)
if(USE_HEXAGON_LAUNCHER STREQUAL "ON")
set(USE_HEXAGON_DEVICE "${PICK_SIM}")
else()
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/hexagon/hexagon/hexagon_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* under the License.
*/

#include <tvm/runtime/hexagon/hexagon_buffer.h>
#include "hexagon_buffer.h"

#include <tvm/runtime/module.h>

#include "hexagon_common.h"
Expand Down Expand Up @@ -49,7 +50,7 @@ struct Allocation {
struct DDRAllocation : public Allocation {
DDRAllocation(size_t nbytes, size_t alignment) : Allocation(nbytes, alignment) {
#ifdef _WIN32
data_ = _aligned_malloc(size_t nbytes, size_t alignment);
data_ = _aligned_malloc(nbytes, alignment);
CHECK(data != nullptr);
#else
int ret = posix_memalign(&data_, alignment, nbytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

#ifndef TVM_RUNTIME_HEXAGON_HEXAGON_BUFFER_H_
#define TVM_RUNTIME_HEXAGON_HEXAGON_BUFFER_H_
#ifndef TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_BUFFER_H_
#define TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_BUFFER_H_

#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/device_api.h>
Expand Down Expand Up @@ -160,4 +160,4 @@ class HexagonBuffer {
} // namespace runtime
} // namespace tvm

#endif // TVM_RUNTIME_HEXAGON_HEXAGON_BUFFER_H_
#endif // TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_BUFFER_H_
3 changes: 2 additions & 1 deletion src/runtime/hexagon/hexagon/hexagon_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include "hexagon_common.h"

#include <tvm/runtime/hexagon/hexagon_buffer.h>
#include <tvm/runtime/logging.h>
#include <tvm/runtime/registry.h>

Expand All @@ -32,6 +31,8 @@
#include <utility>
#include <vector>

#include "hexagon_buffer.h"

namespace tvm {
namespace runtime {
namespace hexagon {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "hexagon_device_api_v2.h"

#include <dmlc/thread_local.h>
#include <tvm/runtime/hexagon/hexagon_buffer.h>
#include <tvm/runtime/logging.h>
#include <tvm/runtime/ndarray.h>
#include <tvm/runtime/registry.h>
Expand All @@ -33,6 +32,7 @@
#include <cstring>

#include "../../workspace_pool.h"
#include "hexagon_buffer.h"
#include "hexagon_common.h"

namespace tvm {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/hexagon/hexagon/hexagon_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "../hexagon_module.h"

#include <dmlc/memory_io.h>
#include <tvm/runtime/hexagon/hexagon_buffer.h>
#include <tvm/runtime/module.h>
#include <tvm/runtime/registry.h>

Expand All @@ -33,6 +32,7 @@
#include <vector>

#include "../../library_module.h"
#include "hexagon_buffer.h"
#include "hexagon_common.h"

namespace tvm {
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/hexagon_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

#include <gtest/gtest.h>
#include <hexagon/hexagon/hexagon_buffer.h>
#include <tvm/runtime/container/optional.h>
#include <tvm/runtime/hexagon/hexagon_buffer.h>

using namespace tvm::runtime;
using namespace tvm::runtime::hexagon;
Expand Down

0 comments on commit 61db96e

Please sign in to comment.