Skip to content

Commit b4f0809

Browse files
committed
Update on "Reuse GELU implementation from PyTorch core"
kernels/optimized doesn't need to support embedded systems, so it can just take a header-only dep on PyTorch. Note that, because we will pick up Sleef internally and ignore it externally thanks to ATen vec, this PR gets to enable optimized GELU in OSS. Testing: CI to make sure this doesn't break mobile build modes; happy to take advice on anything not currently covered that might break. Differential Revision: [D66335522](https://our.internmc.facebook.com/intern/diff/D66335522/) [ghstack-poisoned]
2 parents 03a87cc + b3765c3 commit b4f0809

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

build/Utils.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,12 @@ endfunction()
329329
macro(find_package_torch_headers)
330330
# We cannot simply use CMAKE_FIND_ROOT_PATH_BOTH, because that does
331331
# not propagate into TorchConfig.cmake.
332-
set(OLD_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
333-
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
332+
foreach(mode_kind IN ITEMS PACKAGE LIBRARY INCLUDE)
333+
set(OLD_CMAKE_FIND_ROOT_PATH_MODE_${mode_kind} ${CMAKE_FIND_ROOT_PATH_MODE_${mode_kind}})
334+
set(CMAKE_FIND_ROOT_PATH_MODE_${mode_kind} BOTH)
335+
endforeach()
334336
find_package(Torch CONFIG REQUIRED)
335-
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${OLD_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
337+
foreach(mode_kind IN ITEMS PACKAGE LIBRARY INCLUDE)
338+
set(CMAKE_FIND_ROOT_PATH_MODE_${mode_kind} ${OLD_CMAKE_FIND_ROOT_PATH_MODE_${mode_kind}})
339+
endforeach()
336340
endmacro()

0 commit comments

Comments
 (0)