Skip to content

Commit b541758

Browse files
authored
[Bug Fixes] fix bug when backword kernel in the same file with forward (#67218)
1 parent 73463ea commit b541758

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmake/phi.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ function(kernel_declare TARGET_LIST)
8181
"(PD_REGISTER_KERNEL|PD_REGISTER_KERNEL_FOR_ALL_DTYPE|PD_REGISTER_KERNEL_FOR_ALL_BACKEND_DTYPE|PD_REGISTER_KERNEL_FOR_ALL_BACKEND_DTYPE_EXCEPT_CUSTOM)\\([ \t\r\n]*[a-z0-9_]*,[[ \\\t\r\n\/]*[a-z0-9_]*]?[ \\\t\r\n]*[a-zA-Z_]*,[ \\\t\r\n]*[A-Z_]*"
8282
first_registry
8383
"${kernel_impl}")
84+
if(DEFINED REDUCE_INFERENCE_LIB_SIZE)
85+
if("${first_registry}" MATCHES ".*_grad,.*")
86+
continue()
87+
endif()
88+
endif()
8489
set(kernel_declare_id "")
8590
while(NOT first_registry STREQUAL "")
8691
string(REPLACE "${first_registry}" "" kernel_impl "${kernel_impl}")
@@ -162,11 +167,6 @@ function(kernel_declare TARGET_LIST)
162167
endwhile()
163168
# append kernel declare into declarations.h
164169
if(NOT kernel_declare_id STREQUAL "")
165-
if(DEFINED REDUCE_INFERENCE_LIB_SIZE)
166-
if(${kernel_declare_id} MATCHES ".*_grad,.*")
167-
continue()
168-
endif()
169-
endif()
170170
file(APPEND ${kernel_declare_file} "${kernel_declare_id}\n")
171171
endif()
172172
endforeach()

0 commit comments

Comments
 (0)