Skip to content

Commit 5f9c692

Browse files
xinyazhangjithunnair-amd
authored andcommitted
[ROCm] Fix environment variable AOTRITON_INSTALLED_PREFIX (pytorch#163373)
Early assignment of `__AOTRITON_LIB` breaks the usage of environment variable `$AOTRITON_INSTALLED_PREFIX` Pull Request resolved: pytorch#163373 Approved by: https://github.com/pruthvistony, https://github.com/jeffdaily
1 parent 3a62a4d commit 5f9c692

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cmake/External/aotriton.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ if(NOT __AOTRITON_INCLUDED)
4646
set(__AOTRITON_BASE_URL "https://github.com/ROCm/aotriton/releases/download/") # @lint-ignore
4747
set(__AOTRITON_Z "gz")
4848
# Set the default __AOTRITON_LIB path
49-
set(__AOTRITON_LIB "${__AOTRITON_INSTALL_DIR}/lib/libaotriton_v2.so")
50-
if(WIN32)
51-
set(__AOTRITON_LIB "${__AOTRITON_INSTALL_DIR}/lib/aotriton_v2.lib")
49+
if(NOT WIN32)
50+
set(__AOTRITON_LIB "lib/libaotriton_v2.so")
51+
else()
52+
set(__AOTRITON_LIB "lib/aotriton_v2.lib")
5253
endif()
5354

5455
function(aotriton_build_windows_dependencies dlfcn-win32_external xz_external dlfcn-win32_DIR liblzma_DIR)
@@ -143,8 +144,7 @@ if(NOT __AOTRITON_INCLUDED)
143144
-DHIP_PLATFORM=amd
144145
$<$<BOOL:${WIN32}>:-Ddlfcn-win32_DIR=${dlfcn-win32_DIR}>
145146
$<$<BOOL:${WIN32}>:-Dliblzma_DIR=${liblzma_DIR}>
146-
BUILD_BYPRODUCTS
147-
"${__AOTRITON_LIB}"
147+
BUILD_BYPRODUCTS "${__AOTRITON_INSTALL_DIR}/${__AOTRITON_LIB}"
148148
USES_TERMINAL_DOWNLOAD TRUE
149149
USES_TERMINAL_CONFIGURE TRUE
150150
USES_TERMINAL_BUILD TRUE
@@ -177,7 +177,7 @@ if(NOT __AOTRITON_INCLUDED)
177177
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
178178
"${CMAKE_CURRENT_BINARY_DIR}/aotriton_runtime"
179179
"${__AOTRITON_INSTALL_DIR}"
180-
BUILD_BYPRODUCTS "${__AOTRITON_LIB}"
180+
BUILD_BYPRODUCTS "${__AOTRITON_INSTALL_DIR}/${__AOTRITON_LIB}"
181181
)
182182
message(STATUS "Using AOTriton Runtime from pre-compiled binary ${__AOTRITON_URL}.\
183183
Set env variables AOTRITON_INSTALL_FROM_SOURCE=1 to build from source.")
@@ -267,7 +267,7 @@ if(NOT __AOTRITON_INCLUDED)
267267
endforeach()
268268
endforeach()
269269
endif()
270-
target_link_libraries(__caffe2_aotriton INTERFACE ${__AOTRITON_LIB})
270+
target_link_libraries(__caffe2_aotriton INTERFACE "${__AOTRITON_INSTALL_DIR}/${__AOTRITON_LIB}")
271271
target_include_directories(__caffe2_aotriton INTERFACE ${__AOTRITON_INSTALL_DIR}/include)
272272
set(AOTRITON_FOUND TRUE)
273273
endif() # __AOTRITON_INCLUDED

0 commit comments

Comments
 (0)