Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Autoscan] add 0D-tensor test for CPU #10214

Merged
merged 17 commits into from
Apr 23, 2023

Conversation

mjp9527
Copy link
Collaborator

@mjp9527 mjp9527 commented Apr 17, 2023

PR devices

Arm/Host

PR types

New features

PR changes

OP

Description

(1)增加android/linux编译选项 block_0dim_pass=ON/OFF,用来判断是否开启support_0_dim_pass;
(2)为AutoScan单测增加0D测试case,同时增加 add_ignore_pass_case,目前只测Host/Arm CPU;
(3)修复部分算子不支持0D的问题;

@paddle-bot
Copy link

paddle-bot bot commented Apr 17, 2023

Thanks for your contribution!

CMakeLists.txt Outdated
@@ -74,6 +74,7 @@ lite_option(LITE_ON_TINY_PUBLISH "Publish tiny predictor lib."
lite_option(LITE_ON_MODEL_OPTIMIZE_TOOL "Build the model optimize tool" OFF)
lite_option(LITE_WITH_BENCHMARK_TEST "Build benchmark test cases" OFF)
lite_option(LITE_THREAD_POOL "Enable thread pool in lite" OFF)
lite_option(LITE_BLOCK_0DIM_PASS "Block support_0_dim_tensor_pass" OFF)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LITE_SKIP_SUPPORT_0_DIM_TENSOR_PASS

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -263,3 +263,7 @@ if (EMSCRIPTEN)
add_compile_options("-pthread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
endif()

if(LITE_BLOCK_0DIM_PASS)
add_definitions("-DLITE_BLOCK_0DIM_PASS")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -60,6 +60,15 @@ bool naive_not<bool>(bool a) {
return !a;
}

#define PROCESS_0D \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个有点 trick,能直接改 GenBatchElementWiseArg 吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这位置我最开始也是想改 GenBatchElementWiseArg。。。但是改完发现有内存错误,所以想先绕过这块,等之后再修复可以吗

if (param_.ShapeTensor == nullptr && param_.ShapeTensorList.empty()) {
CHECK(param_.shape.size() > 0)
<< "Attribute(shape) of GaussRandomOp must be set and shape.size() > 0";
if (param_.ShapeTensor == nullptr && param_.ShapeTensorList.empty() &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是可以直接删除?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -102,6 +103,9 @@
args = parser.parse_args()

logging.basicConfig(level=logging.INFO, format="%(message)s")
logg = logging.getLogger(__name__)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用logger 或 log 会不会更好?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

from functools import partial


def check_broadcast(x_shape, y_shape, axis):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是可以抽出来作为公共模块?我理解大部分eltwise 类算子都需要使用的。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个确实可以复用,但应该放哪个文件里,就一个函数新建个文件是不是有点浪费

Copy link
Collaborator

@hong19860320 hong19860320 Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if len(axes) == 0 or len(in_shape) <= 1:
return True

self.add_ignore_check_case(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

先屏蔽OpenVivo

echo "Don't have paddlepaddle, need install."
fi
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新paddle可以成功修复x86/Host AutoScan
image

Copy link
Collaborator

@hong19860320 hong19860320 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
如讨论,GenBatchElementWiseArg 和 check_broadcast 在后面一个 PR 修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants