@@ -465,12 +465,12 @@ def __init__(self, name: str, sourcedir: str) -> None:
465465 print (name , sourcedir )
466466 self .sourcedir = sourcedir
467467
468- def get_cmake_abi_args ( cmake_args ):
468+ def get_compile_abi_args ( compile_args ):
469469 if torch .compiled_with_cxx11_abi ():
470- cmake_args .append ("-D_GLIBCXX_USE_CXX11_ABI=1" )
470+ compile_args .append ("-D_GLIBCXX_USE_CXX11_ABI=1" )
471471 else :
472- cmake_args .append ("-D_GLIBCXX_USE_CXX11_ABI=0" )
473- return cmake_args
472+ compile_args .append ("-D_GLIBCXX_USE_CXX11_ABI=0" )
473+ return compile_args
474474
475475class CMakeBuild (BuildExtension ):
476476
@@ -512,7 +512,7 @@ def build_extension(self, ext) -> None:
512512 else :
513513 raise ValueError ("Unsupported backend: CUDA_HOME, MUSA_HOME, and ROCM_HOME are not set and XPU is not available." )
514514
515- cmake_args = get_cmake_abi_args (cmake_args )
515+ cmake_args = get_compile_abi_args (cmake_args )
516516 # log cmake_args
517517 print ("CMake args:" , cmake_args )
518518
@@ -603,12 +603,12 @@ def build_extension(self, ext) -> None:
603603 ],
604604 extra_compile_args = {
605605 'cxx' : ['-O3' , '-DKTRANSFORMERS_USE_CUDA' ],
606- 'nvcc' : [
606+ 'nvcc' : get_compile_abi_args ( [
607607 '-O3' ,
608608 # '--use_fast_math',
609609 '-Xcompiler' , '-fPIC' ,
610610 '-DKTRANSFORMERS_USE_CUDA' ,
611- ]
611+ ])
612612 }
613613 )
614614elif MUSA_HOME is not None :
@@ -627,11 +627,11 @@ def build_extension(self, ext) -> None:
627627 ],
628628 extra_compile_args = {
629629 'cxx' : ['force_mcc' ],
630- 'mcc' : [
630+ 'mcc' : get_compile_abi_args ( [
631631 '-O3' ,
632632 '-DKTRANSFORMERS_USE_MUSA' ,
633633 '-DTHRUST_IGNORE_CUB_VERSION_CHECK' ,
634- ]
634+ ])
635635 }
636636 )
637637elif torch .xpu .is_available (): #XPUExtension is not available now.
0 commit comments