pytorch / FBGEMM

FB (Facebook) + GEMM (General Matrix-Matrix Multiplication) - https://code.fb.com/ml-applications/fbgemm/
Other
1.17k stars 474 forks source link

Build failure with msvc v142 toolchain #2924

Closed star-hengxing closed 1 month ago

star-hengxing commented 1 month ago

https://github.com/xmake-io/xmake-repo/actions/runs/10200454230/job/28219976432

C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2408\f\fbgemm\v0.8.0\source\src\Utils.cc(804,5): error C2760: syntax error: unexpected token '}', expected 'statement'

https://github.com/pytorch/FBGEMM/blob/e3db758482999d732739a0010d018f2669dbdeaa/src/Utils.cc#L801-L805

I find a workaround from https://developercommunity.visualstudio.com/t/pragma-omp-barrier-ignored-for-std:c/10339559 It work for me.

diff --git a/src/Utils.cc b/src/Utils.cc
index bd970432..a3829247 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -801,6 +801,7 @@ std::pair<K*, V*> radix_sort_parallel(
       std::swap(input_keys, output_keys);
       std::swap(input_values, output_values);
 #pragma omp barrier
+{}
     }
   }
 #ifdef _MSC_VER
q10 commented 1 month ago

I have placed your fix suggestion into https://github.com/pytorch/FBGEMM/pull/2918. Thank you for the work in porting FBGEMM to xmake!