未验证 提交 8f6446d3 编写于 作者: K kangguangli 提交者: GitHub

[NewIR]test new ir op test in gpu (#55857)

* add ir output check in OpTest

* add ir grad check in op test

* fix bug in output check

* trigger CI

* test gpu ci

* trigger CI

* trigger CI

* add white list to relax precision check for some tests

* relax timeout of test_concat_op

* relax timeout of test_concat_op
上级 4c0c458a
...@@ -3972,6 +3972,7 @@ function main() { ...@@ -3972,6 +3972,7 @@ function main() {
check_coverage_build check_coverage_build
;; ;;
gpu_cicheck_coverage) gpu_cicheck_coverage)
export FLAGS_NEW_IR_OPTEST=True
parallel_test parallel_test
check_coverage check_coverage
;; ;;
......
...@@ -967,10 +967,10 @@ if(WITH_NV_JETSON) ...@@ -967,10 +967,10 @@ if(WITH_NV_JETSON)
set_tests_properties(test_layer_norm_op PROPERTIES TIMEOUT 1500) set_tests_properties(test_layer_norm_op PROPERTIES TIMEOUT 1500)
set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 1500) set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 1500)
else() else()
set_tests_properties(test_concat_op PROPERTIES TIMEOUT 120) set_tests_properties(test_concat_op PROPERTIES TIMEOUT 240)
set_tests_properties(test_conv3d_transpose_part2_op PROPERTIES TIMEOUT 120) set_tests_properties(test_conv3d_transpose_part2_op PROPERTIES TIMEOUT 120)
set_tests_properties(test_conv3d_op PROPERTIES TIMEOUT 120) set_tests_properties(test_conv3d_op PROPERTIES TIMEOUT 120)
set_tests_properties(test_norm_op PROPERTIES TIMEOUT 120) set_tests_properties(test_norm_op PROPERTIES TIMEOUT 150)
set_tests_properties(test_batch_norm_op_prim_nchw PROPERTIES TIMEOUT 250) set_tests_properties(test_batch_norm_op_prim_nchw PROPERTIES TIMEOUT 250)
set_tests_properties(test_batch_norm_op_prim_nhwc PROPERTIES TIMEOUT 250) set_tests_properties(test_batch_norm_op_prim_nhwc PROPERTIES TIMEOUT 250)
set_tests_properties(test_layer_norm_op PROPERTIES TIMEOUT 250) set_tests_properties(test_layer_norm_op PROPERTIES TIMEOUT 250)
...@@ -1378,6 +1378,20 @@ foreach(IR_OP_TEST ${NEW_IR_OP_TESTS}) ...@@ -1378,6 +1378,20 @@ foreach(IR_OP_TEST ${NEW_IR_OP_TESTS})
endif() endif()
endforeach() endforeach()
file(STRINGS
"${CMAKE_SOURCE_DIR}/test/white_list/new_ir_op_test_precision_white_list"
NEW_IR_OP_RELAXED_TESTS)
foreach(IR_OP_TEST ${NEW_IR_OP_RELAXED_TESTS})
if(TEST ${IR_OP_TEST})
set_tests_properties(
${IR_OP_TEST} PROPERTIES ENVIRONMENT
"FLAGS_NEW_IR_OPTEST_RELAX_CHECK=True")
else()
message(
STATUS "NewIR Relaxed OpTest: not found ${IR_OP_TEST} in legacy_test")
endif()
endforeach()
set(STRIED_TESTS set(STRIED_TESTS
test_complex_getitem test_complex_getitem
test_complex_grad_accumulated test_complex_grad_accumulated
......
...@@ -1232,8 +1232,15 @@ class OpTest(unittest.TestCase): ...@@ -1232,8 +1232,15 @@ class OpTest(unittest.TestCase):
assert len(outs) == len( assert len(outs) == len(
ir_outs ir_outs
), "Fetch result should have same length when executed in new ir" ), "Fetch result should have same length when executed in new ir"
check_method = np.testing.assert_array_equal
if os.getenv("FLAGS_NEW_IR_OPTEST_RELAX_CHECK", None):
check_method = lambda x, y, z: np.testing.assert_allclose(
x, y, err_msg=z, atol=1e-6, rtol=1e-6
)
for i in range(len(outs)): for i in range(len(outs)):
np.testing.assert_array_equal( check_method(
outs[i], outs[i],
ir_outs[i], ir_outs[i],
err_msg='Operator Check (' err_msg='Operator Check ('
...@@ -2915,8 +2922,14 @@ class OpTest(unittest.TestCase): ...@@ -2915,8 +2922,14 @@ class OpTest(unittest.TestCase):
) )
) )
check_method = np.testing.assert_array_equal
if os.getenv("FLAGS_NEW_IR_OPTEST_RELAX_CHECK", None):
check_method = lambda x, y, z: np.testing.assert_allclose(
x, y, err_msg=z, atol=1e-6, rtol=1e-6
)
for i in range(len(new_gradients)): for i in range(len(new_gradients)):
np.testing.assert_array_equal( check_method(
gradients[i], gradients[i],
new_gradients[i], new_gradients[i],
err_msg='Operator GradCheck (' err_msg='Operator GradCheck ('
......
test_affine_grid_op
test_bicubic_interp_v2_op
test_conv2d_op
test_conv2d_op_depthwise_conv
test_conv2d_transpose_op
test_conv2d_transpose_op_depthwise_conv
test_conv3d_op
test_conv3d_transpose_op
test_conv3d_transpose_part2_op
test_deformable_conv_op
test_graph_send_recv_op
test_graph_send_ue_recv_op
test_grid_sampler_op
test_group_norm_op
test_pool2d_op
test_pool3d_op
test_trilinear_interp_v2_op
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册