未验证 提交 4d88cdb8 编写于 作者: C Chen Weihang 提交者: GitHub

[CustomOp] Fix ext_tensor.cast failed bug (#34884)

* fix ext_tensor.cast failed bug

* remove useless deps

* fix windows cmake failed

* try to fix windows make failed

* fix make error on windwos
上级 dd533dd3
ext_tensor.cc
\ No newline at end of file
......@@ -17,7 +17,7 @@ function(windows_symbolic TARGET)
add_custom_command(OUTPUT ${final_path}/.${src}.cu
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${final_path}/${src}.cc" "${final_path}/.${src}.cu"
COMMENT "create hidden file of ${src}.cu")
add_custom_target(${TARGET} ALL DEPENDS .${src}.cu)
add_custom_target(${TARGET} ALL DEPENDS ${final_path}/.${src}.cu)
endforeach()
endfunction()
......@@ -413,8 +413,16 @@ include_directories(${PADDLE_SOURCE_DIR}/paddle/fluid/platform)
include_directories(${PADDLE_SOURCE_DIR}/paddle/fluid/extension/include)
include_directories(${PADDLE_SOURCE_DIR}/paddle/utils)
if(WITH_ROCM)
hip_library(custom_tensor SRCS ../extension/src/ext_tensor.cc DEPS lod_tensor memory enforce)
if (WITH_GPU)
if (WIN32)
windows_symbolic(ext_tensor_cu SRCS ext_tensor.cu PATH ../extension/src)
nv_library(custom_tensor SRCS ../extension/src/.ext_tensor.cu DEPS lod_tensor memory enforce)
add_dependencies(custom_tensor ext_tensor_cu)
else()
nv_library(custom_tensor SRCS ../extension/src/ext_tensor.cu DEPS lod_tensor memory enforce)
endif(WIN32)
elseif (WITH_ROCM)
hip_library(custom_tensor SRCS ../extension/src/ext_tensor.cu DEPS lod_tensor memory enforce)
else()
cc_library(custom_tensor SRCS ../extension/src/ext_tensor.cc DEPS lod_tensor memory enforce)
endif()
......
......@@ -144,6 +144,13 @@ void TestCast(paddle::DataType data_type) {
t1.template mutable_data<T>();
auto t2 = t1.cast(data_type);
CHECK(t2.type() == data_type);
#ifdef PADDLE_WITH_CUDA
auto tg1 = paddle::Tensor(paddle::PlaceType::kGPU);
tg1.reshape(tensor_shape);
tg1.template mutable_data<T>();
auto tg2 = tg1.cast(data_type);
CHECK(tg2.type() == data_type);
#endif
}
void GroupTestCopy() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册