Skip to content

Commit 43e36d2

Browse files
authored
[hipDNN] Standardize variable names (ROCm#3692)
## Motivation Users were faced with inconsistent prefixes for HIPDNN CMake variable names. ## Technical Details Standardize on HIPDNN_ variable prefix. Specifically, the following variables were renamed to start with HIPDNN_: - HIP_DNN_BUILD_BACKEND - HIP_DNN_BUILD_FRONTEND - HIP_DNN_BUILD_PLUGINS - HIP_DNN_GENERATE_SDK_HEADERS - HIP_DNN_SKIP_TESTS ## Test Plan Perform configure with old and new variables. Verify that both old and new variables properly affect build. Verify od variables continue to work but issue deprecation message.
1 parent 6509e12 commit 43e36d2

13 files changed

Lines changed: 69 additions & 37 deletions

File tree

dnn-providers/miopen-provider/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ if(NOT BUILD_PLUGIN_AS_DEPENDENCY)
3939
)
4040

4141
# Enable testing for standalone build
42-
option(HIP_DNN_SKIP_TESTS "Skip building tests" OFF)
42+
# Migrate HIP_DNN_SKIP_TESTS -> HIPDNN_SKIP_TESTS
43+
if(DEFINED HIP_DNN_SKIP_TESTS)
44+
set(HIPDNN_SKIP_TESTS ${HIP_DNN_SKIP_TESTS} CACHE BOOL "Skip building tests" FORCE)
45+
unset(HIP_DNN_SKIP_TESTS CACHE)
46+
message(DEPRECATION "HIP_DNN_SKIP_TESTS has been renamed to HIPDNN_SKIP_TESTS. Please update your build scripts to use -DHIPDNN_SKIP_TESTS instead.")
47+
endif()
48+
option(HIPDNN_SKIP_TESTS "Skip building tests" OFF)
4349

4450
list(
4551
PREPEND
@@ -154,7 +160,7 @@ if(BUILD_PLUGIN_AS_DEPENDENCY)
154160
clang_tidy_check(miopen_legacy_plugin)
155161
endif()
156162

157-
if(NOT HIP_DNN_SKIP_TESTS)
163+
if(NOT HIPDNN_SKIP_TESTS)
158164
add_subdirectory(tests)
159165
add_subdirectory(integration_tests)
160166

dnn-providers/miopen-provider/cmake/Dependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
cmake_minimum_required(VERSION 3.25.2)
55

66
# Only setup dependencies for standalone builds
7-
if(NOT BUILD_PLUGIN_AS_DEPENDENCY AND NOT HIP_DNN_SKIP_TESTS)
7+
if(NOT BUILD_PLUGIN_AS_DEPENDENCY AND NOT HIPDNN_SKIP_TESTS)
88
include(FetchContent)
99

1010
# Try to find GTest first

dnn-providers/miopen-provider/cmake/Tests.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright © Advanced Micro Devices, Inc., or its affiliates.
22
# SPDX-License-Identifier: MIT
33

4-
if(HIP_DNN_SKIP_TESTS)
4+
if(HIPDNN_SKIP_TESTS)
55
return()
66
endif()
77

projects/hipdnn/CMakeLists.txt

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,45 @@ install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/hipdnn_reference_data"
101101
DESTINATION ${HIPDNN_TEST_REFERENCE_INSTALL_DIR}
102102
)
103103

104-
option(HIP_DNN_BUILD_BACKEND "Build the backend code" ON)
105-
option(HIP_DNN_BUILD_FRONTEND "Build the frontend code" ON)
106-
option(HIP_DNN_BUILD_PLUGINS "Builds the plugins as part of the main cmake" ON)
107-
option(HIP_DNN_GENERATE_SDK_HEADERS "Automatically generates sdk headers from schema during build"
108-
ON
109-
)
110-
option(HIP_DNN_SKIP_TESTS "Skips building all tests" OFF)
104+
# Migrate HIP_DNN_BUILD_BACKEND -> HIPDNN_BUILD_BACKEND
105+
if(DEFINED HIP_DNN_BUILD_BACKEND)
106+
set(HIPDNN_BUILD_BACKEND ${HIP_DNN_BUILD_BACKEND} CACHE BOOL "Build the backend code" FORCE)
107+
unset(HIP_DNN_BUILD_BACKEND CACHE)
108+
message(DEPRECATION "HIP_DNN_BUILD_BACKEND has been renamed to HIPDNN_BUILD_BACKEND. Please update your build scripts to use -DHIPDNN_BUILD_BACKEND instead.")
109+
endif()
110+
option(HIPDNN_BUILD_BACKEND "Build the backend code" ON)
111+
112+
# Migrate HIP_DNN_BUILD_FRONTEND -> HIPDNN_BUILD_FRONTEND
113+
if(DEFINED HIP_DNN_BUILD_FRONTEND)
114+
set(HIPDNN_BUILD_FRONTEND ${HIP_DNN_BUILD_FRONTEND} CACHE BOOL "Build the frontend code" FORCE)
115+
unset(HIP_DNN_BUILD_FRONTEND CACHE)
116+
message(DEPRECATION "HIP_DNN_BUILD_FRONTEND has been renamed to HIPDNN_BUILD_FRONTEND. Please update your build scripts to use -DHIPDNN_BUILD_FRONTEND instead.")
117+
endif()
118+
option(HIPDNN_BUILD_FRONTEND "Build the frontend code" ON)
119+
120+
# Migrate HIP_DNN_BUILD_PLUGINS -> HIPDNN_BUILD_PLUGINS
121+
if(DEFINED HIP_DNN_BUILD_PLUGINS)
122+
set(HIPDNN_BUILD_PLUGINS ${HIP_DNN_BUILD_PLUGINS} CACHE BOOL "Builds the plugins as part of the main cmake" FORCE)
123+
unset(HIP_DNN_BUILD_PLUGINS CACHE)
124+
message(DEPRECATION "HIP_DNN_BUILD_PLUGINS has been renamed to HIPDNN_BUILD_PLUGINS. Please update your build scripts to use -DHIPDNN_BUILD_PLUGINS instead.")
125+
endif()
126+
option(HIPDNN_BUILD_PLUGINS "Builds the plugins as part of the main cmake" ON)
127+
128+
# Migrate HIP_DNN_GENERATE_SDK_HEADERS -> HIPDNN_GENERATE_SDK_HEADERS
129+
if(DEFINED HIP_DNN_GENERATE_SDK_HEADERS)
130+
set(HIPDNN_GENERATE_SDK_HEADERS ${HIP_DNN_GENERATE_SDK_HEADERS} CACHE BOOL "Automatically generates sdk headers from schema during build" FORCE)
131+
unset(HIP_DNN_GENERATE_SDK_HEADERS CACHE)
132+
message(DEPRECATION "HIP_DNN_GENERATE_SDK_HEADERS has been renamed to HIPDNN_GENERATE_SDK_HEADERS. Please update your build scripts to use -DHIPDNN_GENERATE_SDK_HEADERS instead.")
133+
endif()
134+
option(HIPDNN_GENERATE_SDK_HEADERS "Automatically generates sdk headers from schema during build" ON)
135+
136+
# Migrate HIP_DNN_SKIP_TESTS -> HIPDNN_SKIP_TESTS
137+
if(DEFINED HIP_DNN_SKIP_TESTS)
138+
set(HIPDNN_SKIP_TESTS ${HIP_DNN_SKIP_TESTS} CACHE BOOL "Skips building all tests" FORCE)
139+
unset(HIP_DNN_SKIP_TESTS CACHE)
140+
message(DEPRECATION "HIP_DNN_SKIP_TESTS has been renamed to HIPDNN_SKIP_TESTS. Please update your build scripts to use -DHIPDNN_SKIP_TESTS instead.")
141+
endif()
142+
option(HIPDNN_SKIP_TESTS "Skips building all tests" OFF)
111143

112144
option(HIPDNN_ENABLE_COVERAGE "Build with code coverage flags" OFF)
113145
option(BUILD_ADDRESS_SANITIZER "Build with Address Sanitizer enabled" OFF)
@@ -170,11 +202,11 @@ add_link_options(${EXTRA_LINK_OPTIONS})
170202

171203
add_subdirectory(data_sdk)
172204

173-
if(HIP_DNN_BUILD_BACKEND)
205+
if(HIPDNN_BUILD_BACKEND)
174206
add_subdirectory(backend)
175207
endif()
176208

177-
if(HIP_DNN_BUILD_FRONTEND)
209+
if(HIPDNN_BUILD_FRONTEND)
178210
add_subdirectory(frontend)
179211
endif()
180212

@@ -183,12 +215,12 @@ add_subdirectory(plugin_sdk)
183215

184216
add_subdirectory(tests)
185217

186-
if(HIP_DNN_BUILD_PLUGINS)
218+
if(HIPDNN_BUILD_PLUGINS)
187219
file(MAKE_DIRECTORY ${HIPDNN_BUILD_PLUGIN_ENGINE_DIR})
188220
add_subdirectory(plugins)
189221
endif()
190222

191-
if(NOT HIP_DNN_SKIP_TESTS)
223+
if(NOT HIPDNN_SKIP_TESTS)
192224
# Keep this after all build folders have been added so they have a chance to register their tests
193225
# using add_*_test_target()
194226
finalize_test_targets()
@@ -200,7 +232,7 @@ add_clang_tidy_custom_target()
200232
if(HIPDNN_ENABLE_COVERAGE)
201233
findandcheckllvmtools()
202234

203-
if(HIP_DNN_BUILD_PLUGINS)
235+
if(HIPDNN_BUILD_PLUGINS)
204236
set(MIOPEN_PLUGIN_CODE_COVERAGE_OBJECT
205237
-object ${HIPDNN_BUILD_PLUGIN_ENGINE_DIR}/libmiopen_legacy_plugin.so -object
206238
./${CMAKE_INSTALL_BINDIR}/miopen_legacy_plugin_tests
@@ -270,10 +302,10 @@ if(HIPDNN_ENABLE_COVERAGE)
270302
# cmake-format: on
271303
endfunction()
272304
273-
if(HIP_DNN_SKIP_TESTS)
305+
if(HIPDNN_SKIP_TESTS)
274306
message(
275307
WARNING
276-
"\nThe code coverage targets depend on test targets but test targets don't exist because HIP_DNN_SKIP_TESTS is enabled."
308+
"\nThe code coverage targets depend on test targets but test targets don't exist because HIPDNN_SKIP_TESTS is enabled."
277309
)
278310
else()
279311
add_custom_coverage_target(code_coverage check) # code_coverage depends on 'check'
@@ -293,6 +325,6 @@ if(HIPDNN_ENABLE_COVERAGE)
293325
294326
endif()
295327
296-
if(NOT HIP_DNN_SKIP_TESTS)
328+
if(NOT HIPDNN_SKIP_TESTS)
297329
install_hipdnn_ctest_files()
298330
endif()

projects/hipdnn/backend/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
include(GoogleTest)
55

6-
if(HIP_DNN_SKIP_TESTS)
6+
if(HIPDNN_SKIP_TESTS)
77
message(STATUS "Skipping HIP-DNN Backend Unit tests")
88
return()
99
endif()

projects/hipdnn/cmake/Tests.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright © Advanced Micro Devices, Inc., or its affiliates.
22
# SPDX-License-Identifier: MIT
33

4-
if(HIP_DNN_SKIP_TESTS)
4+
if(HIPDNN_SKIP_TESTS)
55
return()
66
endif()
77

projects/hipdnn/data_sdk/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ target_include_directories(
114114
)
115115

116116
# Automatically generate the flatbuffer headers from the schema files during build
117-
if(HIP_DNN_GENERATE_SDK_HEADERS)
117+
if(HIPDNN_GENERATE_SDK_HEADERS)
118118
set(SCHEMA_FILES
119119
schemas/batchnorm_attributes.fbs
120120
schemas/batchnorm_backward_attributes.fbs

projects/hipdnn/data_sdk/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
include(GoogleTest)
55

6-
if(HIP_DNN_SKIP_TESTS)
6+
if(HIPDNN_SKIP_TESTS)
77
message(STATUS "Skipping Data SDK tests")
88
return()
99
endif()

projects/hipdnn/docs/Building.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,7 @@ ninja check
124124
### Building Specific Components
125125
```bash
126126
# Build without plugins
127-
cmake -GNinja -DHIP_DNN_BUILD_PLUGINS=OFF ..
128-
129-
# Build without frontend
130-
cmake -GNinja -DHIP_DNN_BUILD_FRONTEND=OFF ..
131-
132-
# Build without backend
133-
cmake -GNinja -DHIP_DNN_BUILD_BACKEND=OFF ..
127+
cmake -GNinja -DHIPDNN_BUILD_PLUGINS=OFF ..
134128
```
135129

136130
### ROCM_PATH, ROCM_CMAKE_PATH, and CMAKE_INSTALL_PREFIX

projects/hipdnn/frontend/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
include(GoogleTest)
55

6-
if(HIP_DNN_SKIP_TESTS)
6+
if(HIPDNN_SKIP_TESTS)
77
message(STATUS "Skipping HIP-DNN Frontend Unit tests")
88
return()
99
endif()

0 commit comments

Comments
 (0)