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

[tests] Removed support for OCL backend. Do not print rocminfo output unless GPU detection failed. Some cleanup. #2490

Merged
merged 6 commits into from
Oct 31, 2023
57 changes: 16 additions & 41 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ set(MIOPEN_TEST_LIMIT "2" CACHE STRING "")
set(MIOPEN_TEST_FLAGS "" CACHE STRING "")
set(MIOPEN_TEST_GDB On CACHE BOOL "")

set(MIOPEN_TEST_OPENCL FALSE)
if(MIOPEN_BACKEND_OPENCL)
set(MIOPEN_TEST_OPENCL TRUE)
endif()

set(MIOPEN_TEST_HIP_NOGPU FALSE)
if(MIOPEN_MODE_NOGPU)
set(MIOPEN_TEST_HIP_NOGPU TRUE)
Expand Down Expand Up @@ -117,7 +112,6 @@ if(NOT (MIOPEN_TEST_GFX900 OR MIOPEN_TEST_GFX906 OR MIOPEN_TEST_GFX908 OR MIOPEN
OUTPUT_VARIABLE ROCMINFO_OUTPUT
RESULT_VARIABLE ROCMINFO_EXIT_STATUS
)
message(STATUS "${ROCMINFO_OUTPUT}")
if(ROCMINFO_OUTPUT MATCHES "no GPU devices")
message(WARNING "ROCk module is NOT loaded, possibly no GPU devices")
set(MIOPEN_NO_GPU TRUE)
Expand Down Expand Up @@ -152,6 +146,10 @@ if(NOT (MIOPEN_TEST_GFX900 OR MIOPEN_TEST_GFX906 OR MIOPEN_TEST_GFX908 OR MIOPEN
if(NOT (MIOPEN_TEST_GPU_DETECTION_FAILED) AND ROCMINFO_OUTPUT MATCHES "xnack\\+")
set(MIOPEN_TEST_GPU_XNACK_ENABLED ON)
endif()

if(MIOPEN_TEST_GPU_DETECTION_FAILED)
message(STATUS "${ROCMINFO_OUTPUT}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't clutter cmake output if everything is Ok

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do a higher level instead of STATUS ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JehandadKhan I do not think this is necessary. The higher level message (i.e. error) should already be output. This message is additional information. But no problem to change, if you wish

endif()
else()
message(WARNING "ROCMINFO NOT FOUND, GPU TYPE UNKNOWN. Manually set respective MIOPEN_TEST_GFX* CMake variable to specify target GPU for testing.")
set(MIOPEN_TEST_GPU_DETECTION_FAILED TRUE)
Expand Down Expand Up @@ -238,11 +236,7 @@ option( WORKAROUND_ISSUE_1187 "" ${WORKAROUND_ISSUE_1187_DEFAULT})
set_var_to_condition(WORKAROUND_ISSUE_1148_DEFAULT (MIOPEN_TEST_GFX103X OR MIOPEN_TEST_GFX110X) AND MIOPEN_TEST_FLOAT)
option( WORKAROUND_ISSUE_1148 "" ${WORKAROUND_ISSUE_1148_DEFAULT})

if(MIOPEN_TEST_HALF)
if(MIOPEN_BACKEND_OPENCL)
set(SKIP_TESTS test_gru test_rnn_vanilla test_lstm)
endif()
elseif(MIOPEN_TEST_INT8)
if(MIOPEN_TEST_INT8)
set(SKIP_ALL_EXCEPT_TESTS
test_tensor_vec test_tensor_cast test_tensor_trans test_tensor_copy test_tensor_set
test_tensor_transform test_conv2d test_conv2d_find2)
Expand All @@ -268,16 +262,6 @@ if(MIOPEN_NO_GPU)
test_pooling3d test_perfdb)
endif()

#TODO Code Quality WORKAROUND ROCm 5.1 update
if(MIOPEN_BACKEND_OPENCL AND MIOPEN_TEST_ALL)
if(MIOPEN_TEST_GFX900 OR MIOPEN_TEST_GFX906)
list(APPEND SKIP_TESTS test_conv3d test_immed_conv3d test_immed_conv2d test_conv3d_find2)
endif()
if(MIOPEN_TEST_GFX103X OR MIOPEN_TEST_GFX110X)
list(APPEND SKIP_TESTS test_conv3d test_immed_conv3d test_immed_conv2d test_conv3d_find2)
endif()
endif()

#TODO WORKAROUND_ISSUE_1424
if(MIOPEN_TEST_GFX900 OR MIOPEN_TEST_GFX906 OR MIOPEN_TEST_GFX908)
list(APPEND SKIP_TESTS test_bn_3d_spatial_test)
Expand Down Expand Up @@ -536,17 +520,17 @@ endfunction()
# SKIP_UNLESS_MLIR - The test should be only run if MIOPEN_TEST_MLIR=TRUE.
# SKIP_UNLESS_COMPOSABLEKERNEL - The test should be only run if MIOPEN_TEST_COMPOSABLEKERNEL=TRUE.
#
# Backend: OCL HIP HIP_NOGPU
# Backend: HIP HIP_NOGPU
# These attributes can be enabled or disabled by using '_ENABLED' and '_DISABLED' suffix.
# Default: OCL_ENABLED HIP_ENABLED HIP_NOGPU_DISABLED.
# Default: HIP_ENABLED HIP_NOGPU_DISABLED.

function(add_custom_test NAME)
set(options
BF16_ENABLED BF16_DISABLED HALF_ENABLED HALF_DISABLED INT8_ENABLED INT8_DISABLED FLOAT_ENABLED FLOAT_DISABLED
GFX900_ENABLED GFX900_DISABLED GFX906_ENABLED GFX906_DISABLED GFX908_ENABLED GFX908_DISABLED
GFX103X_ENABLED GFX103X_DISABLED GFX110X_ENABLED GFX110X_DISABLED GFX90A_ENABLED GFX90A_DISABLED GFX94X_ENABLED GFX94X_DISABLED
SKIP_UNLESS_MLIR SKIP_UNLESS_COMPOSABLEKERNEL SKIP_UNLESS_ALL TEST_PERF_DB_RECORD_NOT_FOUND TEST_TUNING SKIP_XNACK_ON
OCL_ENABLED OCL_DISABLED HIP_ENABLED HIP_DISABLED HIP_NOGPU_ENABLED HIP_NOGPU_DISABLED
HIP_ENABLED HIP_DISABLED HIP_NOGPU_ENABLED HIP_NOGPU_DISABLED
)
set(oneValueArgs)
set(multiValueArgs)
Expand Down Expand Up @@ -583,12 +567,6 @@ function(add_custom_test NAME)
bool_not_f(${PARSE_SKIP_UNLESS_COMPOSABLEKERNEL} is_composablekernel_check)
bool_or_f(${is_composablekernel_check} ${MIOPEN_TEST_COMPOSABLEKERNEL} is_composablekernel_check)

set(is_ocl_check)
set(OCL_TEST_DEFAULT TRUE)
option_support_check(${PARSE_OCL_ENABLED} ${PARSE_OCL_DISABLED} ${OCL_TEST_DEFAULT} is_ocl_check)
bool_not_f(${MIOPEN_TEST_OPENCL} NOT_MIOPEN_TEST_OPENCL)
bool_or_f(${NOT_MIOPEN_TEST_OPENCL} ${is_ocl_check} is_ocl_check)

set(is_hip_check)
set(HIP_TEST_DEFAULT TRUE)
option_support_check(${PARSE_HIP_ENABLED} ${PARSE_HIP_DISABLED} ${HIP_TEST_DEFAULT} is_hip_check)
Expand Down Expand Up @@ -676,7 +654,7 @@ function(add_custom_test NAME)
AND is_mlir_check
AND is_composablekernel_check
AND (is_half_check OR is_bfloat16_check OR is_int8_check OR is_float_check)
AND (is_ocl_check AND is_hip_check AND is_hip_nogpu_check)
AND (is_hip_check AND is_hip_nogpu_check)
)
if(PARSE_TEST_PERF_DB_RECORD_NOT_FOUND AND PARSE_TEST_TUNING)
message(FATAL_ERROR " TEST_PERF_DB_RECORD_NOT_FOUND and TEST_TUNING should not be used together")
Expand Down Expand Up @@ -750,14 +728,14 @@ if(${MIOPEN_TEST_WITH_MIOPENDRIVER})
set_tests_properties(test_miopendriver_regression_big_tensor
PROPERTIES TIMEOUT 600)

add_custom_test(test_miopendriver_regression_half_gfx9 SKIP_UNLESS_ALL GFX900_DISABLED GFX906_DISABLED GFX908_DISABLED GFX90A_ENABLED GFX94X_ENABLED GFX103X_DISABLED FLOAT_DISABLED HALF_ENABLED
add_custom_test(test_miopendriver_regression_half_gfx9 SKIP_UNLESS_ALL GFX900_DISABLED GFX906_DISABLED GFX908_DISABLED GFX94X_ENABLED GFX103X_DISABLED FLOAT_DISABLED HALF_ENABLED
# Regression test for:
# [SWDEV-375617] Fix 3d convolution Host API bug
# https://github.com/ROCmSoftwarePlatform/MIOpen/pull/1935
COMMAND $<TARGET_FILE:MIOpenDriver> ${MIOPENDRIVER_MODE_CONV} -n 2 -c 64 --in_d 128 -H 128 -W 128 -k 32 --fil_d 3 -y 3 -x 3 --pad_d 1 -p 1 -q 1 --conv_stride_d 1 -u 1 -v 1 --dilation_d 1 -l 1 -j 1 --spatial_dim 3 -m conv -g 1 -F 1 -t 1
)

add_custom_test(test_miopendriver_regression OCL_DISABLED GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED HALF_ENABLED BF16_ENABLED INT8_ENABLED
add_custom_test(test_miopendriver_regression_issue_2047 GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED HALF_ENABLED BF16_ENABLED INT8_ENABLED
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name of the test was too generic

# Regression test for: MIOpenIm3d2Col stuck with ROCm update, https://github.com/ROCmSoftwarePlatform/MIOpen/issues/2047
COMMAND MIOPEN_FIND_MODE=normal MIOPEN_DEBUG_FIND_ONLY_SOLVER=GemmFwdRest
$<TARGET_FILE:MIOpenDriver> ${MIOPENDRIVER_MODE_CONV}
Expand Down Expand Up @@ -1660,11 +1638,6 @@ add_custom_test(test_regression_half_mi100 SKIP_UNLESS_ALL FLOAT_DISABLED HALF_E
COMMAND MIOPEN_FIND_MODE=normal MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvHipImplicitGemmBwdDataV4R1Xdlops $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 24 14 14 --weights 64 24 5 5 --pads_strides_dilations 2 2 1 1 1 1 --disable-forward --disable-backward-weights
)

add_custom_test(test_regression_float_mi100 SKIP_UNLESS_ALL GFX900_DISABLED GFX906_DISABLED GFX90A_DISABLED
# Regression test for SWDEV-305815 (issue 1206)
COMMAND ${IMPLICITGEMM_TESTING_ENV} MIOPEN_LOG_LEVEL=5 $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 32 256 38 38 --weights 256 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 --disable-forward --disable-backward-weights
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to test_regression_float_mi100

)

# MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW is explicitly enabled due to the kernel is disabled by default via #2306
set(CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW_ENV
MIOPEN_FIND_MODE=normal
Expand Down Expand Up @@ -2096,7 +2069,7 @@ add_custom_test(smoke_solver_ConvHipImplicitGemmForwardV4R5Xdlops GFX900_DISABLE
${TEST_CONV_VERBOSE_F} --input 128 16 54 54 --weights 64 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 ${MIOPEN_TEST_FLAGS_ARGS}
)

add_custom_test(smoke_solver_ConvHipImplicitGemmFwdXdlops OCL_DISABLED GFX900_DISABLED GFX906_DISABLED GFX90A_DISABLED GFX94X_ENABLED HALF_ENABLED INT8_ENABLED
add_custom_test(smoke_solver_ConvHipImplicitGemmFwdXdlops GFX900_DISABLED GFX906_DISABLED GFX90A_DISABLED GFX94X_ENABLED HALF_ENABLED INT8_ENABLED
SKIP_UNLESS_COMPOSABLEKERNEL TEST_TUNING
COMMAND MIOPEN_FIND_ENFORCE=SEARCH_DB_UPDATE MIOPEN_DEBUG_TUNING_ITERATIONS_MAX=5
MIOPEN_FIND_MODE=normal MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvHipImplicitGemmFwdXdlops $<TARGET_FILE:test_conv2d>
Expand Down Expand Up @@ -2183,7 +2156,7 @@ add_custom_test(smoke_solver_ConvWinogradFuryRxSf2x3_f16 GFX900_DISABLED GFX906_
)

# FP16 ALT attribute is disabled to enable the backward solver on MI200 for HALF.
add_custom_test(smoke_solver_ConvWinograd3x3MultipassWrW HALF_ENABLED BF16_ENABLED SKIP_XNACK_ON OCL_DISABLED
add_custom_test(smoke_solver_ConvWinograd3x3MultipassWrW HALF_ENABLED BF16_ENABLED SKIP_XNACK_ON
COMMAND MIOPEN_DEBUG_CONVOLUTION_ATTRIB_FP16_ALT_IMPL=0
MIOPEN_FIND_MODE=normal MIOPEN_DEBUG_FIND_ONLY_SOLVER='ConvWinograd3x3MultipassWrW<3-2>' $<TARGET_FILE:test_conv2d>
${TEST_CONV_VERBOSE_W} --input 1 16 24 24 --weights 16 16 3 3 --pads_strides_dilations 1 1 2 2 1 1 ${MIOPEN_TEST_FLAGS_ARGS}
Expand Down Expand Up @@ -2285,7 +2258,7 @@ set(ARGS_REGRESSION_ISSUE_1012
--disable-backward-data
--disable-validation)

add_custom_test(test_regression_opencl_float_mi100 GFX900_DISABLED GFX906_DISABLED HIP_DISABLED GFX90A_DISABLED
add_custom_test(test_regression_float_mi100 GFX900_DISABLED GFX906_DISABLED GFX90A_DISABLED
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1012 is not OCL-specific actually

# Issue #1012.
COMMAND ${ENVS_REGRESSION_ISSUE_1012} $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --cmode conv --pmode default --group-count 1 --input 128, 832, 7, 7 --weights 32, 832, 1, 1 --pads_strides_dilations 0 0 1 1 1 1 ${ARGS_REGRESSION_ISSUE_1012}
COMMAND ${ENVS_REGRESSION_ISSUE_1012} $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --cmode conv --pmode default --group-count 1 --input 64, 192, 28, 28 --weights 64, 192, 1, 1 --pads_strides_dilations 0 0 1 1 1 1 ${ARGS_REGRESSION_ISSUE_1012}
Expand All @@ -2294,6 +2267,8 @@ add_custom_test(test_regression_opencl_float_mi100 GFX900_DISABLED GFX906_DISABL
COMMAND ${ENVS_REGRESSION_ISSUE_1012} $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --cmode conv --pmode default --group-count 1 --input 64, 512, 14, 14 --weights 128, 512, 1, 1 --pads_strides_dilations 0 0 1 1 1 1 ${ARGS_REGRESSION_ISSUE_1012}
COMMAND ${ENVS_REGRESSION_ISSUE_1012} $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --cmode conv --pmode default --group-count 1 --input 64, 512, 28, 28 --weights 128, 512, 1, 1 --pads_strides_dilations 0 0 1 1 1 1 ${ARGS_REGRESSION_ISSUE_1012}
COMMAND ${ENVS_REGRESSION_ISSUE_1012} $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --cmode conv --pmode default --group-count 1 --input 64, 64, 56, 56 --weights 256, 64, 1, 1 --pads_strides_dilations 0 0 1 1 1 1 ${ARGS_REGRESSION_ISSUE_1012}
# SWDEV-305815 (issue 1206)
COMMAND ${IMPLICITGEMM_TESTING_ENV} MIOPEN_LOG_LEVEL=5 $<TARGET_FILE:test_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 32 256 38 38 --weights 256 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 --disable-forward --disable-backward-weights
)

set(ENVS_FIND_ONLY_HIP_IGEMM_V4R4XDLOPS
Expand Down