forked from mindspore-Ecosystem/mindspore
fix gpu ut
This commit is contained in:
parent
c74e66e759
commit
9c47a2092d
|
@ -7,8 +7,8 @@ echo ${basepath}
|
|||
while getopts "r:d:" opt; do
|
||||
case ${opt} in
|
||||
r)
|
||||
release_path=${OPTARG}
|
||||
echo "release_path is ${OPTARG}"
|
||||
lite_test_path=${OPTARG}
|
||||
echo "lite_test_path is ${OPTARG}"
|
||||
;;
|
||||
d)
|
||||
device_id=${OPTARG}
|
||||
|
@ -24,7 +24,7 @@ ut_test_path=${basepath}/ut_test
|
|||
rm -rf ${ut_test_path}
|
||||
mkdir -p ${ut_test_path}
|
||||
|
||||
run_ut_result_file=${basepath}/run_benchmark_result.txt
|
||||
run_ut_result_file=${basepath}/run_gpu_ut_result.txt
|
||||
echo ' ' > ${run_ut_result_file}
|
||||
run_gpu_ut_log_file=${basepath}/run_gpu_ut_log.txt
|
||||
echo 'run gpu ut logs: ' > ${run_gpu_ut_log_file}
|
||||
|
@ -32,9 +32,9 @@ echo 'run gpu ut logs: ' > ${run_gpu_ut_log_file}
|
|||
ut_gpu_config=${basepath}/ut_gpu.cfg
|
||||
|
||||
function Run_gpu_ut() {
|
||||
cd ${release_path} || exit 1
|
||||
cd ${lite_test_path} || exit 1
|
||||
|
||||
cp -a ${release_path}/lite-test ${ut_test_path}/lite-test || exit 1
|
||||
cp -a ${lite_test_path}/lite-test ${ut_test_path}/lite-test || exit 1
|
||||
cp -r ${basepath}/ut/src/runtime/kernel/opencl/test_data ${ut_test_path} || exit 1
|
||||
|
||||
# adb push all needed files to the phone
|
||||
|
|
|
@ -103,6 +103,9 @@ void TestMain(const std::vector<ArgsTupleWithDtype> &input_infos, const std::vec
|
|||
// simulating benchmark: session_->CompileGraph() -> scheduler.Schedule() -> BuildKernels()
|
||||
MS_LOG(DEBUG) << "create OpenCLKernel";
|
||||
kernel::KernelKey key{kernel::kGPU, kernel_inputs.front()->data_type(), primitive_type};
|
||||
if (key.data_type == kNumberTypeFloat32 && fp16_enable) {
|
||||
key.data_type = kNumberTypeFloat16;
|
||||
}
|
||||
auto creator = KernelRegistry::GetInstance()->GetCreator(key);
|
||||
if (creator == nullptr) {
|
||||
std::cerr << "can't get registry function for: " << schema::EnumNamePrimitiveType(primitive_type)
|
||||
|
@ -117,7 +120,7 @@ void TestMain(const std::vector<ArgsTupleWithDtype> &input_infos, const std::vec
|
|||
FAIL();
|
||||
}
|
||||
kernel->set_name(schema::EnumNamesPrimitiveType()[primitive_type]);
|
||||
|
||||
kernel->set_desc(key);
|
||||
// simulating benchmark: session_->CompileGraph() -> scheduler.Schedule() -> ConstructSubGraphs()
|
||||
MS_LOG(DEBUG) << "create SubGraph";
|
||||
std::vector<LiteKernel *> kernels{kernel};
|
||||
|
@ -246,6 +249,9 @@ void TestMain(const std::vector<ArgsTupleWithDtype> &input_infos, std::tuple<std
|
|||
// simulating benchmark: session_->CompileGraph() -> scheduler.Schedule() -> BuildKernels()
|
||||
MS_LOG(DEBUG) << "create OpenCLKernel";
|
||||
kernel::KernelKey key{kernel::kGPU, kernel_inputs.front()->data_type(), primitive_type};
|
||||
if (key.data_type == kNumberTypeFloat32 && fp16_enable) {
|
||||
key.data_type = kNumberTypeFloat16;
|
||||
}
|
||||
auto creator = KernelRegistry::GetInstance()->GetCreator(key);
|
||||
if (creator == nullptr) {
|
||||
std::cerr << "can't get registry function for: " << schema::EnumNamePrimitiveType(primitive_type)
|
||||
|
@ -260,7 +266,7 @@ void TestMain(const std::vector<ArgsTupleWithDtype> &input_infos, std::tuple<std
|
|||
FAIL();
|
||||
}
|
||||
kernel->set_name(schema::EnumNamesPrimitiveType()[primitive_type]);
|
||||
|
||||
kernel->set_desc(key);
|
||||
// simulating benchmark: session_->CompileGraph() -> scheduler.Schedule() -> ConstructSubGraphs()
|
||||
MS_LOG(DEBUG) << "create SubGraph";
|
||||
std::vector<LiteKernel *> kernels{kernel};
|
||||
|
|
|
@ -89,7 +89,7 @@ TEST_F(TestOpenCL_MatMul, 3D) {
|
|||
param, fp16_enable);
|
||||
}
|
||||
}
|
||||
|
||||
// Check and optimize
|
||||
TEST_F(TestOpenCL_MatMul, ActWeightTransposeB3D) {
|
||||
int a = 2;
|
||||
int m = 2;
|
||||
|
@ -109,7 +109,7 @@ TEST_F(TestOpenCL_MatMul, ActWeightTransposeB3D) {
|
|||
fp16_enable);
|
||||
}
|
||||
}
|
||||
|
||||
// Check and optimize
|
||||
TEST_F(TestOpenCL_MatMul, ActWeight3D) {
|
||||
int a = 2;
|
||||
int m = 2;
|
||||
|
|
|
@ -24,7 +24,9 @@ TestOpenCL_Pad.2D
|
|||
TestOpenCL_Pad.3D
|
||||
TestOpenCL_Pad.4D
|
||||
TestOpenCL_OneHot.*
|
||||
TestOpenCL_MatMul.*
|
||||
TestOpenCL_MatMul.2D
|
||||
TestOpenCL_MatMul.3D
|
||||
TestOpenCL_MatMul.4D
|
||||
TestOpenCL_LayerNorm.*
|
||||
TestOpenCL_Gather.*
|
||||
TestOpenCL_FullConnection.*
|
||||
|
|
Loading…
Reference in New Issue